How to make high quality MPEG4 video

Steve O'Hara-Smith steve at sohara.org
Mon Sep 1 11:15:15 PDT 2003


On Mon, 1 Sep 2003 22:52:57 +0900 (JST)
sugiura at kt.rim.or.jp (Sugiura Shiro) wrote:

SS> I want to record and encode high quality video(MPEG4/DivX)
SS> 640x480 at 29.97fps from TV using bt878 chip(PVR951). I tried to use
SS> ffmpeg0.4.6, 0.4.7 and mencoder , but not so good.

	With that 2.8GHZ P4 you should be able to go direct. I can quite
easily record PAL 720x576 at 25fps in mpeg4 or mpeg1 on my AMD XP2000 in
realtime with ffmpeg alone running like this:

ffmpeg -s 768x576 -tvstd pal -vcodec mpeg4 -b 2000 -acodec mp3 -ac 2 \
  -ab 128 -f avi -t $DURATION -y $NAME.avi

	It uses about 60% CPU on average, adding -hq pushes it to
a bit over 70%. I have never noticed any effect from the deinterlace
flag so I tend not to bother with it. To my eye the result of these
settings is a little blurry so generally I use something more like this:

ffmpeg -s 768x576 -tvstd pal -vcodec mpeg1video -b 6400 -acodec mp2 \
  -ac 2 -ab 160 -f mpeg -t $DURATION -y $NAME.avi

	IME high bandwidth mpeg1 is nicer than high bandwidth mpeg4
but it reverses at low bandwidth.

SS> Step1: record rawvideo 
SS> % ffmpeg -r 29.97 -s 640x480 -ac 2 -ar 48000 -ab 256 -acodec mp3
SS> -vcodec \
SS>   rawvideo -tvstd ntsc -deinterlace raw.avi
SS> 
SS> I sometimes found "SLEPT NO signals - xxxxx microseconds late" error .

	Don't worry, it's not an error, it's a warning that there was no
frame sync detected by the time the timer expired and so you may get a
slightly messy frame in the sequence. One day I'll take these messages
out, when I'm sure I've finished fiddling with that bit (I think I have).

SS> Step2-1: mpeg4 encode by mencoder(very quick , but not so good)
SS> % mencoder raw.avi  -oac copy -ovc lavc  -ofps 29.97 lavc=2000:29.97 \
SS>   -lavcopts vcodec=mpeg4:vqscale=31:vme=5:vhq:vbitrate=2000 -o tv.mpg
_____________________________^^^^^^^^^^

	The indicated bit fixes the quality at very very low, remove it
for better results and longer processing.

SS> Step2-2: mpeg4 encode by ffmpeg(strange out put)
SS> % ffmpeg -i raw.avi -vcodec mpeg4 -r 29.97 -me full -re -b 2000
SS> -acodec \
SS>   copy -deinterlace tv.avi

	Strange how ?

-- 
C:>WIN                                      |     Directable Mirrors
The computer obeys and wins.                |A Better Way To Focus The Sun
You lose and Bill collects.                 |  licenses available - see:
                                            |   http://www.sohara.org/


More information about the freebsd-multimedia mailing list