Generating an MPG movie with mpeg_encode
The following description is for MPEG-1 software encoder
mpeg_encode
that can be downloaded as source code from its
homepage.
Creating links
Usually, too few pictures will be available to create a movie with a standard MPEG frame rate. Therefore, additional still pictures have to be inserted. Further on,
mpeg_encode
is easiest with consecutive numbered frames. The following script creates five links for each picture
f1.10.pnm,f1.20.pnm,...,f1.110.pnm
.
#! /bin/sh
NAME=f1
a=0
for i in 10 20 30 40 50 60 70 80 90 100 110
do
echo $i
ln -s -f ../$NAME.$i.pnm links/l$NAME.$a.pnm
a=`expr $a + 1`
ln -s ../$NAME.$i.pnm links/l$NAME.$a.pnm
a=`expr $a + 1`
ln -s ../$NAME.$i.pnm links/l$NAME.$a.pnm
a=`expr $a + 1`
ln -s ../$NAME.$i.pnm links/l$NAME.$a.pnm
a=`expr $a + 1`
ln -s ../$NAME.$i.pnm links/l$NAME.$a.pnm
a=`expr $a + 1`
ln -s ../$NAME.$i.pnm links/l$NAME.$a.pnm
a=`expr $a + 1`
done
Encoding
Creating a movie with the command
mpeg_encode movie_params.txt
requires a file
movie_params.txt
that could look like:
PATTERN IBBPBBPBBP
OUTPUT MovieName.mpg
BASE_FILE_FORMAT PNM
INPUT_CONVERT *
GOP_SIZE 40
SLICES_PER_FRAME 1
INPUT_DIR links
INPUT
lf1.*.pnm [0-54]
END_INPUT
PIXEL HALF
RANGE 10
PSEARCH_ALG LOGARITHMIC
BSEARCH_ALG CROSS2
IQSCALE 4
PQSCALE 6
BQSCALE 8
REFERENCE_FRAME DECODED
FORCE_ENCODE_LAST_FRAME
The
54
apparently corresponds to the last frame in
links
and needs to be individually adjusted like the
OUTPUT
file. The other parameters are set to relatively low compression but high quality, which will usually be appropriate for scientific purposes. A documentation of all parameters is available
online.
--
RalfDeiterding - 01 Feb 2005