code: def overlay_onto_screenshot(
      video_path: str,
      output_path: Optional[str] = None,
      template_filepath: str = utils.TEMPLATE_PATH,
      template_bboxes_filepath: str = utils.BBOXES_PATH,
      max_image_size_pixels: Optional[int] = None,
      crop_src_to_fit: bool = False,
      metadata: Optional[List[Dict[str, Any]]] = None,
  ) -> str:
      """
      Overlays the video onto a screenshot template so it looks like it was
      screen-recorded on Instagram
  
      @param video_path: the path to the video to be augmented
  
      @param output_path: the path in which the resulting video will be stored.
          If not passed in, the original video file will be overwritten
  
      @param template_filepath: iopath uri to the screenshot template
  
      @param template_bboxes_filepath: iopath uri to the file containing the bounding
          box for each template
  
      @param max_image_size_pixels: if provided, the template image and/or src video
          will be scaled down to avoid an output image with an area greater than this
          size (in pixels)
  
      @param crop_src_to_fit: if True, the src image will be cropped if necessary to
          fit into the template image. If False, the src image will instead be resized
          if necessary
  
      @param metadata: if set to be a list, metadata about the function execution
          including its name, the source & dest duration, fps, etc. will be appended
          to the inputted list. If set to None, no metadata will be appended or returned
  
      @returns: the path to the augmented video
      """
      func_kwargs = helpers.get_func_kwargs(
          metadata, locals(), video_path
      )
  
      sc_func = functools.partial(
          imaugs.overlay_onto_screenshot,
          template_filepath=template_filepath,
          template_bboxes_filepath=template_bboxes_filepath,
          max_image_size_pixels=max_image_size_pixels,
          crop_src_to_fit=crop_src_to_fit,
      )
  
      vdutils.apply_to_each_frame(sc_func, video_path, output_path)
  
      if metadata is not None:
          helpers.get_metadata(
              metadata=metadata,
              function_name="overlay_onto_screenshot",
              **func_kwargs,
          )
  
      return output_path or video_path
  
imports: import functools
  import math
  import os
  import shutil
  import tempfile
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  from augly import audio, image, utils
  from augly.audio import utils
  from augly.video import helpers, utils
  from augly.video.augmenters import cv2, ffmpeg
label_desc: Use image node_id 28 for calling a global function with example usage: overlay_onto_screenshot(video_path, output_path, template_filepath, template_bboxes_filepath, max_image_size_pixels, crop_src_to_fit, metadata) and returns: unknown