code: def get_datasample_from_video(rel_path, full_path=None, dataset=None):
      if full_path is None:
          if dataset is not None:
              full_path = os.path.join(dataset.data_root_path, rel_path)
          else:
              raise ValueError(
                  "Both full path and dataset cannot be empty"
              )
      vid_reader = VideoFrameReader(full_path)
  
      sample = DataSample(rel_path)
  
      fps = vid_reader.fps
      num_frames = len(vid_reader)
      duration = vid_reader.duration
      frame = vid_reader.read()
      if frame is None:
          return None
      width = frame.width
      height = frame.height
  
      metadata = {
          FieldNames.DATA_PATH: rel_path,
          FieldNames.FPS: fps,
          FieldNames.DURATION: duration,
          FieldNames.NUM_FRAMES: num_frames,
          FieldNames.RESOLUTION: {"width": width, "height": height},
      }
      sample.metadata = metadata
  
      return sample
  
imports: import glob
  import numpy
  import os
  import re
  import tempfile
  from addict import Dict
  from collections import defaultdict
  from pathlib import Path
  from subprocess import call
  import cv2
  from ..dataset import GluonCVMotionDataset, DataSample, FieldNames, get_resized_video_location
  from ..io.video_io import VideoFrameReader, VideoSortedFolderReader, cmd_with_addn_args, FFMPEG_FOURCC
label_desc: Use image node_id 4 for calling a global function with example usage: get_datasample_from_video(rel_path, full_path, dataset) and returns: sample, None