Encoding from multiple input image files

Since encode2mpeg 0.5.5 there is support for encoding from multiple image files. The following MEncoder syntax is supported:
The input images will be scaled and expanded as needed in order to fit the selected profile. The same amount of scaling and expansion will be used for all the images. This will produce incorrect results if the images have different resolutions or they are of different formats (JPEG, PNG, TGA, SGI). However it is possible to avoid this limitation of MEncoder: see below. Every picture will display for 1 second in the encoded video. You can use the option -slidefps to change the duration. Example:
encode2mpeg -o VIDEO -mpeg -encode 4:1:1 -mpegonly -n p -svcd mf://photo_0095.jpg,photo_0096.jpg -slidefps 4 -mpegfixaspect
will make a PAL SVCD mpeg displaying every picture for four seconds. The option -mpegfixaspect is necessary if the pictures do not have 4/3 aspect ratio. A simpler command line very similar to the previous one would be:
encode2mpeg -o VIDEO -mpegonly -n p -stdvid 6 mf://photo_009[56].jpg -slidefps 4


Let us consider now the following situation: you have a directory full of pictures taken with your camera. The directory contains also some short videos and some audio clips because your camera let you take them too. The pictures have different resolutions, some of them have landscape orientation, some need to be rotated clockwise, some others need to be rotated counterclockwise. One video needs to be rotated too. The audio clips have been recorded when the corresponding picture have been taken and you would like to hear that audio when the image is shown and you want to make a DVD with many but not all the pictures/videos contained in the directory. It sounds a difficult task, but it is quite easy to do it using encode2mpeg together with the option -video. Example:
encode2mpeg <common options> -video mf://p8191.jpg,p8192.jpg -video p8193.mov -video mf://p819[5-7].jpg -rotate 2 -video p8263.mov -rotate 1 -video mf://p5927.jpg -slideaudio p5927.wav
The problem with the previous example is that it is quite tedious to construct the command line with all the -video options. It is however possible to avoid the issue. In the TOOLS directory of encode2mpeg distribution, there is a program called mfcmdline. With its help you can easily build the command line necessary for encode2mpeg. Run the command like this:
mfcmdline <files>
The program will parse all the input files: for every input file, if the file is a picture, it will display it at lower resolution for one second; if it is a movie or a sound it will play it with MPlayer (press q in order to stop MPlayer). After that it will wait for user input:
After processing all the input files or if you press the End key, the program will exit and will print the command line options for encode2mpeg. Cut and Paste them. Example output:

100olymp/p3270910.mov ok
100olymp/p3270911.mov skip
100olymp/p3270915.jpg ok
100olymp/p3270922.jpg rotate 2
100olymp/p3270923.jpg rotate 2
100olymp/p3270924.jpg ok
100olymp/p3270925.jpg rotate 1
100olymp/p3270926.jpg rotate 1
100olymp/p5260927.jpg ok
100olymp/p5260927.wav ok
100olymp/p5260931.jpg ok
100olymp/p5260932.jpg abort
-video '100olymp/p3270910.mov' -video 'mf://100olymp/p3270915.jpg' -video 'mf://100olymp/p3270922.jpg,100olymp/p3270923.jpg' -rotate 2 -video 'mf://100olymp/p3270924.jpg' -video 'mf://100olymp/p3270925.jpg,100olymp/p3270926.jpg' -rotate 1 -video 'mf://100olymp/p5260927.jpg' -slideaudio '100olymp/p5260927.wav' -video 'mf://100olymp/p5260931.jpg'

It is also possible to avoid "Cut and Paste". Run mfcmdline in this way:
mfcmdline <set 1 of files> | tee list1
mfcmdline <set 2 of files> | tee list2
and then encode2mpeg in this way (it is necessary to use eval because the file names are quoted):
eval encode2mpeg <common options> $(cat list1 list2) 
At present, mfcmdline is not very sophisticated. It recognise the file type only by its extension and not by its real content, and only these extensions are recognised: jpeg, jpg, png, tga, sgi, avi, mpeg, mpg, mov, wav, mp2 and mp3. If this is not enough, please write your needs to the mailing list.


There could be problems when you try to encode from images with portrait orientation. If the images are jpeg, it may help to use the option -vc ijpg . If it does not help, try to convert first the pictures to PNG or, even better, to TGA, then use encode2mpeg.