Skip to main content

Module ffmpeg

Module ffmpeg 

Source
Expand description

Video encoding via ffmpeg subprocess (matches Playwright’s approach).

Spawns ffmpeg CLI and pipes JPEG frames to stdin. No compile-time ffmpeg/libav dependency – the binary just needs ffmpeg on PATH at runtime when --video is used.

Codec selection matches Playwright: VP8/WebM by default, fallback to libx264/MP4 if VP8 is unavailable.

Functions§

encode_frames
Batch encode: pipe all frames at once (for deferred/buffered recording).
encode_stream
Channel-driven encoding: pipe JPEG frames to ffmpeg subprocess as they arrive. Runs on a blocking thread concurrently with the test.
video_content_type
Return the correct MIME type based on available encoder.
video_extension
Return the correct file extension based on available encoder.