Create a image every XX seconds of the video [FFMPEG]
6,031
Solution 1
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.
Solution 2
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 or30000/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
Related videos on Youtube
Author by
Admin
Updated on September 18, 2022Comments
-
Admin over 1 year
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.
-
Damian Yerrick almost 6 yearsWould
fps=1
work the same asselect='not(mod(n,30))'
? -
Elisa Cha Cha almost 6 years@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.
-
Admin about 2 yearshow can i generate one sprite every 5 minutes, within each sprite, one thumbnail per 10 seconds ?