[Prev][Next][Index][Thread]

Re: mpeg encoder



Paul Chinn said:
> 
> Is anyone aware of an easy to use mpeg encoder?
> I've been looking around and have found various sources and programs but 
> they are all really complex- requiring split yuv files, parameter files

I haven't seen anything on the list regarding this, so I thought I would 
suggest this even though it does require YUV.

I have made movies with xfqcam (I don't know xforms, so I just hacked it so 
that "Take Picture" started writing files, and it stops when you Quit.  Works 
quite well really, my first production is a 50 frame, 168K heart stopping 
drama of me staring intently at the screen while waving my hand at the camera!

I did try that codec that requires the parameter file, but I didn't get it to 
work right, so I went back to the one I have been using with POV for years. It 
does require YUV files, but not much in the way of parameters.  My copy is 
very old, I gather from a quick look at sunsite that it is up to 1.3 now, but 
still only writes mpeg-1.  The only real downside is the amount of disk blown 
by the YUV.

Maybe the new one is harder, but this one is easy to use:

1. Get xfqcam to write all your images with sequence numbers ie.
   snapshot.0000.pgm
   snapshot.0001.pgm
   snapshot.0002.pgm
   ...
   snapshot.nnnn.pgm

Infact, mine are called exactly that, since I hard-coded the name into the 
brutal hack I did to xfqcam. I need the %04d because I renumber them when I 
convert to YUV and you have to maintain the colating sequence.  I find 
renumbering them makes it easier to delete a few frames you don't like.

2. make the Y U V files, and encode

#!/bin/sh

[ -z $1 ] && echo "Usage $0 basename" && exit
BASE=$1
COUNT=-1
for file in $BASE.*.pgm
do
   COUNT=$((COUNT + 1))
   pnmdepth 255 $file | ppmtoyuvsplit $BASE.$COUNT
done

eval `pnmfile $file | awk '{ printf( "HOR=%d; VRT=%d", $4, $6 ) }'`

PF=
[ `expr $HOR % 16` -ne 0 ] && PF=-PF

mpeg $PF -h $HOR -v $VRT -a 0 -b $COUNT $BASE. -s $BASE.mpg

rm *.Y *.U *.V



References: