[MPlayer-DOCS] Re: [MPlayer-dev-eng] A DVD ripping example into docs?
Samuli Kärkkäinen
skarkkai at woods.iki.fi
Thu Jan 1 22:32:13 CET 2004
On Mon, Dec 29, 2003 at 12:09:42PM +0300, Dmitry Baryshkov wrote:
> Hello,
> On Mon, Dec 29, 2003 at 02:20:00AM +0200, Samuli K?rkk?inen wrote:
> > On Sun, Dec 28, 2003 at 05:21:21PM -0300, Diego Biurrun wrote:
> > > Hi!
> > >
> > > Thanks for this patch! Below are some comments, it would be nice if
> > > you could send in an updated version.
> >
> > Updated patch below with all the changes you suggested. Good to see
> > there still exists people who care about grammar :)
>
> Also, could you please wrap each MPlayer and MEncoder word with
> <application>...</application> tags.
Done. If there are other similar small fixes needed, it's entirely okay
to just make them without a confirmation from me. Otherwise, as nobody
has protested the content of this patch, I figure it is ripe for
commit.
--- DOCS/xml/en/mencoder.xml.orig 2003-12-28 05:11:48.000000000 +0200
+++ DOCS/xml/en/mencoder.xml 2004-01-01 23:23:12.000000000 +0200
@@ -569,4 +569,165 @@
</para>
</sect1>
+<sect1 id="menc-feat-dvd-mpeg4">
+<title>Making a high quality MPEG4 ("DivX") rip of a DVD movie</title>
+
+<para>
+ Ripping a DVD title into a maximally high quality MPEG4 (DivX) file
+ involves many considerations. Below is an example of the process when
+ there's no file size goal (other than perhaps fitting the result into 2GB).
+ The libavcodec codec will be used for the video, and the audio will be
+ copied as is without any changes.
+</para>
+
+<sect2 id="menc-feat-dvd-mpeg4-crop">
+<title>Cropping</title>
+<para>
+ Play the DVD and run a crop detect filter
+ (<option>-vf cropdetect</option>) on it. This gives you a crop rectangle to use
+ for encoding. The reason for cropping is that many movies are filmed
+ in a different aspect ratio than standard DVD ratios (16/9 or 4/3),
+ or, for whatever reason, the picture does not properly fill the
+ frame. So you want to crop out the pointless black bars when you rip.
+ A common aspect is 2.35, which is cinescope. Most big blockbuster
+ movies have this aspect ratio.
+</para></sect2>
+
+<sect2 id="menc-feat-dvd-mpeg4-quality">
+<title>Quality level</title>
+<para>
+ Next you need to choose the desired quality level. When there's no
+ need to fit the resulting file on CDs or the like, using constant
+ quantizing aka constant quality is a good choice. That way each frame
+ is given as much bits as its needs to keep the quality at desired
+ level, but multiple encoding passes are not needed. With
+ libavcodec, you get constant quality by using
+ <option>-lavcopts vqscale=<replaceable>N</replaceable></option>. Using
+ <option>vqscale=3</option> gives you a file that's usually below 2GB,
+ depending mainly on the movie length and video noisiness (the
+ more noise, the harder it is to compress.)
+</para></sect2>
+
+<sect2 id="menc-feat-dvd-mpeg4-2gb">
+<title>Files over 2GB</title>
+<para>
+ When you're done encoding using constant quality, you may find the
+ resulting file is over 2GB. As of this writing, 28 Dec 2003, in
+ order to view larger than 2GB files, <application>MPlayer</application> CVS version requires
+ you to clumsily create index into a separate file using
+ <option>-saveidx</option> and <option>-loadidx</option> options.
+ Slightly older versions, such as 0.92, are even clumsier, and require
+ you to use <option>-forceidx</option> upon every viewing with over 2GB AVIs. If this
+ bothers you, you may want to keep the file size below 2GB.
+
+ </para><para>
+
+ To this end, you have two choices. You can try encoding again using
+ <option>vqscale=4</option> and see if both the resulting file size
+ and picture quality are acceptable. You can also use 2 pass encoding
+ as explained elsewhere in this manual. As you will be copying the
+ audio track as is and hence know its bitrate, and you know the
+ running time of the movie, you can compute the required bitrate to
+ give to <option>-lavcopts vbitrate=<replaceable>bitrate</replaceable></option>
+ option without using 3 pass encoding.
+</para></sect2>
+
+<sect2 id="menc-feat-dvd-mpeg4-deinterlacing">
+<title>Deinterlacing</title>
+<para>
+ If the movie is interlaced, you may want to deinterlace it as part of
+ the ripping. It's debatable whether deinterlacing should be done at
+ this stage. The benefit is that deinterlacing when converting to
+ MPEG4 makes compression better, and viewing easier and less CPU
+ intensive on computer monitor as no deinterlacing is required at that
+ time.
+
+ </para><para>
+
+ Deinterlacing at ripping stage is an idea whose goodness depends on
+ the DVD. If the DVD is made from film, which was shot at 24 fps, you
+ can as well deinterlace while ripping since as far as I can see,
+ nothing will be lost anyway. If however the original was 50/60 fps
+ video, converting into deinterlaced into 23.976/25 fps video will
+ lose information. If you do decide to interlace, you can further
+ experiment with different deinterlacing filters. See
+ <ulink url="http://www.wieser-web.de/MPlayer/">http://www.wieser-web.de/MPlayer/</ulink> for examples.
+ I currently use <option>-vf pp=fd</option>.
+
+ </para><para>
+
+ If you're both cropping and deinterlacing, deinterlace
+ <emphasis>before</emphasis> cropping. Actually, this is not necessary
+ if the crop offset is vertically a multiple of 2 pixel. However with
+ some other filters like dering you should always crop last, so it's a
+ good habit to crop in the last stage.
+</para></sect2>
+
+<sect2 id="menc-feat-dvd-mpeg4-telecine">
+<title>Inverse telecine</title>
+<para>
+ If you're ripping a PAL DVD, which is 25 fps, you don't need to think
+ of the fps. Just use the 25 fps. NTSC DVDs on the other hand are
+ 29.97 fps (often rounded to 30 fps, but that's not what they are).
+ If the movie was shot for TV, you again don't need to touch the fps.
+ But if the movie was shot on film, and hence at (exactly) 24 fps,
+ then it has been converted into 29.97 fps when making the DVD. That
+ conversion where 12 fields are added to each 24 frames of film is
+ called telecine. For more info about telecine, see a <ulink
+ url="http://www.google.com/search?q=telecine+field+23.976">Google
+ search for "telecine field 23.976"</ulink>.
+
+ </para><para>
+
+ In case you have such telecined DVD, you will want to do inverse
+ telecine, that is convert the movie to 23.976 (29.97*4/5). Otherwise
+ camera panning will look jerky and awful. I use
+ <option>-ofps 23.976</option> for this. Anything that is shown on theatres is shot
+ in film and needs inverse telecine, and TV shows like Friends don't.
+</para></sect2>
+
+<sect2 id="menc-feat-dvd-mpeg4-scaling">
+<title>Scaling and aspect ratio</title>
+<para>
+ For best quality, don't scale the movie while ripping. Scaling causes
+ artifacts and makes the file larger. Pixels in DVD movies aren't
+ square, so DVD movies include info about the correct aspect ratio.
+ It's possible to store the aspect ratio also in the MPEG4 header of
+ the output file. Most video players ignore this info, but <application>MPlayer</application>
+ doesn't. Hence if you're only going to use <application>MPlayer</application> for viewing the
+ output file, you don't need to scale the movie but just give option
+ <option>-lavcopts autoaspect</option> to <application>MEncoder</application> and things will
+ then work automagically right. If you must scale the movie, be
+ careful about getting the size right especially if you do cropping.
+</para></sect2>
+
+<sect2 id="menc-feat-dvd-mpeg4-summary">
+<title>Summing it up</title>
+<para>
+ All of the above put together, a suitable encoding command might be
+
+ <screen>
+mencoder -dvd 1 -aid 128 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vqscale=3:vhq:v4mv:trell:autoaspect \
+ -ofps 23.976 -vf crop=720:364:0:56 -o Harry_Potter_2.avi
+ </screen>
+
+ Here <option>-dvd 1</option> gives the DVD title to rip. Option
+ <option>-aid 128</option> says to use audio track 128, and
+ <option>-oac copy</option> to copy it as is. You'll have to use
+ <application>MPlayer</application> to find out the right for these.
+
+ </para><para>
+
+ Options <option>vhq:v4mv:trell</option> for
+ <option>-lavcopts</option> improve quality versus bitrate, but make
+ encoding take longer. Especially <option>trell</option> slows
+ encoding down but also increases quality visibly. If you want to
+ deinterlace, add a <option>pp</option> filter to
+ <option>-vf</option>, for example
+ <option>-vf pp=fd,crop=720:364:0:56</option> (in that order). If you don't need
+ inverse telecine, leave out the <option>-ofps 23.976</option>.
+</para></sect2>
+
+</sect1>
+
</chapter>
--
Samuli Kärkkäinen |\ _,,,---,,_
skarkkai at woods.iki.fi ---------ZZZzz /,`.-'`' -. ;-;;,_------
http://www.woods.iki.fi |,4- ) )-,_. ,\ ( `'-'
'---''(_/--' `-'\_)
More information about the MPlayer-DOCS
mailing list