Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Getting Individual Frames And Matching Thumbnails From A Video With ffmpeg

  • Look into this

    https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect

    maybe you can do the select based off frames (thought something else made that seem like it would be slower since it's an output filter instead of an input filter. something to check)

This is how to generate the initial set of thumbnails (one per frame)

Code

ffmpeg -i "input.mp4" -vf "scale=800:-2" -y "frames/%d.jpg"

Then you can access an individual frame based of the numbers with this (which is zero indexed subtract one to get the frame number your after:

Code

export INPUT=Prince-Sexy-MF-bfHsF6FKgb4.mp4 && \
export FRAME=2952&& \
ffmpeg -i "$INPUT" -vf "select=eq(n\,$FRAME-1)" -vframes 1 -y "frame-$FRAME.png"

Generate a set of numbered thumbnails for each frame in a video then use those numbers to access that frame