class_docstr: Implementation of a video dataset.
  
  The VideoDataset allows random reads from a video file without extracting
  all frames beforehand. This is more storage efficient but is slower.
  
  Attributes:
      root:
          Root directory path.
      extensions:
          Tuple of allowed extensions.
      transform:
          Function that takes a PIL image and returns transformed version
      target_transform:
          As transform but for targets
      is_valid_file:
          Used to check corrupt files
      exception_on_non_increasing_timestamp:
          If True, a NonIncreasingTimestampError is raised when trying to load
          a frame that has a timestamp lower or equal to the timestamps of
          previous frames in the same video.
class_docstr_tok: ["Implementation","of","a","video","dataset",".","The","VideoDataset","allows","random","reads","from","a","video","file","without","extracting","all","frames","beforehand",".","This","is","more","storage","efficient","but","is","slower",".","Attributes",":","root",":","Root","directory","path",".","extensions",":","Tuple","of","allowed","extensions",".","transform",":","Function","that","takes","a","PIL","image","and","returns","transformed","version","target_transform",":","As","transform","but","for","targets","is_valid_file",":","Used","to","check","corrupt","files","exception_on_non_increasing_timestamp",":","If","True",",","a","NonIncreasingTimestampError","is","raised","when","trying","to","load","a","frame","that","has","a","timestamp","lower","or","equal","to","the","timestamps","of","previous","frames","in","the","same","video","."]
docstr: Returns the number of frames in the video with the given index.
docstr_tok: ["Returns","the","number","of","frames","in","the","video","with","the","given","index","."]
code: def _video_frame_count(self, video_index: int) -> int:
      """Returns the number of frames in the video with the given index."""
      if video_index < len(self.offsets) - 1:
          n_frames = (
              self.offsets[video_index + 1] - self.offsets[video_index]
          )
      else:
          n_frames = len(self) - self.offsets[video_index]
      return n_frames
  
imports: import os
  import threading
  import warnings
  import weakref
  from fractions import Fraction
  from typing import Any, Dict, List, Tuple
  import numpy
  import torch
  import torchvision
  from PIL import Image
  from torch.utils.data import DataLoader, Dataset
  from torchvision import datasets, io
  from tqdm import tqdm
label_desc: Use image node_id 6 for calling the VideoDataset obj's underlying member method code with example usage: obj._video_frame_count(video_index) and returns: n_frames