class_docstr: Base AudioVideo Reader
  
  Args:
      opts: command line arguments
      is_training: Training or validation mode. Default: `False`.
class_docstr_tok: ["Base","AudioVideo","Reader","Args",":","opts",":","command","line","arguments","is_training",":","Training","or","validation","mode",".","Default",":","`","False","`","."]
code: def num_frames(self, filename: str) -> int:
      if filename in self.num_frames_cache:
          return self.num_frames_cache[filename]
      else:
          with av.open(filename) as container:
              total_frames = container.streams.video[0].frames
          self.num_frames_cache[filename] = total_frames
          return total_frames
  
imports: import argparse
  import random
  from typing import Dict, Optional, Tuple
  import av
  import numpy
  import torch
  import torch.nn.functional
  from torch import Tensor
  from data.transforms import BaseTransformation
  from data.transforms import image_pil
  from data.transforms.common import Compose
  from options.utils import extend_selected_args_with_prefix, extract_opts_with_prefix_replacement
  from utils import logger
label_desc: Use image node_id 7 for calling the BaseAVReader obj's underlying member method code with example usage: obj.num_frames(filename) and returns: self, total_frames