thegreatjedi
thegreatjedi

Reputation: 3038

How do I convert multiple videos into one image sequence using ffmpeg?

I have two videos that I wish to convert into a single consecutive image sequence, properly numbered and labelled. They were .mkv files from different origins, converted to .mp4.

ffmpeg -i vid1.mkv -c copy vid1.mp4 && ffmpeg -i vid2.mkv -c copy vid2.mp4

This is how I wish to convert the videos into images:

Input: vid1.mp4 (10s) + vid2.mp4 (20s)

Convert to an image sequence at a rate of 5 image frames per second of video.

Output:

From vid1: img0001.png to img0050.png (10s --> 50 frames)

From vid2: img0051.png to img0151.png (20s --> 100 frames)

How can I do this? I tried the following:

ffmpeg -i vid1.mp4 -i vid2.mp4 -map v -vf fps=5 img%04d.png

but only vid1 was converted. I tried *:v to select all inputs but that syntax doesn't seem to be valid.

The above are all done on the Windows command line.

Upvotes: 1

Views: 735

Answers (1)

Gyan
Gyan

Reputation: 93329

Use the concat filter.

ffmpeg -i vid1.mp4 -i vid2.mp4 -filter_complex [0][1]concat=n=2:v=1:a=0,fps=5 img%04d.png

Upvotes: 1

Related Questions