code: def main(
      anno_path: str = "./annotation/anno.json",
      new_name=None,
      chunk_mins=5,
      chunks_per_vid=1,
      chunk_func=even_chunk,
      link_unchanged=True,
      cache_name=None,
      input_cache=None,
      name_suffix="",
      fps=None,
      split=None,
      new_split=None,
      overwrite=False,
      part=0,
      parts=1,
  ):
      fps_suffix = "_{}r".format(fps) if fps is not None else ""
      if name_suffix:
          name_suffix = "_" + name_suffix
      if new_name is None:
          new_name = "anno_chunks_{}m_{}p{}{}.json".format(
              chunk_mins, chunks_per_vid, fps_suffix, name_suffix
          )
      if cache_name is None:
          cache_name = "vids_chunked/vid_chunks_{}m_{}p{}{}".format(
              chunk_mins, chunks_per_vid, fps_suffix, name_suffix
          )
  
      dataset = GluonCVMotionDataset(anno_path)
      new_dataset = GluonCVMotionDataset(
          new_name,
          dataset.root_path,
          split_file=new_split,
          load_anno=False,
      )
  
      chunk_cache_dir = Path(dataset.cache_root_path, cache_name)
      chunk_data_link = Path(dataset.data_root_path, cache_name)
      os.makedirs(chunk_cache_dir, exist_ok=True)
      os.makedirs(chunk_data_link.parent, exist_ok=True)
      try:
          os.symlink(chunk_cache_dir, chunk_data_link)
      except OSError:
          pass  # already exists
  
      new_sample_times = {}
      samples = dataset.get_split_samples(split)
      samples = samples[part::parts]
      for sample_id, sample in tqdm.tqdm(samples, mininterval=1):
          time_pairs = ratio_chunk(sample, [0.5, 0.5])
          time_pairs = align_times_to_framerate(time_pairs, sample.fps)
          out_suffix = ".mp4"
          if input_cache is not None:
              input_path = sample.get_cache_file(
                  input_cache, out_suffix
              )
          else:
              input_path = sample.data_path
          output_path = chunk_data_link / sample.data_relative_path
          is_frame_dir = Path(input_path).is_dir()
          if not is_frame_dir:
              output_path = output_path.with_suffix(out_suffix)
  
          for start_time, end_time in time_pairs:
              if (
                  link_unchanged
                  and len(time_pairs) == 1
                  and start_time == 0
                  and abs(sample.frame_reader.duration - end_time) < 50
                  and (fps is None or sample.frame_reader.fps == fps)
              ):
                  if not output_path.exists():
                      os.makedirs(output_path.parent, exist_ok=True)
                      os.symlink(input_path, output_path)
                  cropped = False
                  full_output_path = output_path
              else:
                  if is_frame_dir:
                      # fps for folder frame reader, not output fps
                      addn_args = dict(
                          crop_fn=crop_fn_frame_folder,
                          in_fps=sample.fps,
                      )
                  else:
                      # output fps
                      addn_args = dict(crop_fn=crop_fn_ffmpeg, fps=fps)
                  cropped, full_output_path = crop_video(
                      input_path,
                      str(output_path),
                      start_time,
                      end_time,
                      overwrite=overwrite,
                      add_output_ts=True,
                      make_dirs=True,
                      **addn_args,
                  )
              new_data_path = Path(full_output_path).relative_to(
                  dataset.data_root_path
              )
              new_id = f"{sample_id}_{start_time}-{end_time}"
              new_sample = sample.get_copy_without_entities(
                  new_id=new_id
              )
              new_sample.data_relative_path = new_data_path
              fr = new_sample.frame_reader
              new_sample.metadata[
                  FieldNames.NUM_FRAMES
              ] = fr.num_frames()
              new_sample.metadata[FieldNames.DURATION] = fr.duration
              new_sample.metadata[FieldNames.ORIG_ID] = sample_id
              update_anno(sample, new_sample, (start_time, end_time))
              if cropped:
                  _log.info("Done crop for {}".format(new_data_path))
              new_dataset.add_sample(new_sample)
              new_sample_times[new_sample.id] = (start_time, end_time)
  
      if parts == 1:
          add_orig_samples(new_dataset, dataset)
          new_dataset.dump()
  
      return True, new_dataset
  
file_path: gluon-cv/gluoncv/torch/data/gluoncv_motion_dataset/ingestion/video_chunker.py
imports: import logging
  import os
  import pickle
  import tqdm
  from pathlib import Path
  from ..dataset import GluonCVMotionDataset, DataSample, FieldNames, SplitNames
  from ..utils.ingestion_utils import crop_video, process_dataset_splits, crop_fn_ffmpeg, crop_fn_frame_folder
label_desc: Use image node_id 7 for calling a global function with example usage: main(anno_path, new_name, chunk_mins, chunks_per_vid, chunk_func, link_unchanged, cache_name, input_cache, name_suffix, fps, split, new_split, overwrite, part, parts) and returns: True,  new_dataset