vikit.common.video_tools ======================== .. py:module:: vikit.common.video_tools Overview -------- .. list-table:: Function :header-rows: 0 :widths: auto :class: summarytable * - :py:obj:`resize_video_clip `\ (video, short_edge_length_px) - Resizes the input video to the specified short edge length in pixels. * - :py:obj:`write_videofile `\ (video, output_path, fps, verbose) - Saves the specified clip to a file in the default Vikit video format. .. list-table:: Attributes :header-rows: 0 :widths: auto :class: summarytable * - :py:obj:`DEFAULT_BITRATE ` - \- * - :py:obj:`MINIMUM_RESOLUTION_THRESHOLD ` - \- Functions --------- .. py:function:: 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. :param - video: The video to resize. :type - video: VideoClip :param - 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. .. py:function:: 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. :param - video: The video clip to write. :type - video: VideoClip :param - output_path: Path of the video file to write. :type - output_path: str :param - fps: Number of frames per second in the video file to write. :type - fps: float :param - verbose: Whether to generate verbose logs. Defaults to False. :type - verbose: bool Attributes ---------- .. py:data:: DEFAULT_BITRATE :value: '14000k' .. py:data:: MINIMUM_RESOLUTION_THRESHOLD :value: 720