Skip to main content

Module video

Module video 

Source
Expand description

Video export module for the NES emulator CLI.

This module provides video encoding capabilities for exporting emulator frame buffers to various video formats.

§Supported Formats

FormatImplementationDependencies
PNG sequencePure Rust (image crate)None - self-contained
PPM sequencePure RustNone - self-contained
MP4FFmpeg subprocessFFmpeg installed
RawWrites raw BGRA bytesNone

§Scaling

Video scaling is handled natively by FFmpeg using the nearest neighbor filter, which preserves sharp pixel edges for retro games.

Structs§

FfmpegMp4Encoder
Encoder that pipes frames to FFmpeg for MP4 encoding.
FpsConfig
Parsed FPS configuration.
PngSequenceEncoder
Encoder that outputs a sequence of PNG images.
PpmSequenceEncoder
Encoder that outputs a sequence of PPM images.
RawEncoder
Encoder that outputs raw BGRA frames.
StreamingVideoEncoder
A streaming video encoder that handles scaling via FFmpeg.

Enums§

VideoError
Video encoding error
VideoResolution
Target video resolution for output.

Constants§

NES_NTSC_FPS
NES NTSC framerate: 39375000 / 655171 ≈ 60.098814
NES_NTSC_FPS_DEN
NES_NTSC_FPS_NUM
NES NTSC framerate as exact numerator/denominator
SMOOTH_FPS
Smooth framerate target (exactly 60 fps)

Traits§

VideoEncoder
Trait for video encoders.

Functions§

create_encoder
Create a video encoder for the specified format.
create_encoder_with_scale
Create an MP4 encoder with FFmpeg native nearest-neighbor scaling.
encode_frames
Encode collected frames to video.
is_ffmpeg_available
Check if FFmpeg is available for MP4 encoding.