code: def _transform_videos(
      sample_collection,
      frames=None,
      fps=None,
      min_fps=None,
      max_fps=None,
      size=None,
      min_size=None,
      max_size=None,
      sample_frames=False,
      frames_patt=None,
      original_frame_numbers=True,
      reencode=False,
      force_reencode=False,
      media_field="filepath",
      output_field=None,
      output_dir=None,
      rel_dir=None,
      save_filepaths=False,
      update_filepaths=True,
      delete_originals=False,
      skip_failures=False,
      verbose=False,
      **kwargs,
  ):
      if output_field is None:
          output_field = media_field
  
      diff_field = output_field != media_field
  
      if sample_frames:
          reencode = True
          if frames_patt is None:
              frames_patt = (
                  fo.config.default_sequence_idx
                  + fo.config.default_image_ext
              )
  
      view = sample_collection.select_fields(media_field)
  
      if frames is None:
          frames = itertools.repeat(None)
  
      with fou.ProgressBar(total=len(view)) as pb:
          for sample, _frames in pb(zip(view, frames)):
              inpath = sample[media_field]
  
              _outpath = _get_outpath(
                  inpath, output_dir=output_dir, rel_dir=rel_dir
              )
  
              if sample_frames:
                  outpath = os.path.join(
                      os.path.splitext(_outpath)[0], frames_patt
                  )
  
                  # If sampling was not forced and the first frame exists, assume
                  # that all frames exist
                  fn = _frames[0] if _frames else 1
                  if not force_reencode and os.path.isfile(
                      outpath % fn
                  ):
                      continue
              elif reencode:
                  root, ext = os.path.splitext(_outpath)
                  if ext.lower() != ".mp4":
                      outpath = root + ".mp4"
                  else:
                      outpath = _outpath
              else:
                  outpath = _outpath
  
              _transform_video(
                  inpath,
                  outpath,
                  frames=_frames,
                  fps=fps,
                  min_fps=min_fps,
                  max_fps=max_fps,
                  size=size,
                  min_size=min_size,
                  max_size=max_size,
                  original_frame_numbers=original_frame_numbers,
                  reencode=reencode,
                  force_reencode=force_reencode,
                  delete_original=delete_originals,
                  skip_failures=skip_failures,
                  verbose=verbose,
                  **kwargs,
              )
  
              if save_filepaths and sample_frames:
                  if _frames is None:
                      try:
                          if sample.metadata is None:
                              sample.compute_metadata()
  
                          _frames = range(
                              1, sample.metadata.total_frame_count + 1
                          )
                      except BaseException as e:
                          if not skip_failures:
                              raise
  
                          _frames = []
                          logger.warning(e)
  
                  for fn in _frames:
                      frame_path = outpath % fn
                      if os.path.isfile(frame_path):
                          sample.frames[fn][output_field] = frame_path
  
                  sample.save()
  
              if (
                  update_filepaths
                  and not sample_frames
                  and (diff_field or outpath != inpath)
              ):
                  sample[output_field] = outpath
                  sample.save()
  
imports: import itertools
  import json
  import logging
  import os
  import eta.core.frameutils
  import eta.core.image
  import eta.core.numutils
  import eta.core.utils
  import eta.core.video
  import fiftyone
  import fiftyone.core.metadata
  import fiftyone.core.storage
  import fiftyone.core.utils
  import fiftyone.core.validation
label_desc: Use image node_id 11 for calling a global function with example usage: _transform_videos(sample_collection, frames, fps, min_fps, max_fps, size, min_size, max_size, sample_frames, frames_patt, original_frame_numbers, reencode, force_reencode, media_field, output_field, output_dir, rel_dir, save_filepaths, update_filepaths, delete_originals, skip_failures, verbose) without return types