class_docstr: Accessing clips from an encoded video using Decord video reading API
  as the decoding backend. For more details, please refer to -
  `Decord <https://github.com/dmlc/decord>`
class_docstr_tok: ["Accessing","clips","from","an","encoded","video","using","Decord","video","reading","API","as","the","decoding","backend",".","For","more","details",",","please","refer","to","-","`","Decord","<","https",":","\/\/github.com\/dmlc\/decord",">","`"]
docstr: Retrieves frames from the encoded video at the specified start and end times
  in seconds (the video always starts at 0 seconds).
  
  Args:
      start_sec (float): the clip start time in seconds
      end_sec (float): the clip end time in seconds
  Returns:
      clip_data:
          A dictionary mapping the entries at "video" and "audio" to a tensors.
  
          "video": A tensor of the clip's RGB frames with shape:
          (channel, time, height, width). The frames are of type torch.float32 and
          in the range [0 - 255].
  
          "audio": A tensor of the clip's audio samples with shape:
          (samples). The samples are of type torch.float32 and
          in the range [0 - 255].
  
      Returns None if no video or audio found within time range.
docstr_tok: ["Retrieves","frames","from","the","encoded","video","at","the","specified","start","and","end","times","in","seconds","(","the","video","always","starts","at","0","seconds",")",".","Args",":","start_sec","(","float",")",":","the","clip","start","time","in","seconds","end_sec","(","float",")",":","the","clip","end","time","in","seconds","Returns",":","clip_data",":","A","dictionary","mapping","the","entries","at","``","video","''","and","``","audio","''","to","a","tensors",".","``","video","''",":","A","tensor","of","the","clip","'s","RGB","frames","with","shape",":","(","channel",",","time",",","height",",","width",")",".","The","frames","are","of","type","torch.float32","and","in","the","range","[","0","-","255","]",".","``","audio","''",":","A","tensor","of","the","clip","'s","audio","samples","with","shape",":","(","samples",")",".","The","samples","are","of","type","torch.float32","and","in","the","range","[","0","-","255","]",".","Returns","None","if","no","video","or","audio","found","within","time","range","."]
code: def get_clip(
      self, start_sec: float, end_sec: float
  ) -> Dict[str, Optional[torch.Tensor]]:
      """
      Retrieves frames from the encoded video at the specified start and end times
      in seconds (the video always starts at 0 seconds).
  
      Args:
          start_sec (float): the clip start time in seconds
          end_sec (float): the clip end time in seconds
      Returns:
          clip_data:
              A dictionary mapping the entries at "video" and "audio" to a tensors.
  
              "video": A tensor of the clip's RGB frames with shape:
              (channel, time, height, width). The frames are of type torch.float32 and
              in the range [0 - 255].
  
              "audio": A tensor of the clip's audio samples with shape:
              (samples). The samples are of type torch.float32 and
              in the range [0 - 255].
  
          Returns None if no video or audio found within time range.
  
      """
      if start_sec > end_sec or start_sec > self._duration:
          raise RuntimeError(
              f"Incorrect time window for Decord decoding for video: {self._video_name}."
          )
  
      start_idx = math.ceil(self._fps * start_sec)
      end_idx = math.ceil(self._fps * end_sec)
      end_idx = min(end_idx, len(self._av_reader))
      frame_idxs = list(range(start_idx, end_idx))
      audio = None
  
      try:
          outputs = self._av_reader.get_batch(frame_idxs)
      except Exception as e:
          logger.debug(
              f"Failed to decode video with Decord: {self._video_name}. {e}"
          )
          raise e
  
      if self._decode_audio:
          audio, video = outputs
          if audio is not None:
              audio = list(audio)
              audio = torch.cat(audio, dim=1)
              audio = torch.flatten(audio)
              audio = audio.to(torch.float32)
      else:
          video = outputs
  
      if video is not None:
          video = video.to(torch.float32)
          video = thwc_to_cthw(video)
  
      return {
          "video": video,
          "audio": audio,
      }
  
file_path: pytorchvideo/pytorchvideo/data/encoded_video_decord.py
imports: import logging
  import math
  from typing import BinaryIO, Dict, Optional, TypeVar
  import torch
  from .utils import thwc_to_cthw
  from .video import Video
label_desc: Use image node_id 5 for calling the EncodedVideoDecord obj's underlying member method code with example usage: obj.get_clip(start_sec, end_sec) and returns: dict