5

I am making video from images in FFmpeg. I want to know if I can make video from images placed in different folders. Like first image is placed in folder1 and other in folder2 can I use both images in folder1 and folder2 to make a single video having both images in any order. Just want to know can I use images from two different folders to make a single video. if yes. Than how can i do that?

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
Ali faizan
  • 93
  • 2
  • 2
  • 6
  • Read your question, do you really thing that someone can understand what you are doing and what you expect as a resulting video... Does folder name follow a logic(show a kind of tree to explain) and what kind of video do you want ... all the image of folder1, and after all the image of folder2, etc... ? – alexbuisson Aug 17 '13 at 06:41
  • @alexbuisson did you get it now??? – Ali faizan Aug 17 '13 at 07:08

1 Answers1

9

Yes it's possible, you can specify several input on the command (-i) but the more easy in your case as the order doesn't count, is to use the 'concat' ' filter

https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join,%20merge)%20media%20files

it will create a video with all images of folder1 and after all folder2, etc... The concat filter come with 2 methods:

ffmpeg -i concat:file1|file2 etc ....

and

ffmpeg -f concat -i list etc...

for image sequence it look like only the 2nd method work. so first create a file to describe your content (run touch file and edit it with nano file) and use the following syntax to specify where your file are and which is their naming syntax:

file './folder1/im%03d.jpg'
file './folder2/im%03d.jpg'

save the file (under nano it will be with CTRL+X) and now run the following command:

ffmpeg -f concat -i list out.mp4

ffmpeg will use your file as input and push sequentially all your image in the encoding process

alexbuisson
  • 7,699
  • 3
  • 31
  • 44
  • cancat runs on linux. Is there a solution for this for windows command prompt as I am using windows. – Ali faizan Aug 17 '13 at 07:43
  • 1
    hum, the "concat" demuxer is part of ffmpeg, so if you use the same ffmpeg version on Linux & windows it MUST work .... and if talked about the "cat" command it also exist under windows if you setup some additional package like Cygwin ! – alexbuisson Aug 17 '13 at 10:22
  • I have tried the concat command in linux but it is giving an error "At least one output file must be specified". My command is: ffmpeg -r 1 -f image2 -i concat:/home/phedra/imgs/image/img%03d.png'|'/home/phedra/imgs/images/img%03d.png -i /home/phedra/imgs/image/audio.mp3 -acodec copy -r 20 /home/phedra/imgs/video/video4.mpg – Ali faizan Aug 20 '13 at 05:08
  • After some test I agree the 1st concat method file but the 2nd method using a file to list the content work (tested on ubuntu/ffmpeg 2.0.1)! See my edit – alexbuisson Aug 20 '13 at 06:07
  • Added more details, on how create the file but basically it's just a text file to describe where your sequence are and their respective naming convention (im000.jpg, im001.jpg are name using the im%03d.jpg format) – alexbuisson Aug 20 '13 at 07:29
  • Note that this method is fully describe in the link i mentionned ! – alexbuisson Aug 20 '13 at 07:30