brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ffmpeg -vf fps=1/60 saves one picture for every minute of a video

Ffmpeg
~/tips/tip-ffmpeg-fps-thumbnails

ffmpeg -i recording.mp4 -vf fps=1/60 thumbs/thumb-%03d.jpg

Turns a video into a series of still images at a fixed interval, for previews or contact sheets.

Grabbing one frame is easy. When you want a picture every minute to see what’s in a long recording, the fps filter does it in one go.

mkdir -p thumbs
ffmpeg -i recording.mp4 -vf fps=1/60 thumbs/thumb-%03d.jpg

fps=1/60 means one frame per 60 seconds. fps=1 gives one a second and fps=1/10 one every ten seconds. The %03d in the name becomes a counter with three digits, so the files sort in the right order: thumb-001.jpg, thumb-002.jpg and so on.

Two practical additions. JPEG quality can be set with -q:v 2 (lower is better, and I think 2 to 5 is fine), and you can add a scale step in the same filter chain to get small previews right away: -vf fps=1/60,scale=320:-2.

Be aware that ffmpeg still decodes the whole video, even if it keeps only a few frames. For a two-hour film that takes a while. If you need a handful of pictures from known points, running a fast -ss seek per picture is quicker than letting fps go through every frame.

Further reading: FFmpeg filters documentation, ffmpeg documentation

More Ffmpeg tips ffmpeg -stream_loop 2 -i in.mp4 -c copy out.mp4 ffmpeg -i in.mp4 \ ffmpeg -i video.mp4 -i video.en.srt -map 0 -map 1 -c copy -c:s mov_text -metadata:s:s:0 language=eng video-subs.mp4 ffmpeg -i film.mkv -map 0:v -map 0:a:0 -c:v copy -c:a aac -b:a 192k -ac 2 film-stereo.mkv ffmpeg -i talk.mp4 -vn -c:a copy talk.m4a All Ffmpeg tips (38) All topics

Link