code: def vid_source(
      batch_size, num_batches, num_frames, width, height, seq_layout
  ):
      pipe = vid_pipeline(
          num_threads=4,
          batch_size=batch_size,
          num_frames=num_frames,
          width=width,
          height=height,
          device_id=0,
          seq_layout=seq_layout,
          prefetch_queue_depth=1,
      )
      pipe.build()
      batches = []
      for _ in range(num_batches):
          (pipe_out,) = pipe.run()
          batches.append(as_batch(pipe_out))
      return batches
  
imports: import os
  import random
  import numpy
  from typing import List, Union, Callable, Optional
  from dataclasses import dataclass, field
  from nvidia.dali import pipeline_def
  import nvidia.dali.fn
  from nvidia.dali import types
  import nvidia.dali.tensors
  from test_utils import get_dali_extra_path, check_batch
label_desc: Use image node_id 16 for calling a global function with example usage: vid_source(batch_size, num_batches, num_frames, width, height, seq_layout) and returns: batches