code: def generate_resized_video(
      data_sample: DataSample,
      short_edge_res: int,
      overwrite=False,
      cache_dir=None,
      upscale=True,
      use_vis_path=True,
      force_encode=False,
      encode_kwargs=None,
      **kwargs,
  ):
      if cache_dir is None:
          resized_path = get_resized_video_location(
              data_sample, short_edge_res
          )
      else:
          resized_path = data_sample.get_cache_file(
              cache_dir, extension=".mp4"
          )
      if os.path.isfile(resized_path) and not overwrite:
          return
      os.makedirs(os.path.dirname(resized_path), exist_ok=True)
  
      orig_vid_path = (
          get_vis_video_location(data_sample)
          if use_vis_path
          else data_sample.data_path
      )
      if (
          not upscale
          and min(data_sample.width, data_sample.height)
          <= short_edge_res
      ):
          if force_encode:
              if encode_kwargs is None:
                  encode_kwargs = {
                      k: v
                      for k, v in kwargs.items()
                      if k == "addn_args"
                  }
              convert_vid_ffmpeg(
                  orig_vid_path, resized_path, **encode_kwargs
              )
          else:
              os.symlink(orig_vid_path, resized_path)
      else:
          resize_and_write_video_ffmpeg(
              orig_vid_path, resized_path, short_edge_res, **kwargs
          )
  
      return resized_path
  
file_path: gluon-cv/gluoncv/torch/data/gluoncv_motion_dataset/dataset_pre_processor.py
imports: import os
  import random
  import logging
  import ray
  from pathlib import Path
  from tqdm import tqdm
  from .io.video_io import VideoFrameReader, write_img_files_to_vid_ffmpeg, resize_and_write_video_ffmpeg, convert_vid_ffmpeg
  from .utils.serialization_utils import save_json
  from .dataset import GluonCVMotionDataset, DataSample, FieldNames, get_resized_video_location, get_vis_gt_location, get_vis_thumb_location, get_vis_video_location
label_desc: Use image node_id 1 for calling a global function with example usage: generate_resized_video(data_sample, short_edge_res, overwrite, cache_dir, upscale, use_vis_path, force_encode, encode_kwargs) and returns: resized_path