📄 menc-feat-dvd-mpeg4.html
字号:
</p><pre class="screen">-vf crop=688:464:12:4,scale=640:464</pre><p>
will first crop the 688x464 region of the picture with upper-left
corner at (12,4), and then scale the result down to 640x464.
</p><p>
Certain filters need to be loaded at or near the beginning of the
filter chain, in order to take advantage of information from the
video decoder that will be lost or invalidated by other filters.
The principal examples are <tt class="option">pp</tt> (postprocessing, only
when it is performing deblock or dering operations),
<tt class="option">spp</tt> (another postprocessor to remove MPEG artifacts),
<tt class="option">pullup</tt> (inverse telecine), and
<tt class="option">softpulldown</tt> (for converting soft telecine to hard telecine).
</p><p>
In general, you want to do as little filtering as possible to the movie
in order to remain close to the original DVD source. Cropping is often
necessary (as described above), but avoid to scale the video. Although
scaling down is sometimes preferred to using higher quantizers, we want
to avoid both these things: remember that we decided from the start to
trade bits for quality.
</p><p>
Also, do not adjust gamma, contrast, brightness, etc. What looks good
on your display may not look good on others. These adjustments should
be done on playback only.
</p><p>
One thing you might want to do, however, is pass the video through a
very light denoise filter, such as <tt class="option">-vf hqdn3d=2:1:2</tt>.
Again, it is a matter of putting those bits to better use: why waste them
encoding noise when you can just add that noise back in during playback?
Increasing the parameters for <tt class="option">hqdn3d</tt> will further
improve compressibility, but if you increase the values too much, you
risk degrading the image visibily. The suggested values above
(<tt class="option">2:1:2</tt>) are quite conservative; you should feel free to
experiment with higher values and observe the results for yourself.
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-dvd-mpeg4-interlacing"></a>14.1.7.聽Interlacing and Telecine</h3></div></div></div><p>
Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some
processing must be done to this 24 fps video to make it run at the correct
NTSC framerate. The process is called 3:2 pulldown, commonly referred to
as telecine (because pulldown is often applied during the telecine
process), and, naively described, it works by slowing the film down to
24000/1001 fps, and repeating every fourth frame.
</p><p>
No special processing, however, is done to the video for PAL DVDs, which
run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown,
but this does not become an issue in practice.) The 24 fps film is simply
played back at 25 fps. The result is that the movie runs slightly faster,
but unless you are an alien, you probably will not notice the difference.
Most PAL DVDs have pitch-corrected audio, so when they are played back at
25 fps things will sound right, even though the audio track (and hence the
whole movie) has a running time that is 4% less than NTSC DVDs.
</p><p>
Because the video in a PAL DVD has not been altered, you need not worry
much about framerate. The source is 25 fps, and your rip will be 25
fps. However, if you are ripping an NTSC DVD movie, you may need to
apply inverse telecine.
</p><p>
For movies shot at 24 fps, the video on the NTSC DVD is either telecined
30000/1001, or else it is progressive 24000/1001 fps and intended to be
telecined on-the-fly by a DVD player. On the other hand, TV series are usually
only interlaced, not telecined. This is not a hard rule: some TV series
are interlaced (such as Buffy the Vampire Slayer) whereas some are a
mixture of progressive and interlaced (such as Angel, or 24).
</p><p>
It is highly recommended that you read the section on
<a class="link" href="menc-feat-telecine.html" title="14.2.聽How to deal with telecine and interlacing within NTSC DVDs">How to deal with telecine and interlacing in NTSC DVDs</a>
to learn how to handle the different possibilities.
</p><p>
However, if you are mostly just ripping movies, likely you are either
dealing with 24 fps progressive or telecined video, in which case you can
use the <tt class="option">pullup</tt> filter <tt class="option">-vf
pullup,softskip</tt>.
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-dvd-mpeg4-encoding-interlaced"></a>14.1.8.聽Encoding interlaced video</h3></div></div></div><p>
If the movie you want to encode is interlaced (NTSC video or
PAL video), you will need to choose whether you want to
deinterlace or not.
While deinterlacing will make your movie usable on progressive
scan displays such a computer monitors and projectors, it comes
at a cost: The fieldrate of 50 or 60000/1001 fields per second
is halved to 25 or 30000/1001 frames per second, and roughly half of
the information in your movie will be lost during scenes with
significant motion.
</p><p>
Therefore, if you are encoding for high quality archival purposes,
it is recommended not to deinterlace.
You can always deinterlace the movie at playback time when
displaying it on progressive scan devices.
The power of currently available computers forces players to use a
deinterlacing filter, which results in a slight degradation in
image quality.
But future players will be able to mimic the interlaced display of
a TV, deinterlacing to full fieldrate and interpolating 50 or
60000/1001 entire frames per second from the interlaced video.
</p><p>
Special care must be taken when working with interlaced video:
</p><div class="orderedlist"><ol type="1"><li><p>
Crop height and y-offset must be multiples of 4.
</p></li><li><p>
Any vertical scaling must be performed in interlaced mode.
</p></li><li><p>
Postprocessing and denoising filters may not work as expected
unless you take special care to operate them a field at a time,
and they may damage the video if used incorrectly.
</p></li></ol></div><p>
With these things in mind, here is our first example:
</p><pre class="screen">
mencoder <em class="replaceable"><code>capture.avi</code></em> -mc 0 -oac lavc -ovc lavc -lavcopts \
vcodec=mpeg2video:vbitrate=6000:ilme:ildct:acodec=mp2:abitrate=224
</pre><p>
Note the <tt class="option">ilme</tt> and <tt class="option">ildct</tt> options.
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-dvd-mpeg4-av-sync"></a>14.1.9.聽Notes on Audio/Video synchronization</h3></div></div></div><p>
<span class="application">MEncoder</span>'s audio/video synchronization
algorithms were designed with the intention of recovering files with
broken sync.
However, in some cases they can cause unnecessary skipping and duplication of
frames, and possibly slight A/V desync, when used with proper input
(of course, A/V sync issues apply only if you process or copy the
audio track while transcoding the video, which is strongly encouraged).
Therefore, you may have to switch to basic A/V sync with
the <tt class="option">-mc 0</tt> option, or put this in your
<code class="systemitem">~/.mplayer/mencoder</code> config file, as long as
you are only working with good sources (DVD, TV capture, high quality
MPEG-4 rips, etc) and not broken ASF/RM/MOV files.
</p><p>
If you want to further guard against strange frame skips and
duplication, you can use both <tt class="option">-mc 0</tt> and
<tt class="option">-noskip</tt>.
This will prevent <span class="emphasis"><em>all</em></span> A/V sync, and copy frames
one-to-one, so you cannot use it if you will be using any filters that
unpredictably add or drop frames, or if your input file has variable
framerate!
Therefore, using <tt class="option">-noskip</tt> is not in general recommended.
</p><p>
The so-called "three-pass" audio encoding which
<span class="application">MEncoder</span> supports has been reported to cause A/V
desync.
This will definitely happen if it is used in conjunction with certain
filters, therefore, it is now recommended <span class="emphasis"><em>not</em></span> to
use three-pass audio mode.
This feature is only left for compatibility purposes and for expert
users who understand when it is safe to use and when it is not.
If you have never heard of three-pass mode before, forget that we
even mentioned it!
</p><p>
There have also been reports of A/V desync when encoding from stdin
with <span class="application">MEncoder</span>.
Do not do this! Always use a file or CD/DVD/etc device as input.
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-dvd-mpeg4-codec"></a>14.1.10.聽Choosing the video codec</h3></div></div></div><p>
Which video codec is best to choose depends on several factors,
like size, quality, streamability, usability and popularity, some of
which widely depend on personal taste and technical constraints.
</p><div class="itemizedlist"><ul type="disc"><li><p>
<span class="bold"><strong>Compression efficiency</strong></span>:
It is quite easy to understand that most newer-generation codecs are
made to increase quality and compression.
Therefore, the authors of this guide and many other people suggest that
you cannot go wrong
<sup>[<a name="fn-menc-feat-dvd-mpeg4-codec-cpu" href="#ftn.fn-menc-feat-dvd-mpeg4-codec-cpu" class="footnote">2</a>]</sup>
when choosing MPEG-4 AVC codecs like
<code class="systemitem">x264</code> instead of MPEG-4 ASP codecs
such as <code class="systemitem">libavcodec</code> MPEG-4 or
<code class="systemitem">Xvid</code>.
(Advanced codec developers may be interested in reading Michael
Niedermayer's opinion on
"<a class="ulink" href="http://guru.multimedia.cx/?p=10" target="_top">why MPEG4-ASP sucks</a>".)
Likewise, you should get better quality using MPEG-4 ASP than you
would with MPEG-2 codecs.
</p><p>
However, newer codecs which are in heavy development can suffer from
bugs which have not yet been noticed and which can ruin an encode.
This is simply the tradeoff for using bleeding-edge technology.
</p><p>
What is more, beginning to use a new codec requires that you spend some
time becoming familiar with its options, so that you know what
to adjust to achieve a desired picture quality.
</p></li><li><p>
<span class="bold"><strong>Hardware compatibility</strong></span>:
It usually takes a long time for standalone video players to begin to
include support for the latest video codecs.
As a result, most only support MPEG-1 (like VCD, XVCD and KVCD), MPEG-2
(like DVD, SVCD and KVCD) and MPEG-4 ASP (like DivX,
<code class="systemitem">libavcodec</code>'s LMP4 and
<code class="systemitem">Xvid</code>)
(Beware: Usually, not all MPEG-4 ASP features are supported).
Please refer to the technical specs of your player (if they are available),
or google around for more information.
</p></li><li><p>
<span class="bold"><strong>Best quality per encoding time</strong></span>:
Codecs that have been around for some time (such as
<code class="systemitem">libavcodec</code> MPEG-4 and
<code class="systemitem">Xvid</code>) are usually heavily
optimized with all kinds of smart algorithms and SIMD assembly code.
That is why they tend to yield the best quality per encoding time ratio.
However, they may have some very advanced options that, if enabled,
will make the encode really slow for marginal gains.
</p><p>
If you are after blazing speed you should stick around the default
settings of the video codec (although you should still try the other
options which are mentioned in other sections of this guide).
</p><p>
You may also consider choosing a codec which can do multi-threaded
processing, though this is only useful for users of machines with
several CPUs.
<code class="systemitem">libavcodec</code> MPEG-4 does
allow that, but speed gains are limited, and there is a slight
negative effect on picture quality.
<code class="systemitem">Xvid</code>'s multi-threaded encoding,
activated by the <tt class="option">threads</tt> option, can be used to
boost encoding speed 鈥
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -