📄 menc-feat-telecine.html
字号:
<code class="systemitem">libavcodec</code> has two
parameters specifically for dealing with storing interlaced video a
bit better: <tt class="option"> ildct</tt> and <tt class="option">ilme</tt>. Also,
using <tt class="option">mbd=2</tt> is strongly recommended
<a class="link" href="menc-feat-telecine.html#menc-feat-telecine-footnotes" title="14.2.4.聽Footnotes">[2] </a> because it
will encode macroblocks as non-interlaced in places where there is
no motion. Note that <tt class="option">-ofps</tt> is NOT needed here.
</p><pre class="screen">mencoder dvd://1 -oac copy -ovc lavc -lavcopts ildct:ilme:mbd=2</pre><p>
</p></li><li><p>
Use a deinterlacing filter before encoding. There are several of
these filters available to choose from, each with its own advantages
and disadvantages. Consult <tt class="option">mplayer -pphelp</tt> and
<tt class="option">mplayer -vf help</tt> to see what is available
(grep for "deint"), read Michael's Niedermayer
<a class="ulink" href="http://guru.multimedia.cx/deinterlacing-filters/" target="_top">Deinterlacing filters comparison</a>,
and search the
<a class="ulink" href="http://www.mplayerhq.hu/design7/mailing_lists.html" target="_top">
MPlayer mailing lists</a> to find many discussions about the
various filters.
Again, the framerate is not changing, so no
<tt class="option">-ofps</tt>. Also, deinterlacing should be done after
cropping <a class="link" href="menc-feat-telecine.html#menc-feat-telecine-footnotes" title="14.2.4.聽Footnotes">[1]</a> and
before scaling.
</p><pre class="screen">mencoder dvd://1 -oac copy -vf yadif -ovc lavc</pre><p>
</p></li><li><p>
Unfortunately, this option is buggy with
<span class="application">MEncoder</span>; it ought to work well with
<span class="application">MEncoder G2</span>, but that is not here yet. You
might experience crahes. Anyway, the purpose of <tt class="option"> -vf
tfields</tt> is to create a full frame out of each field, which
makes the framerate 60000/1001. The advantage of this approach is that no
data is ever lost; however, since each frame comes from only one
field, the missing lines have to be interpolated somehow. There are
no very good methods of generating the missing data, and so the
result will look a bit similar to when using some deinterlacing
filters. Generating the missing lines creates other issues, as well,
simply because the amount of data doubles. So, higher encoding
bitrates are required to maintain quality, and more CPU power is
used for both encoding and decoding. tfields has several different
options for how to create the missing lines of each frame. If you
use this method, then Reference the manual, and chose whichever
option looks best for your material. Note that when using
<tt class="option">tfields</tt> you
<span class="bold"><strong>have to</strong></span> specify both
<tt class="option">-fps</tt> and <tt class="option">-ofps</tt> to be twice the
framerate of your original source.
</p><pre class="screen">
mencoder dvd://1 -oac copy -vf tfields=2 -ovc lavc \
-fps 60000/1001 -ofps 60000/1001</pre><p>
</p></li><li><p>
If you plan on downscaling dramatically, you can extract and encode
only one of the two fields. Of course, you will lose half the vertical
resolution, but if you plan on downscaling to at most 1/2 of the
original, the loss will not matter much. The result will be a
progressive 30000/1001 frames per second file. The procedure is to use
<tt class="option">-vf field</tt>, then crop
<a class="link" href="menc-feat-telecine.html#menc-feat-telecine-footnotes" title="14.2.4.聽Footnotes">[1]</a> and scale
appropriately. Remember that you will have to adjust the scale to
compensate for the vertical resolution being halved.
</p><pre class="screen">mencoder dvd://1 -oac copy -vf field=0 -ovc lavc</pre><p>
</p></li></ol></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-telecine-encode-mixedpt"></a>14.2.3.4.聽Mixed progressive and telecine</h4></div></div></div><p>
In order to turn mixed progressive and telecine video into entirely
progressive video, the telecined parts have to be
inverse-telecined. There are three ways to accomplish this,
described below. Note that you should
<span class="bold"><strong>always</strong></span> inverse-telecine before any
rescaling; unless you really know what you are doing,
inverse-telecine before cropping, too
<a class="link" href="menc-feat-telecine.html#menc-feat-telecine-footnotes" title="14.2.4.聽Footnotes">[1]</a>.
<tt class="option">-ofps 24000/1001</tt> is needed here because the output video
will be 24000/1001 frames per second.
</p><div class="itemizedlist"><ul type="disc"><li><p>
<tt class="option">-vf pullup</tt> is designed to inverse-telecine
telecined material while leaving progressive data alone. In order to
work properly, <tt class="option">pullup</tt> <span class="bold"><strong>must</strong></span>
be followed by the <tt class="option">softskip</tt> filter or
else <span class="application">MEncoder</span> will crash.
<tt class="option">pullup</tt> is, however, the cleanest and most
accurate method available for encoding both telecine and
"mixed progressive and telecine".
</p><pre class="screen">
mencoder dvd://1 -oac copy -vf pullup,softskip
-ovc lavc -ofps 24000/1001</pre><p>
</p></li><li><p>
An older method
is to, rather than inverse-telecine the telecined parts, telecine
the non-telecined parts and then inverse-telecine the whole
video. Sound confusing? softpulldown is a filter that goes through
a video and makes the entire file telecined. If we follow
softpulldown with either <tt class="option">detc</tt> or
<tt class="option">ivtc</tt>, the final result will be entirely
progressive. <tt class="option">-ofps 24000/1001</tt> is needed.
</p><pre class="screen">
mencoder dvd://1 -oac copy -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001
</pre><p>
</p></li><li><p>
I have not used <tt class="option">-vf filmdint</tt> myself, but here is what
D Richard Felker III has to say:
</p><div class="blockquote"><blockquote class="blockquote"><p>It is OK, but IMO it tries to deinterlace rather
than doing inverse telecine too often (much like settop DVD
players & progressive TVs) which gives ugly flickering and
other artifacts. If you are going to use it, you at least need to
spend some time tuning the options and watching the output first
to make sure it is not messing up.
</p></blockquote></div><p>
</p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-telecine-encode-mixedpi"></a>14.2.3.5.聽Mixed progressive and interlaced</h4></div></div></div><p>
There are two options for dealing with this category, each of
which is a compromise. You should decide based on the
duration/location of each type.
</p><div class="itemizedlist"><ul type="disc"><li><p>
Treat it as progressive. The interlaced parts will look interlaced,
and some of the interlaced fields will have to be dropped, resulting
in a bit of uneven jumpiness. You can use a postprocessing filter if
you want to, but it may slightly degrade the progressive parts.
</p><p>
This option should definitely not be used if you want to eventually
display the video on an interlaced device (with a TV card, for
example). If you have interlaced frames in a 24000/1001 frames per
second video, they will be telecined along with the progressive
frames. Half of the interlaced "frames" will be displayed for three
fields' duration (3/(60000/1001) seconds), resulting in a flicking
"jump back in time" effect that looks quite bad. If you
even attempt this, you <span class="bold"><strong>must</strong></span> use a
deinterlacing filter like <tt class="option">lb</tt> or
<tt class="option">l5</tt>.
</p><p>
It may also be a bad idea for progressive display, too. It will drop
pairs of consecutive interlaced fields, resulting in a discontinuity
that can be more visible than with the second method, which shows
some progressive frames twice. 30000/1001 frames per second interlaced
video is already a bit choppy because it really should be shown at
60000/1001 fields per second, so the duplicate frames do not stand out as
much.
</p><p>
Either way, it is best to consider your content and how you intend to
display it. If your video is 90% progressive and you never intend to
show it on a TV, you should favor a progressive approach. If it is
only half progressive, you probably want to encode it as if it is all
interlaced.
</p></li><li><p>
Treat it as interlaced. Some frames of the progressive parts will
need to be duplicated, resulting in uneven jumpiness. Again,
deinterlacing filters may slightly degrade the progressive parts.
</p></li></ul></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-telecine-footnotes"></a>14.2.4.聽Footnotes</h3></div></div></div><div class="orderedlist"><ol type="1"><li><p><b>About cropping:聽</b>
Video data on DVDs are stored in a format called YUV 4:2:0. In YUV
video, luma ("brightness") and chroma ("color")
are stored separately. Because the human eye is somewhat less
sensitive to color than it is to brightness, in a YUV 4:2:0 picture
there is only one chroma pixel for every four luma pixels. In a
progressive picture, each square of four luma pixels (two on each
side) has one common chroma pixel. You must crop progressive YUV
4:2:0 to even resolutions, and use even offsets. For example,
<tt class="option">crop=716:380:2:26</tt> is OK but
<tt class="option">crop=716:380:3:26 </tt> is not.
</p><p>
When you are dealing with interlaced YUV 4:2:0, the situation is a
bit more complicated. Instead of every four luma pixels in the
<span class="emphasis"><em>frame</em></span> sharing a chroma pixel, every four luma
pixels in each <span class="emphasis"><em> field</em></span> share a chroma
pixel. When fields are interlaced to form a frame, each scanline is
one pixel high. Now, instead of all four luma pixels being in a
square, there are two pixels side-by-side, and the other two pixels
are side-by-side two scanlines down. The two luma pixels in the
intermediate scanline are from the other field, and so share a
different chroma pixel with two luma pixels two scanlines away. All
this confusion makes it necessary to have vertical crop dimensions
and offsets be multiples of four. Horizontal can stay even.
</p><p>
For telecined video, I recommend that cropping take place after
inverse telecining. Once the video is progressive you only need to
crop by even numbers. If you really want to gain the slight speedup
that cropping first may offer, you must crop vertically by multiples
of four or else the inverse-telecine filter will not have proper data.
</p><p>
For interlaced (not telecined) video, you must always crop
vertically by multiples of four unless you use <tt class="option">-vf
field</tt> before cropping.
</p></li><li><p><b>About encoding parameters and quality:聽</b>
Just because I recommend <tt class="option">mbd=2</tt> here does not mean it
should not be used elsewhere. Along with <tt class="option">trell</tt>,
<tt class="option">mbd=2</tt> is one of the two
<code class="systemitem">libavcodec</code> options that
increases quality the most, and you should always use at least those
two unless the drop in encoding speed is prohibitive (e.g. realtime
encoding). There are many other options to
<code class="systemitem">libavcodec</code> that increase
encoding quality (and decrease encoding speed) but that is beyond
the scope of this document.
</p></li><li><p><b>About the performance of pullup:聽</b>
It is safe to use <tt class="option">pullup</tt> (along with <tt class="option">softskip
</tt>) on progressive video, and is usually a good idea unless
the source has been definitively verified to be entirely progressive.
The performace loss is small for most cases. On a bare-minimum encode,
<tt class="option">pullup</tt> causes <span class="application">MEncoder</span> to
be 50% slower. Adding sound processing and advanced <tt class="option">lavcopts
</tt> overshadows that difference, bringing the performance
decrease of using <tt class="option">pullup</tt> down to 2%.
</p></li></ol></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="menc-feat-dvd-mpeg4.html">Prev</a>聽</td><td width="20%" align="center"><a accesskey="u" href="encoding-guide.html">Up</a></td><td width="40%" align="right">聽<a accesskey="n" href="menc-feat-enc-libavcodec.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">14.1.聽Making a high quality MPEG-4 ("DivX")
rip of a DVD movie聽</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">聽14.3.聽Encoding with the <code class="systemitem">libavcodec</code>
codec family</td></tr></table></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -