[MPlayer-users] mencoder options for NTSC television

D Richard Felker III dalias at aerifal.cx
Tue Jan 14 19:16:47 CET 2003


On Tue, Jan 14, 2003 at 10:20:58AM -0600, Lance Simmons wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> I've been using mencoder to record television.  There are so many
> differenct options, it's hard to be confident that I'm getting the best
> results possible.  If anyone has some general notes about how the
> different options interact with each other, and especially for how best
> to record NTSC, I'd appreciate it.
> 
> Here are some questions I have:
> 
> 1.  NTSC resolution:  one message when I use mencoder says
> 
>  Supported sizes: 48x32 => 768x480
> 
>  Does that mean that the height and width I choose have to preserve that
>  ratio?  If so, then there are fifteen possible choices:
> 
>    48,32
>    96,64
>    144,96
>    192,128
>    240,160
>    288,192
>    336,224
>    384,256
>    432,288
>    480,320
>    528,352
>    576,384
>    624,416
>    672,448
>    720,450
> 
>  Are there any other possibilities?
> 
> 2. vbitrate:  higher is better, right?  How do I decide what vbitrate to
> use?  I've been using 16000, and the results look good.  What's the
> benefit of going lower?
> 
> 3. postprocessing:  what kind of postprocessing is best?  How do I
> decide whether to crop or not?  Where in the documentation is there a
> clear description of what the various postprocessing options do?  I'm
> using lb, because the documentation suggests it, but am open to
> suggestions.
> 
> Right now, I'm using:
> 
> mencoder 
>  -tv on:driver=v4l:chanlist=us-cable:norm=NTSC:width=576:height=384
>  -ovc lavc
>  -lavcopts vcodec=mpeg4:vbitrate=16000
>  -oac mp3lame
>  -lameopts br=128
>  -vop pp=lb
>  -o test.avi
> 
> The results look good, and these options use between 80% and 90% of one
> of my two processors, which is what I'm aiming for.  But can't I do
> _better_?

Yes, you can. At such a high bitrate you're going to want to re-encode
to a smaller file later anyway, so here's what I would do:

mencoder
 -tv on:driver=v4l:chanlist=us-cable:norm=NTSC:width=640:height=480
 -ovc lavc
 -lavcopts vcodec=mpeg4:keyint=0:ildct:vqscale=2
 -vop pp=tn
 -oac pcm
 -o capture.avi

You can go to lower width if you want -- TV doesn't have much more
than 480 pixel horizontal bw anyway -- but use either 480 or 240 for
the height no matter what, IMHO. Now some explanations:

[-oac pcm] No need to waste time encoding to mp3 while you record. Do
it in a separate step later and save tons of cpu time while recording
since lame is so slow.

[keyint=0] Make every frame a keyframe. This reduces cpu time usage a
lot when encoding, and it makes it so you can seek to any frame (good
for cropping commercials later :).

[ildct] Use interlaced DCT. This will allow you to capture interlaced
material fairly well without deinterlacing it at capture time. You'll
still want to deinterlace when you reencode later on.

[vqscale=2] Use constant quality. You might even consider dropping
down to vqscale=1 if you have plenty of disk space and fast disks.

[-vop pp=tn] Optional; include it only if you get lots of noise in
your TV signal. This is a temporal noise remover and will save you
lots of disk space (and improve quality) if the source material is
noisy, but otherwise it probably does more harm than good, and it
wastes some cpu time.

Now, that's for the first (capture) pass. When you go to reencode
later to make a nice small file to keep, here's a good basic command
line:

mencoder
 capture.avi
 -ovc lavc
 -lavcopts vcodec=mpeg4:vbitrate=1500:vhq
 -vop crop=WWW:HHH,pp=lb
 -oac mp3lame
 -lameopts abr:br=128
 -o out.avi

You could also use 2pass encoding here if you want, but IMHO it's
overrated and not usually needed with lavc's excellent rate control
engine.

[crop=W:H:X:Y] Experiment or use cropdetect to find out what values
you should use. You want to FULLY eliminate the black border and any
noise/mess right at the edge of the image. It might also be nice to
cut off stupid ticker/adbar crap that some stations have. Be sure that
final values for W and H are multiples of 16!

[pp=lb] Deinterlace.

[-lameopts abr:br=128] Use average-bitrate encoding with average of
128. This should be a plenty for most TV/movie material unless you're
recording a musical or something. Quality should be much better than
128kbit cbr.

Good luck.

BTW, someone wanna put this >> encoding-tips?


Rich



More information about the MPlayer-users mailing list