mini_arcade_core.runtime.capture.video_encoder ============================================== .. py:module:: mini_arcade_core.runtime.capture.video_encoder .. autoapi-nested-parse:: Video encoding utilities. Classes ------- .. autoapisummary:: mini_arcade_core.runtime.capture.video_encoder.EncodeResult Functions --------- .. autoapisummary:: mini_arcade_core.runtime.capture.video_encoder.encode_png_sequence_to_mp4 Module Contents --------------- .. py:class:: EncodeResult Result of an encoding operation. :ivar ok (bool): Whether the encoding was successful. :ivar output_path (Path | None): Path to the encoded video file if successful. :ivar error (str | None): Error message if the encoding failed. .. py:attribute:: ok :type: bool .. py:attribute:: output_path :type: pathlib.Path | None :value: None .. py:attribute:: error :type: str | None :value: None .. py:function:: encode_png_sequence_to_mp4(*, ffmpeg_path: str, frames_dir: pathlib.Path, output_path: pathlib.Path, input_fps: int, output_fps: int | None = None, video_interpolate: bool = False, pattern: str = 'frame_%08d.png', codec: str = 'libx264', crf: int = 18, preset: str = 'veryfast') -> EncodeResult Encodes frames_dir/frame_%08d.png into output_path (mp4). Assumes contiguous numbering starting at 0. :param ffmpeg_path: Path to the ffmpeg executable. :type ffmpeg_path: str :param frames_dir: Directory containing the PNG frames to encode. :type frames_dir: Path :param output_path: Destination path for the encoded video file. :type output_path: Path :param input_fps: Frames per second of the input PNG sequence. :type input_fps: int :param output_fps: Frames per second for the output video file. :type output_fps: int | None :param video_interpolate: Whether to use motion interpolation for output fps. :type video_interpolate: bool :param pattern: Filename pattern for input frames. :type pattern: str :param codec: Video codec to use for encoding. :type codec: str :param crf: Constant Rate Factor for video quality. :type crf: int :param preset: Preset for video encoding speed/quality tradeoff. :type preset: str :return: Result of the encoding operation. :rtype: EncodeResult