code: def ratio_chunk(sample, ratios):
      """
      :param sample:
          The datasample to be chunked
      :param ratios:
          The ratios to be chunked, in order relative to the video.
          If negative it will throw away that chunk
      :return:
          See :func:`even_chunk`
      """
      if sum(abs(x) for x in ratios) > 1 + 1e-2:
          raise ValueError("Ratios add up to more than 1")
  
      duration = sample.frame_reader.duration
      time_pairs = []
      start_time = 0
      for ratio in ratios:
          end_time = start_time + (abs(ratio) * duration)
          if ratio > 0:
              time_pair = (round(start_time), round(end_time))
              time_pairs.append(time_pair)
          start_time = end_time
      return time_pairs
  
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 2 for calling a global function with example usage: ratio_chunk(sample, ratios) and returns: time_pairs