class_docstr: Accessing clips from an encoded video using Torchvision video reading API
  (torch.ops.video_reader.read_video_from_memory) as the decoding backend.
class_docstr_tok: ["Accessing","clips","from","an","encoded","video","using","Torchvision","video","reading","API","(","torch.ops.video_reader.read_video_from_memory",")","as","the","decoding","backend","."]
docstr: Decode the video in the PTS range [start_pts, end_pts]
docstr_tok: ["Decode","the","video","in","the","PTS","range","[","start_pts",",","end_pts","]"]
code: def _torch_vision_decode_video(
      self, start_pts: int = 0, end_pts: int = -1
  ) -> float:
      """
      Decode the video in the PTS range [start_pts, end_pts]
      """
      video_and_pts = None
      audio_and_pts = None
  
      width, height, min_dimension, max_dimension = 0, 0, 0, 0
      video_start_pts, video_end_pts = start_pts, end_pts
      video_timebase_num, video_timebase_den = 0, 1
  
      samples, channels = 0, 0
      audio_start_pts, audio_end_pts = start_pts, end_pts
      audio_timebase_num, audio_timebase_den = 0, 1
  
      try:
          tv_result = torch.ops.video_reader.read_video_from_memory(
              self._video_tensor,
              self.SEEK_FRAME_MARGIN,
              # Set getPtsOnly=0, i.e., read full video rather than just header
              0,
              # Read video stream
              1,
              width,
              height,
              min_dimension,
              max_dimension,
              video_start_pts,
              video_end_pts,
              video_timebase_num,
              video_timebase_den,
              # Read audio stream
              self._decode_audio,
              samples,
              channels,
              audio_start_pts,
              audio_end_pts,
              audio_timebase_num,
              audio_timebase_den,
          )
      except Exception as e:
          logger.warning(
              f"Failed to decode video of name {self._video_name}. {e}"
          )
          raise e
  
      (
          vframes,
          vframes_pts,
          vtimebase,
          _,
          vduration,
          aframes,
          aframe_pts,
          atimebase,
          _,
          aduration,
      ) = tv_result
  
      if vduration < 0:
          # No header information to infer video duration
          video_duration = int(vframes_pts[-1])
      else:
          video_duration = int(vduration)
  
      video_and_pts = list(zip(vframes, vframes_pts))
      video_start_pts = int(vframes_pts[0])
      video_time_base = Fraction(int(vtimebase[0]), int(vtimebase[1]))
  
      audio_and_pts = None
      audio_time_base = None
      audio_start_pts = None
      audio_duration = None
      if self._decode_audio:
          if aduration < 0:
              # No header information to infer audio duration
              audio_duration = int(aframe_pts[-1])
          else:
              audio_duration = int(aduration)
  
          audio_and_pts = list(zip(aframes, aframe_pts))
          audio_start_pts = int(aframe_pts[0])
          audio_time_base = Fraction(
              int(atimebase[0]), int(atimebase[1])
          )
  
      return (
          video_and_pts,
          video_time_base,
          video_start_pts,
          video_duration,
          audio_and_pts,
          audio_time_base,
          audio_start_pts,
          audio_duration,
      )
  
file_path: pytorchvideo/pytorchvideo/data/encoded_video_torchvision.py
imports: import logging
  from fractions import Fraction
  from typing import BinaryIO, Dict, Optional
  import numpy
  import torch
  from .utils import pts_to_secs, secs_to_pts, thwc_to_cthw
  from .video import Video
label_desc: Use image node_id 6 for calling the EncodedVideoTorchVision obj's underlying member method code with example usage: obj._torch_vision_decode_video(start_pts, end_pts) and returns: video_and_pts,  video_time_base,  video_start_pts,  video_duration,  audio_and_pts,  audio_time_base,  audio_start_pts,  audio_duration