class_docstr: FrameVideo is an abstractions for accessing clips based on their start and end
  time for a video where each frame is stored as an image. PathManager is used for
  frame image reading, allowing non-local uri's to be used.
docstr: Args:
      duration (float): the duration of the video in seconds.
      fps (float): the target fps for the video. This is needed to link the frames
          to a second timestamp in the video.
      video_frame_to_path_fn (Callable[[int], str]): a function that maps from a frame
          index integer to the file path where the frame is located.
      video_frame_paths (List[str]): Dictionary of frame paths for each index of a video.
      multithreaded_io (bool):  controls whether parllelizable io operations are
          performed across multiple threads.
docstr_tok: ["Args",":","duration","(","float",")",":","the","duration","of","the","video","in","seconds",".","fps","(","float",")",":","the","target","fps","for","the","video",".","This","is","needed","to","link","the","frames","to","a","second","timestamp","in","the","video",".","video_frame_to_path_fn","(","Callable","[","[","int","]",",","str","]",")",":","a","function","that","maps","from","a","frame","index","integer","to","the","file","path","where","the","frame","is","located",".","video_frame_paths","(","List","[","str","]",")",":","Dictionary","of","frame","paths","for","each","index","of","a","video",".","multithreaded_io","(","bool",")",":","controls","whether","parllelizable","io","operations","are","performed","across","multiple","threads","."]
code: def __init__(
      self,
      duration: float,
      fps: float,
      video_frame_to_path_fn: Callable[[int], str] = None,
      video_frame_paths: List[str] = None,
      multithreaded_io: bool = False,
  ) -> None:
      """
      Args:
          duration (float): the duration of the video in seconds.
          fps (float): the target fps for the video. This is needed to link the frames
              to a second timestamp in the video.
          video_frame_to_path_fn (Callable[[int], str]): a function that maps from a frame
              index integer to the file path where the frame is located.
          video_frame_paths (List[str]): Dictionary of frame paths for each index of a video.
          multithreaded_io (bool):  controls whether parllelizable io operations are
              performed across multiple threads.
      """
      if not _HAS_CV2:
          raise ImportError(
              "opencv2 is required to use FrameVideo. Please "
              "install with 'pip install opencv-python'"
          )
  
      self._duration = duration
      self._fps = fps
      self._multithreaded_io = multithreaded_io
  
      assert (video_frame_to_path_fn is None) != (
          video_frame_paths is None
      ), "Only one of video_frame_to_path_fn or video_frame_paths can be provided"
      self._video_frame_to_path_fn = video_frame_to_path_fn
      self._video_frame_paths = video_frame_paths
  
      # Set the pathname to the parent directory of the first frame.
      self._name = os.path.basename(
          os.path.dirname(self._video_frame_to_path(frame_index=0))
      )
  
imports: from __future__ import annotations
  import logging
  import math
  import os
  import re
  import time
  from typing import Callable, Dict, List, Optional
  import numpy
  import torch
  import torch.utils.data
  from iopath.common.file_io import g_pathmgr
  from pytorchvideo.data.utils import optional_threaded_foreach
  from .utils import thwc_to_cthw
  from .video import Video
label_desc: Use image node_id 1 to create a new FrameVideo object from inherited base classes: Video with example: obj = FrameVideo(duration, fps, video_frame_to_path_fn, video_frame_paths, multithreaded_io)