Create a image every XX seconds of the video [FFMPEG]

4

2

Screenshot: FilmStrip

I tried ffmpeg -i video.mkv -vf fps=1 out%d.png

But It is generating one by one images. I need all thumbnails into one image. as in screenshot above.

Usama Javed

Posted 2015-10-10T05:30:20.253

Reputation:

Answers

4

enter image description here

ffmpeg -i input -filter_complex \
"select='not(mod(n,30))',scale=120:-1,tile=layout=3x2" \
-vframes 1 -q:v 2 output.jpg
  • select one frame every 30 seconds
  • scale each frame to a smaller size (alternatively you can scale after tile)
  • tile each frame into one image. Default grid size is 6x5, so you may have to adjust that with layout depending on how many images you want to display.

The process may take some time depending on your input duration and format.

llogan

Posted 2015-10-10T05:30:20.253

Reputation: 31 929

Would fps=1 work the same as select='not(mod(n,30))'? – Damian Yerrick – 2018-07-11T15:26:33.723

@DamianYerrick You can do that instead of you want each tile to be chosen from one frame per second, but it won't work exactly the same. – llogan – 2018-07-17T22:54:32.770

0

you can use something like

ffmpeg -i video.mkv -filter:v "select=not(mod(n\,10)),setpts=N/((25)*TB)" -qscale:v 2 frame%03d.jpg
  • the select controls which frames you are grabbing (in this case one out of every 10)
  • the setps controls the framerate and depends on your source - 25 for PAL or 30000/1001 for NTSC video
  • qscale controls quality (quantizing scale) of the output frames from 2 (best) to 31 (worst)

just noticed your edit above, if that gives you the frames you want to use should be fine as a starting point

you will then need to stitch the images together into the single asset using a tool like ImageMagick

montage -background "transparent" -depth 8 -type TrueColorMatte frame??.jpg \
    -geometry 50x50 -tile 10x10 -matte -transparent "transparent" \
    -type TrueColorMatte -depth 8 allframes.jpg

Offbeatmammal

Posted 2015-10-10T05:30:20.253

Reputation: 203