hellfred
15th June 2004, 08:06
Hi there
I am new to encoding in Linux, just did some encodings under win32 using GUIs. Now i want to start all over from the commandline.
So i want to ask you for a little bit of help to not having to start from zero.
I want to use mencoder (and maybe transcode later,too) to create some MPEG4 videos, using both libavcodec and xvid. I have compiled mencoder with support of libavcodec, xvid and lame.
Serching Doom9 i only came up with an quite old thread (http://forum.doom9.org/showthread.php?s=&threadid=75402&highlight=mencoder) (late 2001)
The documentation of mplayer/mencoder is a little bit outdated, too, but i have found a draft (http://sault.org/~tack/menc-feat-dvd-mpeg4.html) for a up to date "Making a high quality MPEG4 ("DivX") rip of a DVD movie" page. I want to use this as a startpoint for libavcodec encoding, and ask you what to change/improve to get a good quality two CD-R rip of a movie from DVD, or anime content capured with a analog capture card which adds lots of noise.
We're now ready to do the 2-pass encode. Pass 1:
mencoder dvd://1 -ofps 23.976 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 \
-o Harry_Potter_2.avi
And pass 2 is the same, except that we specify vpass=2:
mencoder dvd://1 -ofps 23.976 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=2 \
-o Harry_Potter_2.avi
The options v4mv:mbd=2:trell will greatly increase the quality at the expense of encoding time. There's little reason to leave these options out when the primary goal is quality. The options cmp=3:subcmp=3:mbcmp=3 select a comparison function that yields higher quality than the defaults. You might try experimenting with with this parameter (refer to the man page for the possible values) as different functions can have a large impact on quality depending on the source material. For example, if you find libavcodec produces too much blocky artifacting, you could try *cmp=10. (This comparison function, NSSE, is currently only available in CVS versions and is experimental.)
For this movie, the resulting AVI will be 138 minutes long and nearly 3GB. And because you said that file size doesn't matter, this is a perfectly acceptable size. However, if you had wanted it smaller, you could try a lower bitrate. Increasing bitrates have diminishing returns. So while we might clearly see an improvement from 1800Kbit to 2000Kbit, it might not be so noticeable above 2000Kbit. Feel free to experiment until you're happy.
I have now idea what to what and how to pass parameters to mencoder for encoding with xvid and where to look for. Can anybody please give me an example and a link to a place wher i learn what to do and what the parameters are?
Good shellscripts are welcome, too.
This (http://them.ws/stuff/docs/dvdencode.txt) one is missing some sophisticated command line parameters for encoding, though.
Hellfred
I am new to encoding in Linux, just did some encodings under win32 using GUIs. Now i want to start all over from the commandline.
So i want to ask you for a little bit of help to not having to start from zero.
I want to use mencoder (and maybe transcode later,too) to create some MPEG4 videos, using both libavcodec and xvid. I have compiled mencoder with support of libavcodec, xvid and lame.
Serching Doom9 i only came up with an quite old thread (http://forum.doom9.org/showthread.php?s=&threadid=75402&highlight=mencoder) (late 2001)
The documentation of mplayer/mencoder is a little bit outdated, too, but i have found a draft (http://sault.org/~tack/menc-feat-dvd-mpeg4.html) for a up to date "Making a high quality MPEG4 ("DivX") rip of a DVD movie" page. I want to use this as a startpoint for libavcodec encoding, and ask you what to change/improve to get a good quality two CD-R rip of a movie from DVD, or anime content capured with a analog capture card which adds lots of noise.
We're now ready to do the 2-pass encode. Pass 1:
mencoder dvd://1 -ofps 23.976 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 \
-o Harry_Potter_2.avi
And pass 2 is the same, except that we specify vpass=2:
mencoder dvd://1 -ofps 23.976 -oac copy -vf crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \
-lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=2 \
-o Harry_Potter_2.avi
The options v4mv:mbd=2:trell will greatly increase the quality at the expense of encoding time. There's little reason to leave these options out when the primary goal is quality. The options cmp=3:subcmp=3:mbcmp=3 select a comparison function that yields higher quality than the defaults. You might try experimenting with with this parameter (refer to the man page for the possible values) as different functions can have a large impact on quality depending on the source material. For example, if you find libavcodec produces too much blocky artifacting, you could try *cmp=10. (This comparison function, NSSE, is currently only available in CVS versions and is experimental.)
For this movie, the resulting AVI will be 138 minutes long and nearly 3GB. And because you said that file size doesn't matter, this is a perfectly acceptable size. However, if you had wanted it smaller, you could try a lower bitrate. Increasing bitrates have diminishing returns. So while we might clearly see an improvement from 1800Kbit to 2000Kbit, it might not be so noticeable above 2000Kbit. Feel free to experiment until you're happy.
I have now idea what to what and how to pass parameters to mencoder for encoding with xvid and where to look for. Can anybody please give me an example and a link to a place wher i learn what to do and what the parameters are?
Good shellscripts are welcome, too.
This (http://them.ws/stuff/docs/dvdencode.txt) one is missing some sophisticated command line parameters for encoding, though.
Hellfred