Create a movie file from single image files (png, jpegs)

In research sometimes you want to make a movie from single images, like plots from experimental data or from calculation to visualize changes or so on. In order to achieve this you can use ffmpeg. First you have to create the images and save them, where the images need to have a continuous number in the filename, e.g. img0001.png, img0002.png, …, …img5467.png. Take care that there is no image missing and that you have enough zeroes in front of the image number, so that the files are in the correct order.

After you have all the images in a folder, install ffmpeg, in Ubuntu/Debian Linux e.g.

sudo apt-get install ffmpeg

In order to make a movie (mp4 quicktime) out of the images you need to issue the following command

ffmpeg -qscale 5 -r 20 -b 9600 -i img%04d.png movie.mp4

The options are

  • -qscale 5 … define fixed video quantizer scale (VBR) where 1 is the best and 31 the worst. Since mpeg/jpeg has problems to compress line graphics it’s a good idea to set this variable close to 1. You get a big movie file, but otherwise the movie doesn’t look, well, that good.
  • -r … framerate
  • -b … video bitrate
  • -i input files, %04d says that we have four numbers in the filename where the number is filled with zeros left of it.
  • movie.mp4 is the filename, the extension says that it is a quicktime movie. You can also create a Macromedia Flash movie by using the .flv extension.

Links:

14 thoughts on “Create a movie file from single image files (png, jpegs)

  1. You rock – thanks! Instantly tried it with qscale 1, and it looked flawlessly fluid.

    Mark

  2. Hi,

    Is there a way to do the same with ONE single image (i.e. still frame) plus an audio file and obtain a video of the same duration as the audio?

    thanks
    m.

  3. Try this to convert image to video.
    ffmpeg -f image2 -i image%d.jpg output.mpg.
    To know more visit: ubuntumanual.org/posts/327/converting-videos-in-ubuntu-using-ffmpeg-the-ultimate-free-video-converter

  4. Thanks, the quality of the video is excellent. The price to pay is the size of the video. In my case, 300Mo for 5000 images.

  5. By running the following command in the shell, FFMPEG can convert a number of different images into a video. ffmpeg -f image2 -i image%d.jpg output.mpg. It is one of the interesting tasks that can be done usin the FFMPEG. Convert videos Ubuntu :

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.