code: def pyav_decode(
      container,
      sampling_rate,
      num_frames,
      clip_idx,
      num_clips_uniform=10,
      target_fps=30,
      use_offset=False,
  ):
      """
      Convert the video from its original fps to the target_fps. If the video
      support selective decoding (contain decoding information in the video head),
      the perform temporal selective decoding and sample a clip from the video
      with the PyAV decoder. If the video does not support selective decoding,
      decode the entire video.
  
      Args:
          container (container): pyav container.
          sampling_rate (int): frame sampling rate (interval between two sampled
              frames.
          num_frames (int): number of frames to sample.
          clip_idx (int): if clip_idx is -1, perform random temporal sampling. If
              clip_idx is larger than -1, uniformly split the video to num_clips_uniform
              clips, and select the clip_idx-th video clip.
          num_clips_uniform (int): overall number of clips to uniformly sample from the
              given video.
          target_fps (int): the input video may has different fps, convert it to
              the target video fps before frame sampling.
      Returns:
          frames (tensor): decoded frames from the video. Return None if the no
              video stream was found.
          fps (float): the number of frames per second of the video.
          decode_all_video (bool): If True, the entire video was decoded.
      """
      # Try to fetch the decoding information from the video head. Some of the
      # videos does not support fetching the decoding information, for that case
      # it will get None duration.
      fps = float(container.streams.video[0].average_rate)
      frames_length = container.streams.video[0].frames
      duration = container.streams.video[0].duration
  
      if duration is None:
          # If failed to fetch the decoding information, decode the entire video.
          decode_all_video = True
          video_start_pts, video_end_pts = 0, math.inf
      else:
          # Perform selective decoding.
          decode_all_video = False
          clip_size = np.maximum(
              1.0,
              np.ceil(
                  sampling_rate * (num_frames - 1) / target_fps * fps
              ),
          )
          start_idx, end_idx, fraction = get_start_end_idx(
              frames_length,
              clip_size,
              clip_idx,
              num_clips_uniform,
              use_offset=use_offset,
          )
          timebase = duration / frames_length
          video_start_pts = int(start_idx * timebase)
          video_end_pts = int(end_idx * timebase)
  
      frames = None
      # If video stream was found, fetch video frames from the video.
      if container.streams.video:
          video_frames, max_pts = pyav_decode_stream(
              container,
              video_start_pts,
              video_end_pts,
              container.streams.video[0],
              {"video": 0},
          )
          container.close()
  
          frames = [
              frame.to_rgb().to_ndarray() for frame in video_frames
          ]
          frames = torch.as_tensor(np.stack(frames))
      return frames, fps, decode_all_video
  
file_path: SlowFast/slowfast/datasets/decoder.py
imports: import logging
  import math
  import numpy
  import random
  import torch
  import torchvision.io
  from .None import transform
label_desc: Use image node_id 6 for calling a global function with example usage: pyav_decode(container, sampling_rate, num_frames, clip_idx, num_clips_uniform, target_fps, use_offset) and returns: frames,  fps,  decode_all_video