Is it possible to input a video and extract images every second while simultaneously stack them horizontally or vertically with the "hstack" filter to create one jpg image?

The only way I can figure out how to do it is by extractning the still-frames with this command:

ffmpeg -i INPUT.mov -vf fps=1 -s 192x108 thumbnails%03d.jpg

And then inputting them one by one and then specifying then number of inputs like this.

ffmpeg -y -i thumbnails001.jpg -i thumbnails002.jpg -i thumbnails003.jpg... filter_complex vstack=inputs=3 output.jpg

It would be nice if it was possible to do in one more dynamic chunk from the original video or at least from one inputted Video-Sequence and not manually inserting the number of INPUTS needed to create the Stack.

1 Answer 1


You're better off using the tile filter for this:

ffmpeg -i INPUT.mov -vf fps=1,scale=192:108,tile=54x1 output.jpg

The tile argument is the size of a rectangle. So for a 54 second video, 54x1 produces a horizontal stack of 54 frames. Use 1x54 for a vertical stack.

  • Thanks a lot. Works like a charm. Is it possible to specify what frame number each second it should choose? Now for a 25fps clip it seems to choose frame 13. I would like it to choose the first frame each second.
    – Thomas
    Commented Nov 15, 2016 at 12:34
  • Replace fps=1 with select='not(mod(n,25))'
    – Gyan
    Commented Nov 15, 2016 at 13:07
  • Once again, many thanks! I needed to add it whithin "" in this filter chain. Now it works. -vf "select='not(mod(n,25))'",scale=960:540,colormatrix=bt709:bt601,tile=30x1
    – Thomas
    Commented Nov 15, 2016 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.