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 __init__(
      self,
      opts: argparse.Namespace,
      is_training: Optional[bool] = False,
      *args,
      **kwargs,
  ):
      super().__init__()
      self.fast_decoding = getattr(
          opts, "video_reader.fast_video_decoding"
      )
      frame_stack_format = getattr(
          opts, "video_reader.frame_stack_format", "sequence_first"
      )
  
      if frame_stack_format not in ["sequence_first", "channel_first"]:
          logger.error(
              "Frame stacking format should be either sequence_first or channel_first."
          )
      self.channel_first_format = frame_stack_format == "channel_first"
  
      self.frame_transforms = self.get_frame_transform(
          opts, is_training=is_training
      )
  
      self.num_frames_cache = dict()
  
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 2 to create a new BaseAVReader object from inherited base classes: object with example: obj = BaseAVReader(opts, is_training)