fast transcoding of pvr-250 created files
Molnár Csaba
csabamolnar at gmail.com
Thu Sep 29 14:29:17 PDT 2005
On Thursday 29 September 2005 21.59, Mike Tancsa wrote:
> The native format is
> quite large and I want to convert the file into xvid or divx for
> later viewing, but I dont want to reduce the quality too
> much. Anyone doing anything similar, and if so what program are you
> using with what options ?
>
Use mencoder - even the FreeBSD handbook suggests that. At first it might be
overwhelming a bit (all those options) - but they make a lot of sense. I
strongly suggest to read the man page of mencoder/mplayer and the online
documentation.
When you recode, you have to decide which codec to use. You would want to use
an mpeg-4 codec. Examples: divx, xvid, ffmep. Divx sucks, don't use it. Xvid
is widely regarded as the king of mpeg-4 codecs, however, development for
more than half a year now. Regardless, divx is still playing catch-up, and
xvid is playable on almost any platforms. Another good choice is libavcodec's
ffmpeg. This has reached the quality of xvid this year, and it is actively
developed. It is also part of mplayer, so you won't need additional codecs.
Encoding option depend very much on the quality of your source material, as
well as it's properties. For instance, if you are capturing sports (I capture
tennis matches :)) you will probably need higher bitrates to preserve the
original quality. For your average tv shows, you don't need that much. The
mplayer documentation - http://mplayerhq.hu/DOCS/HTML/en/index.html - has
many examples, and this is a fairly large topic, but here is an example:
# you tell mencoder about the input file, the output video codec (-ovc)
# which is libavcodec (lavc) and its options (lavcopts)
mencoder sourcematerial.mpeg -ovc -lavc -lavcopts \
# here you tell about the codec (mpeg4), the intended bitrate, and set some
# other options (which are very well documented in mplayer's help)
# vpass=1 means that you do a two-pass encoding, which is a must if you
# want the best quality
vcodec=mpeg4:vbitrate=1900:mbd=2:v4mv:trell:cmp=3:subcmp=3:mbcmp=3:mbd=2:autoaspect:vpass=1:cbp:mv0\
# next we need to set the audio codec options:
-oac mp3lame -lameopts cbr:br=128
# then you need to crop and scale - cutting cruft or black borders, which
# seriously reduce quality. See the -vf cropdetect option in the man page,
# which helps you set the correct values - my example is pal, so yours will be
# quite different
# this is where we apply some post-processing filters, like
# pp=lb/dr, and finally scale the movie
-vf crop=720:544:0:16,pp=lb/dr,scale=512:384 -sws 2
# finally you define the output filename:
-o encodedmovie.avi
The second pass would look exactly the same, except you write vpass=1. Also,
if your source is NTSC, you'll probably need to deinterlace, define the fps,
and whatnot. Anyway, mencoder is the most powerful tool there is for
encoding, recoding and capturing - for any platform! Take a look at the
forums at www.doom9.org - almost every "professional" encoder uses mencoder,
or rather, their own MeGUI built on mplayer there.
Finally, ffmpeg is so fast (faster than xvid by ~20%, which is in turn faster
than divx - which sucks, as I said) that you can often capture directly into
mpeg-4 avis. The problem is, that you must define higher bitrates, and
because it is real-time encoding, it will be obviously one pass. But still -
here is what I do:
ftp://hatvani.unideb.hu/pub/FreeBSD/ADDONS/docs/TV_ENCODE/rip.sh
Remember, if you watch ntsc, you'll need some additional options, but all is
there in the mplayer documentation.
More information about the freebsd-multimedia
mailing list