This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Graphics & Multimedia

Transform images into videos with images2mpg

By Shashank Sharma on June 04, 2008 (4:00:00 PM)

Share    Print    Comments   

images2mpg, a simple utility that's part of the KDE Image Plugin Interface (KIPI), lets you create an MPEG file from image files. Relying on a handful of command-line tools including the ImageMagick suite and mjpegtools, images2mpg creates wonderful videos from your images and even lets you insert your favorite song as the background. It supports SVCD, DVD, VCD, and XVCD video formats.

To install KIPI, Fedora and Ubuntu users can respectively use yum or apt. Before you begin experimenting with images2mpg, you will need to install ImageMagick and mjpegtools too.

The following command creates a SVCD file using three images files: images2mpg -f SVCD -d 4 -o car.mpg -i DSC00475.JPG DSC00468.JPG DSC00477.JPG. In this command, the -d command switch specifies the duration in seconds for which each image will be visible.

You can set a transition between images using the -t switch, which invokes the composite utility from ImageMagick to create the transition effect: images2mpg -f SVCD -d 4 -t 2 -o car.mpg -i DSC00475.JPG DSC00468.JPG DSC00477.JPG. The -t switch accepts a value of 1, 2, 4, 5, 10, or 20, which represents the speed of the transition between images.

The resolution for SVCD files created by images2mpg is 576x480, with 25 frames per second (fps). images2mpg uses the montage utility from the ImageMagick suite to resize the images, so you don't have to worry if all your images are of different resolutions.

If no output format is specified, images2mpg creates a XVCD file of 720x576 resolution at 25fps and video bitrate of 2500Kbps. While the audio bitrate for each of the files, be it DVD, VCD, XVCD, or SVCD, is the same at 224Kbps, the video bitrate varies. The bitrate for each of the supported file formats is listed in the man page for images2mpg, along with other details such as the resolution and frame rate.

To add audio to your movie file, use the -w switch to insert a WAV file or the -a switch if it's MP2 audio. Surprisingly, while the man page for images2mpg does not state this, you need to use the -S switch to successfully create a movie file with audio. images2mpg uses the mplex utility provided by mjpegtools to merge the encoded audio stream with the video file. Without the -S switch, this step fails. So, to create a movie file with audio, use a command like images2mpg -f SVCD -S 420mpeg2 -d 2 -t 2 -w ~/Music/mytune.wav -o car.mpg -i *.jpg

You can even specify an MP3 file as the background audio when you use the -S switch. The -S switch is used to set the chroma subsampling mode. Every time you use images2mpg, it will present a detailed information sheet of all the steps involved in creating the video, along with information about the number of images used, the video format, number of frames, and other information:

$ images2mpg -f SVCD -S 420mpeg2 -w ~/Music/audio.mp3 -d 2 -t 2 -T tmp/ -o testing_temp.mpg -i DSC004* ------------------------------------------------ Number of image file(s) : 3. Processing sequence : DSC00468.JPG DSC00475.JPG DSC00477.JPG Video format : 'SVCD'. Video type : 'PAL'. WAV audio file : 'big.wav'. Frames per second : '25'. Image duration : 2 s. Total video sequence duration : 14 s . Transition frames : 50. Total frames processing : 350. Background image file : 'tmp//1211114534.black.tmp.png'. Verbosity : 'none'. ------------------------------------------------ Encoding 3 image(s) MPEG sequence with ImageMagick and MjpegTools. INFO: [yuvscaler] yuvscaler 1.9.0 (15-02-2004) is a general scaling utility for yuv frames INFO: [yuvscaler] (C) 2001-2004 Xavier Biquard <xbiquard@free.fr>, yuvscaler -h for help, or man yuvscaler ++ WARN: [mpeg2enc] Generating dummy SVCD scan-data offsets to be filled in by "vcdimager" ++ WARN: [mpeg2enc] If you're not using vcdimager you may wish to turn this off using -d Frame Num. 350 / 350 MPEG encoding terminated [350 frames - Encoding time : 279 s]. Encoding MPG layer 2 audio file from big.wav WAV file with MjpegTools. big.wav: audio/x-wav Merging MPEG flux with MjpegTools. The video MPEG output file is 'testing_temp.mpg'. Removing temporary files...

The process of creating a movie from your images may take some time, depending on how many images you are using, the transition time between each image, the duration for which each image is displayed, and so on, because all these variables determine the total number of frames in the video. The high quality of movies created with images2mpg and its ease of use make images2mpg a great command-line tool to convert still images into entertaining videos.

Shashank Sharma specializes in writing about free and open source software for new users and moderates the Linux.com forum boards. He is the coauthor of Beginning Fedora, published by Apress.

Share    Print    Comments   

Comments

on Transform images into videos with images2mpg

Note: Comments are owned by the poster. We are not responsible for their content.

also available in flash

Posted by: Tim Abell on June 04, 2008 06:36 PM
I wrote a similar howto for creating flash videos:
http://timwise.blogspot.com/2008/03/stop-motion-animation-on-linux.html

#

Transform images into videos with images2mpg

Posted by: Anonymous [ip: 189.25.157.225] on June 06, 2008 02:30 PM
Hi guys!

I have used a script called image2mpeg placed in http://www.gromeck.de/projekte/software/image2mpeg/ This is an amazing script and I could make a lots of videos with my pictures.
I will try the images2mpg too. The best in Linux or Open Source is the ability to test a lots of softwares that can do the same or improve the features of others.

[]'s,

Still

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya