code: def _transform_video(
      inpath,
      outpath,
      frames=None,
      fps=None,
      min_fps=None,
      max_fps=None,
      size=None,
      min_size=None,
      max_size=None,
      sample_frames=False,
      original_frame_numbers=True,
      reencode=False,
      force_reencode=False,
      delete_original=False,
      skip_failures=False,
      verbose=False,
      **kwargs,
  ):
      inpath = fos.normalize_path(inpath)
      outpath = fos.normalize_path(outpath)
      in_ext = os.path.splitext(inpath)[1]
      out_ext = os.path.splitext(outpath)[1]
  
      if frames is not None:
          if not original_frame_numbers:
              raise ValueError(
                  "`original_frame_numbers` must be True when `frames` to "
                  "sample are explicitly specified"
              )
  
          fps = None
          min_fps = None
          max_fps = None
  
      did_transform = False
      moves = []
  
      try:
          if (
              fps is not None
              or min_fps is not None
              or max_fps is not None
              or size is not None
              or min_size is not None
              or max_size is not None
          ):
              fps, size, _frames = _parse_parameters(
                  inpath,
                  fps,
                  min_fps,
                  max_fps,
                  size,
                  min_size,
                  max_size,
                  sample_frames,
                  original_frame_numbers,
              )
  
              if frames is None:
                  frames = _frames
  
          if reencode:
              # Use default reencoding parameters from ``eta.core.video.FFmpeg``
              kwargs["in_opts"] = None
              kwargs["out_opts"] = None
          else:
              # No reencoding parameters
              if "in_opts" not in kwargs:
                  kwargs["in_opts"] = []
  
              if "out_opts" not in kwargs:
                  kwargs["out_opts"] = []
  
          should_reencode = (
              force_reencode
              or fps is not None
              or size is not None
              or in_ext.lower() != out_ext.lower()
          )
  
          if should_reencode and inpath == outpath:
              orig_path = etau.make_unique_path(
                  inpath, suffix="-original"
              )
              etau.move_file(inpath, orig_path)
              moves.append((inpath, orig_path))
              inpath = orig_path
  
          if frames is not None:
              etav.sample_select_frames(
                  inpath,
                  frames,
                  output_patt=outpath,
                  size=size,
                  fast=True,
              )
              did_transform = True
          elif not etav.is_video_mime_type(outpath):
              with etav.FFmpeg(fps=fps, size=size, **kwargs) as ffmpeg:
                  ffmpeg.run(inpath, outpath, verbose=verbose)
  
              did_transform = True
          elif should_reencode:
              with etav.FFmpeg(fps=fps, size=size, **kwargs) as ffmpeg:
                  ffmpeg.run(inpath, outpath, verbose=verbose)
  
              did_transform = True
          elif inpath != outpath:
              etau.copy_file(inpath, outpath)
  
          if delete_original and inpath != outpath:
              etau.delete_file(inpath)
      except BaseException as e:
          try:
              # Undo any moves
              for from_path, to_path in moves:
                  etau.move_file(to_path, from_path)
          except:
              pass
  
          if not skip_failures:
              raise
  
          logger.warning(e)
  
      return did_transform
  
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 12 for calling a global function with example usage: _transform_video(inpath, outpath, frames, fps, min_fps, max_fps, size, min_size, max_size, sample_frames, original_frame_numbers, reencode, force_reencode, delete_original, skip_failures, verbose) and returns: did_transform