vikit.common.video_tools

Overview

Function

resize_video_clip(video, short_edge_length_px)

Resizes the input video to the specified short edge length in pixels.

write_videofile(video, output_path, fps, verbose)

Saves the specified clip to a file in the default Vikit video format.

Functions

vikit.common.video_tools.resize_video_clip(video: moviepy.editor.VideoClip, short_edge_length_px: int) moviepy.editor.VideoClip

Resizes the input video to the specified short edge length in pixels.

The resized video will have a short edge of the specified target length (short_edge_length_px) and the long edge will be scaled proportionally so that the video’s aspect ratio is maintained.

Example: An input video with dimensions 1920x1080 will be resized to 1280x720 if the short_edge_length_px is set to 720.

Parameters:
  • video (-) -- The video to resize.

  • short_edge_length_px (-) -- The target length of the short edge in pixels.

Returns:

The resized video if resizing was necessary, the input video otherwise.

vikit.common.video_tools.write_videofile(video: moviepy.editor.VideoClip, output_path: str, fps: float, verbose: bool = False)

Saves the specified clip to a file in the default Vikit video format.

Parameters:
  • video (-) -- The video clip to write.

  • output_path (-) -- Path of the video file to write.

  • fps (-) -- Number of frames per second in the video file to write.

  • verbose (-) -- Whether to generate verbose logs. Defaults to False.

Attributes

vikit.common.video_tools.DEFAULT_BITRATE = '14000k'
vikit.common.video_tools.MINIMUM_RESOLUTION_THRESHOLD = 720