Skip to main content

Module utils

Module utils 

Source

Functions§

background_filter
The ffmpeg filters that paint color behind the (transparent) frames, so the result is fully opaque. Labels are local to this snippet, so it can be placed anywhere in a -vf chain or -filter_complex graph.
count_pngs_in_zip
Count PNG files inside a ZIP archive
extract_frame_from_zip
Extract a specific PNG frame from a ZIP archive
ffmpeg_base_args
Arguments every ffmpeg call starts with: no banner, and only warnings unless verbose_ffmpeg is set.
open_output
Open the rendered output in the default system viewer
run_ffmpeg_for_output
Like run_ffmpeg_with_output, but removes a half-written output file if ffmpeg fails.
run_ffmpeg_with_input
Like run_ffmpeg_with_progress, but feeds input to ffmpeg’s stdin (for an -i pipe:0 input, e.g. a PNG stream). The copy runs on its own thread, so a slow producer and ffmpeg can’t block each other. If reading input fails, the render fails too and the half-written output is removed.
run_ffmpeg_with_output
Run ffmpeg and return its stderr. On failure the error includes the last lines ffmpeg printed, which usually say what went wrong.
run_ffmpeg_with_progress
Run ffmpeg, calling on_frame with the number of frames written so far (from ffmpeg’s -progress output, about twice a second, and once at the end).
scan_ffmpeg_stderr
unzip_frames
Extracts frame_*.png from a ZIP into a temporary folder and returns the folder path along with the temp directory guard.