Skip to main content

generate_poster

Function generate_poster 

Source
pub fn generate_poster(
    video_path: &Path,
) -> Result<Option<PathBuf>, EncodeError>
Expand description

Generate an AVIF poster image next to the encoded video. Spawns a one-shot gst-launch-1.0 pipeline that extracts a single frame from video_path, scales it to ≤640 px wide, and writes it to <video_path-without-ext>.avif.

Returns Ok(Some(path)) on success, Ok(None) when the avifenc GStreamer element isn’t installed (silent skip with a tracing::warn — poster is a free side-benefit, not a hard requirement). Returns Err on any other failure (e.g. video file missing).

§Errors

Returns EncodeError::Spawn if gst-launch-1.0 isn’t on PATH, or EncodeError::PipelineFailed if the spawn ran but exited non-zero for a reason other than “missing avifenc.”