Linux tip, Fedora tip / howto: convert multiple images to a movie file

 
back to notes and tips index

Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.

convert multiple images to a movie file

You can use mencoder for this, the powerful video converter that comes with mplayer.

  • Make sure your image files are properly numbered, for example:
    frame0001.png
    frame0002.png
    frame0003.png
    ...
    frame0600.png
    JPEG and TARGA files are also supported
  • Converting these 600 frames into a movie at 30 frames/second would result in a 20 second video. Put your accompanying audio (if you have it) in a 20 second .wav file, called audio.wav (for example)
  • Now run:
    mencoder "mf://*.png" -mf fps=30 -ovc lavc -lavcopts vhq:vbitrate=1500 -audiofile audio.wav -oac mp3lame -lameopts preset=medium -o mymovie.avi
  • An explanation of some of the options:
    -mf fps=30: set the frame rate to 30 frames/second
    vbitrate=1500: set the average bitrate to use for video encoding. The optimal value for your video depends a lot on the frame size. For small frames, say 320x240, you can try lower values, e.g. 750
    -oac mp3lame: compress the audio to the MP3 format
    -lameopts preset=medium: a relatively high quality preset that does variable bitrate encoding at 150-180 kbps


← back to notes and tips index
Please do not copy the text of this tip (© Patrick Min) to your web site.