mini_arcade_core.runtime.capture.video_encoder

Video encoding utilities.

Classes

EncodeResult

Result of an encoding operation.

Functions

encode_png_sequence_to_mp4(→ EncodeResult)

Encodes frames_dir/frame_%08d.png into output_path (mp4).

Module Contents

class mini_arcade_core.runtime.capture.video_encoder.EncodeResult

Result of an encoding operation.

Variables:
  • (bool) (ok) – Whether the encoding was successful.

  • None) (error (str |) – Path to the encoded video file if successful.

  • None) – Error message if the encoding failed.

ok: bool
output_path: pathlib.Path | None = None
error: str | None = None
mini_arcade_core.runtime.capture.video_encoder.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.

Parameters:
  • ffmpeg_path (str) – Path to the ffmpeg executable.

  • frames_dir (Path) – Directory containing the PNG frames to encode.

  • output_path (Path) – Destination path for the encoded video file.

  • input_fps (int) – Frames per second of the input PNG sequence.

  • output_fps (int | None) – Frames per second for the output video file.

  • video_interpolate (bool) – Whether to use motion interpolation for output fps.

  • pattern (str) – Filename pattern for input frames.

  • codec (str) – Video codec to use for encoding.

  • crf (int) – Constant Rate Factor for video quality.

  • preset (str) – Preset for video encoding speed/quality tradeoff.

Returns:

Result of the encoding operation.

Return type:

EncodeResult