Image to movie

DVD players usually cannot handle images, only video, so if you want to create a movie DVD with JPEG images, then these JPEG images need to be converted to short videos. In fact, the menu's you often see on DVD's are actually videos too. You might have a bunch of JPEG files, so here is a script to convert them all:

#!/bin/sh

for FILE in *.jpg
do
   convert $FILE -resize 720x576 ppm:- | \
      ppmtoy4m -n50 -F25:1 -A59:54 -I p -r -S 420mpeg2 | \
      mpeg2enc -n p -f8 -b3200 -a2 -o `basename $FILE .jpg`.m2v
done

The tools used are "convert" from the ImageMagick package, and "ppmtoy4m" and "mpeg2enc" from the mjpegtools package.

First the input image is scaled to PAL standards and converted to PPM format. Then it is converted to an YUVMPEG movie of 2 seconds (50 frames, -n option). Finally this movie is encoded to a DVD compatible MPEG2 stream.

If you are going to use the videos as input for Cinelerra, then an MJPEG is sufficient, and the command can be simplified:

#!/bin/sh

for FILE in *.jpg
do
   convert $FILE -resize 720x576 temp.ppm
   ffmpeg -loop_input -i temp.ppm -vcodec mjpeg -r 25 -t 2 `basename $FILE .jpg`.avi
   rm temp.ppm
done