decode_frames

Function decode_frames 

Source
pub fn decode_frames(
    data_uri: &str,
    target_fps: f32,
    ffmpeg: &FfmpegPolicy,
) -> Result<(Vec<RgbImage>, f32)>
Expand description

2026-09-25: Decode every frame of a container, choosing a backend by what the bytes are.

Returns the frames and the rate they represent. GIF is decoded in-process and reports the container’s average rate, so the caller still samples it. ffmpeg samples during decode and reports target_fps, so the caller’s sampling applies only the frame-count clamps.

Dispatch is on magic bytes, not the declared MIME: an mp4 labelled video/gif or application/octet-stream still reaches ffmpeg, and a GIF labelled mp4 does not spawn a process.