9

I'm using ffmpeg to create time-lapses and it's working great. As input I have images named 001.jpg, 002.jpg, etc. and then with the command

ffmpeg -i %3d.jpg -sameq -s 1440x1080 video.mp4

I create the video. But my problem comes when I want to create a video using multiple sets as input. For example, I'm in a dir where I have two folders set1 and set2, each with photos in it in the format explained previously.

I already tried doing

ffmpeg -i ./set1/%3d.jpg -i ./set2/%3d.jpg -sameq -s 1440x1080 video.mp4

but it ends up doing a video using only the first set. Is there an easy way to do this?

Thanks!

3
  • 1
    On another note, would it be possible to create two separate videos and then join them?
    – fideli
    Commented Feb 7, 2011 at 8:55
  • Yes, in theory is possible, but I want a pure joint, no a "compilation" because in the last case: I lose quality because of the generation loss and I lose time trans-coding those two videos. That link doesn't explain how to join two MPEG4 videos. Does it?
    – tomm89
    Commented Feb 7, 2011 at 9:11
  • What happens when you enter only this ffmpeg -i ./set1/%3d.jpg -i ./set2/%3d.jpg? You can try the -map to see if it helps (like ffmeg -i set1*.jpg - i set2*.jpg -map 0:0 -map 1:0 output.mp4)
    – Adriano P
    Commented Apr 24, 2015 at 16:47

2 Answers 2

1

You need to use concat module , and in this example where I set the framerate to 10 , you must use filter_complex .

ffmpeg -framerate 10 -i set1_%04d.jpg \
       -framerate 10 -i set2_%04d.jpg \
       -framerate 10 -i set3_%04d.jpg \
       -filter_complex '[0:0] [1:0] [2:0] concat=n=3:v=1:a=0 [v],[v] fps=10 [vv]' \
       -map '[vv]' -s 1440x1080 video.mp4 

Documentation on filter_complex syntax : http://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax-1

Documentation on concat filter : http://ffmpeg.org/ffmpeg-filters.html#concat

1
1

You can use bash to expand a file list like:

For a file named inputs.txt containing.

-i /path/to/input1.mp4
-i /path/to/input2.mp4

Then just as an example using a complex filtergraph.

ffmpeg `cat inputs.txt | xargs echo` \
    -filter_complex \
    "
      [0:v]trim=0:10[a];
      [1:v]trim=10:20[b]
    " \
    -map "[a]" a.mp4 \
    -map "[b]" b.mp4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .