MEncoder is capable of creating movies from one or more JPEG, PNG or TGA files. With simple framecopy it can create MJPEG (Motion JPEG), MPNG (Motion PNG) or MTGA (Motion TGA) files.
Explanation of the process:- MEncoder decodes the input image(s) with
libjpeg
(when decoding PNGs, it will use libpng). - MEncoder then feeds the decoded image to the chosen video compressor (DivX4, XviD, ffmpeg msmpeg4, etc...).
Examples
The explanation of the -mf
option can be found below in the man page.
Creating a DivX4 file from all the JPEG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi \*.jpg
Creating a DivX4 file from some JPEG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi frame001.jpg,frame002.jpg
Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25 -ovc copy -o output.avi \*.jpg
Creating an uncompressed file from all the PNG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25:type=png -ovc rawrgb -o output.avi \*.png
Note: Width must be integer multiple of 4, it's a limitation of the RAW RGB AVI format.
Creating a Motion PNG (MPNG) file from all the PNG files in the current dir:
mencoder -mf on:w=800:h=600:fps=25:type=png -ovc copy -o output.avi \*.png
Creating a Motion TGA (MTGA) file from all the TGA files in the current dir:
mencoder -mf on:w=800:h=600:fps=25:type=tga -ovc copy -o output.avi \*.tga
reference: http://web.njit.edu/all_topics/Prog_Lang_Docs/html/mplayer/encoding.html
Examples. The explanation of the -mf option is in the man page.
Creating an MPEG-4 file from all the JPEG files in the current directory:
mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc \
-lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -ooutput.avi
Creating an MPEG-4 file from some JPEG files in the current directory:
mencoder mf://frame001.jpg,frame002.jpg
-mf w=800:h=600:fps=25:type=jpg \
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -ooutput.avi
Creating an MPEG-4 file from explicit list of JPEG files (list.txt in current directory contains the list of files to use as source, one per line):
mencoder mf://@list.txt
-mf w=800:h=600:fps=25:type=jpg \
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -ooutput.avi
You can mix different types of images, regardless of the method you use — individual filenames, wildcard or file with list — provided of course they have the same dimensions. So you can e.g. take title frame from PNG file, and then put a slideshow of your JPEG photos.
Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current directory:
mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc copy -oac copy -ooutput.avi
Creating an uncompressed file from all the PNG files in the current directory:
mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc raw -oac copy -ooutput.avi
Note
Width must be integer multiple of 4, it is a limitation of the RAW RGB AVI format.
Creating a Motion PNG (MPNG) file from all the PNG files in the current directory:
mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o output.avi
Creating a Motion TGA (MTGA) file from all the TGA files in the current directory:
mencoder mf://*.tga -mf w=800:h=600:fps=25:type=tga -ovc copy -oac copy -o output.avi
reference: http://www9.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html
My example convert png to xvid
mencoder mf://*.png -mf w=800:h=600:fps=12:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -o output.avi