menc-feat-vcd-dvd.html

来自「MPlayer-mingw32-1.0rc2.zip 经典播放器源码」· HTML 代码 · 共 313 行 · 第 1/2 页

HTML
313
字号
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>14.8.聽Using MEncoder to create VCD/SVCD/DVD-compliant files</title><link rel="stylesheet" href="default.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="MPlayer - The Movie Player"><link rel="up" href="encoding-guide.html" title="Chapter聽14.聽Encoding with MEncoder"><link rel="prev" href="menc-feat-quicktime-7.html" title="14.7.聽Using MEncoder to create QuickTime-compatible files"><link rel="next" href="bugreports.html" title="Appendix聽A.聽How to report bugs"><link rel="preface" href="howtoread.html" title="How to read this documentation"><link rel="chapter" href="intro.html" title="Chapter聽1.聽Introduction"><link rel="chapter" href="install.html" title="Chapter聽2.聽Installation"><link rel="chapter" href="usage.html" title="Chapter聽3.聽Usage"><link rel="chapter" href="cd-dvd.html" title="Chapter聽4.聽CD/DVD usage"><link rel="chapter" href="faq.html" title="Chapter聽5.聽Frequently Asked Questions"><link rel="chapter" href="containers.html" title="Chapter聽6.聽Containers"><link rel="chapter" href="codecs.html" title="Chapter聽7.聽Codecs"><link rel="chapter" href="video.html" title="Chapter聽8.聽Video output devices"><link rel="chapter" href="audio.html" title="Chapter聽9.聽Audio output devices"><link rel="chapter" href="tv.html" title="Chapter聽10.聽TV"><link rel="chapter" href="radio.html" title="Chapter聽11.聽Radio"><link rel="chapter" href="ports.html" title="Chapter聽12.聽Ports"><link rel="chapter" href="mencoder.html" title="Chapter聽13.聽Basic usage of MEncoder"><link rel="chapter" href="encoding-guide.html" title="Chapter聽14.聽Encoding with MEncoder"><link rel="appendix" href="bugreports.html" title="Appendix聽A.聽How to report bugs"><link rel="appendix" href="bugs.html" title="Appendix聽B.聽Known bugs"><link rel="appendix" href="skin.html" title="Appendix聽C.聽MPlayer skin format"><link rel="appendix" href="history.html" title="Appendix聽D.聽History"><link rel="subsection" href="menc-feat-vcd-dvd.html#menc-feat-vcd-dvd-constraints" title="14.8.1.聽Format Constraints"><link rel="subsection" href="menc-feat-vcd-dvd.html#menc-feat-vcd-dvd-output" title="14.8.2.聽Output Options"><link rel="subsection" href="menc-feat-vcd-dvd.html#menc-feat-vcd-dvd-lavc" title="14.8.3.聽Using libavcodec for VCD/SVCD/DVD Encoding"><link rel="subsection" href="menc-feat-vcd-dvd.html#menc-feat-vcd-dvd-audio" title="14.8.4.聽Encoding Audio"><link rel="subsection" href="menc-feat-vcd-dvd.html#menc-feat-vcd-dvd-all" title="14.8.5.聽Putting it all Together"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">14.8.聽Using <span class="application">MEncoder</span>
  to create VCD/SVCD/DVD-compliant files</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="menc-feat-quicktime-7.html">Prev</a>聽</td><th width="60%" align="center">Chapter聽14.聽Encoding with <span class="application">MEncoder</span></th><td width="20%" align="right">聽<a accesskey="n" href="bugreports.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="menc-feat-vcd-dvd"></a>14.8.聽Using <span class="application">MEncoder</span>
  to create VCD/SVCD/DVD-compliant files</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-vcd-dvd-constraints"></a>14.8.1.聽Format Constraints</h3></div></div></div><p>
<span class="application">MEncoder</span> is capable of creating VCD, SCVD
and DVD format MPEG files using the
<code class="systemitem">libavcodec</code> library.
These files can then be used in conjunction with
<a class="ulink" href="http://www.gnu.org/software/vcdimager/vcdimager.html" target="_top">vcdimager</a>
or
<a class="ulink" href="http://dvdauthor.sourceforge.net/" target="_top">dvdauthor</a>
to create discs that will play on a standard set-top player.
</p><p>
The DVD, SVCD, and VCD formats are subject to heavy constraints.
Only a small selection of encoded picture sizes and aspect ratios are
available.
If your movie does not already meet these requirements, you may have
to scale, crop or add black borders to the picture to make it
compliant.
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-constraints-resolution"></a>14.8.1.1.聽Format Constraints</h4></div></div></div><div class="informaltable"><table border="1"><colgroup><col><col><col><col><col><col><col><col><col></colgroup><thead><tr><th>Format</th><th>Resolution</th><th>V. Codec</th><th>V. Bitrate</th><th>Sample Rate</th><th>A. Codec</th><th>A. Bitrate</th><th>FPS</th><th>Aspect</th></tr></thead><tbody><tr><td>NTSC DVD</td><td>720x480, 704x480, 352x480, 352x240</td><td>MPEG-2</td><td>9800 kbps</td><td>48000 Hz</td><td>AC-3,PCM</td><td>1536 kbps (max)</td><td>30000/1001, 24000/1001</td><td>4:3, 16:9 (only for 720x480)</td></tr><tr><td>NTSC DVD</td><td>352x240<sup>[<a name="fn-rare-resolutions" href="#ftn.fn-rare-resolutions" class="footnote">a</a>]</sup></td><td>MPEG-1</td><td>1856 kbps</td><td>48000 Hz</td><td>AC-3,PCM</td><td>1536 kbps (max)</td><td>30000/1001, 24000/1001</td><td>4:3, 16:9</td></tr><tr><td>NTSC SVCD</td><td>480x480</td><td>MPEG-2</td><td>2600 kbps</td><td>44100 Hz</td><td>MP2</td><td>384 kbps (max)</td><td>30000/1001</td><td>4:3</td></tr><tr><td>NTSC VCD</td><td>352x240</td><td>MPEG-1</td><td>1150 kbps</td><td>44100 Hz</td><td>MP2</td><td>224 kbps</td><td>24000/1001, 30000/1001</td><td>4:3</td></tr><tr><td>PAL DVD</td><td>720x576, 704x576, 352x576, 352x288</td><td>MPEG-2</td><td>9800 kbps</td><td>48000 Hz</td><td>MP2,AC-3,PCM</td><td>1536 kbps (max)</td><td>25</td><td>4:3, 16:9 (only for 720x576)</td></tr><tr><td>PAL DVD</td><td>352x288<sup>[<a href="menc-feat-vcd-dvd.html#ftn.fn-rare-resolutions" class="footnoteref">a</a>]</sup></td><td>MPEG-1</td><td>1856 kbps</td><td>48000 Hz</td><td>MP2,AC-3,PCM</td><td>1536 kbps (max)</td><td>25</td><td>4:3, 16:9</td></tr><tr><td>PAL SVCD</td><td>480x576</td><td>MPEG-2</td><td>2600 kbps</td><td>44100 Hz</td><td>MP2</td><td>384 kbps (max)</td><td>25</td><td>4:3</td></tr><tr><td>PAL VCD</td><td>352x288</td><td>MPEG-1</td><td>1152 kbps</td><td>44100 Hz</td><td>MP2</td><td>224 kbps</td><td>25</td><td>4:3</td></tr></tbody><tbody class="footnotes"><tr><td colspan="9"><div class="footnote"><p><sup>[<a name="ftn.fn-rare-resolutions" href="#fn-rare-resolutions" class="para">a</a>] </sup>
  These resolutions are rarely used for DVDs because
  they are fairly low quality.</p></div></td></tr></tbody></table></div><p>
If your movie has 2.35:1 aspect (most recent action movies), you will
have to add black borders or crop the movie down to 16:9 to make a DVD or VCD.
If you add black borders, try to align them at 16-pixel boundaries in
order to minimize the impact on encoding performance.
Thankfully DVD has sufficiently excessive bitrate that you do not have
to worry too much about encoding efficiency, but SVCD and VCD are
highly bitrate-starved and require effort to obtain acceptable quality.
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-constraints-gop"></a>14.8.1.2.聽GOP Size Constraints</h4></div></div></div><p>
DVD, VCD, and SVCD also constrain you to relatively low 
GOP (Group of Pictures) sizes.
For 30 fps material the largest allowed GOP size is 18.
For 25 or 24 fps, the maximum is 15.
The GOP size is set using the <tt class="option">keyint</tt> option.
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-constraints-bitrate"></a>14.8.1.3.聽Bitrate Constraints</h4></div></div></div><p>
VCD video is required to be CBR at 1152 kbps.
This highly limiting constraint also comes along with an extremly low vbv
buffer size of 327 kilobits.
SVCD allows varying video bitrates up to 2500 kbps, and a somewhat less 
restrictive vbv buffer size of 917 kilobits is allowed.
DVD video bitrates may range anywhere up to 9800 kbps (though typical
bitrates are about half that), and the vbv buffer size is 1835 kilobits.
</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-vcd-dvd-output"></a>14.8.2.聽Output Options</h3></div></div></div><p>
<span class="application">MEncoder</span> has options to control the output
format.
Using these options we can instruct it to create the correct type of
file.
</p><p>
The options for VCD and SVCD are called xvcd and xsvcd, because they
are extended formats.
They are not strictly compliant, mainly because the output does not
contain scan offsets.
If you need to generate an SVCD image, you should pass the output file to
<a class="ulink" href="http://www.gnu.org/software/vcdimager/vcdimager.html" target="_top">vcdimager</a>.
</p><p>
VCD:
</p><pre class="screen">-of mpeg -mpegopts format=xvcd</pre><p>
</p><p>
SVCD:
</p><pre class="screen">-of mpeg -mpegopts format=xsvcd</pre><p>
</p><p>
DVD (with timestamps on every frame, if possible):
</p><pre class="screen">-of mpeg -mpegopts format=dvd:tsaf</pre><p>
</p><p>
DVD with NTSC Pullup:
</p><pre class="screen">-of mpeg -mpegopts format=dvd:tsaf:telecine -ofps 24000/1001</pre><p>
This allows 24000/1001 fps progressive content to be encoded at 30000/1001 
fps whilst maintaing DVD-compliance.
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-output-aspect"></a>14.8.2.1.聽Aspect Ratio</h4></div></div></div><p>
The aspect argument of <tt class="option">-lavcopts</tt> is used to encode
the aspect ratio of the file.
During playback the aspect ratio is used to restore the video to the
correct size.
</p><p>
16:9 or "Widescreen"
</p><pre class="screen">-lavcopts aspect=16/9</pre><p>
</p><p>
4:3 or "Fullscreen"
</p><pre class="screen">-lavcopts aspect=4/3</pre><p>
</p><p>
2.35:1 or "Cinemascope" NTSC
</p><pre class="screen">-vf scale=720:368,expand=720:480 -lavcopts aspect=16/9</pre><p>
To calculate the correct scaling size, use the expanded NTSC width of
854/2.35 = 368
</p><p>
2.35:1 or "Cinemascope" PAL
</p><pre class="screen">-vf scale=720:432,expand=720:576 -lavcopts aspect=16/9</pre><p>
To calculate the correct scaling size, use the expanded PAL width of
1024/2.35 = 432
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-a-v-sync"></a>14.8.2.2.聽Maintaining A/V sync</h4></div></div></div><p>
In order to maintain audio/video synchronization throughout the encode,
<span class="application">MEncoder</span> has to drop or duplicate frames.
This works rather well when muxing into an AVI file, but is almost
guaranteed to fail to maintain A/V sync with other muxers such as MPEG.
This is why it is necessary to append the
<tt class="option">harddup</tt> video filter at the end of the filter chain
to avoid this kind of problem.
You can find more technical information about <tt class="option">harddup</tt>
in the section
<a class="link" href="menc-feat-dvd-mpeg4.html#menc-feat-dvd-mpeg4-muxing-filter-issues" title="14.1.12.1.聽Improving muxing and A/V sync reliability">Improving muxing and A/V sync reliability</a>
or in the manual page.
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-output-srate"></a>14.8.2.3.聽Sample Rate Conversion</h4></div></div></div><p>
If the audio sample rate in the original file is not the same as
required by the target format, sample rate conversion is required.
This is achieved using the <tt class="option">-srate</tt> option and 
the <tt class="option">-af lavcresample</tt> audio filter together.
</p><p>
DVD:
</p><pre class="screen">-srate 48000 -af lavcresample=48000</pre><p>
</p><p>
VCD and SVCD:
</p><pre class="screen">-srate 44100 -af lavcresample=44100</pre><p>
</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-vcd-dvd-lavc"></a>14.8.3.聽Using libavcodec for VCD/SVCD/DVD Encoding</h3></div></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-lavc-intro"></a>14.8.3.1.聽Introduction</h4></div></div></div><p>
<code class="systemitem">libavcodec</code> can be used to
create VCD/SVCD/DVD compliant video by using the appropriate options.
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="menc-feat-vcd-dvd-lavc-options"></a>14.8.3.2.聽lavcopts</h4></div></div></div><p>
This is a list of fields in <tt class="option">-lavcopts</tt> that you may
be required to change in order to make a complaint movie for VCD, SVCD,
or DVD:
</p><div class="itemizedlist"><ul type="disc"><li><p>
  <span class="bold"><strong>acodec</strong></span>:
  <tt class="option">mp2</tt> for VCD, SVCD, or PAL DVD;
  <tt class="option">ac3</tt> is most commonly used for DVD.
  PCM audio may also be used for DVD, but this is mostly a big waste of
  space.
  Note that MP3 audio is not compliant for any of these formats, but
  players often have no problem playing it anyway.
</p></li><li><p>
  <span class="bold"><strong>abitrate</strong></span>:
  224 for VCD; up to 384 for SVCD; up to 1536 for  DVD, but commonly
  used values range from 192 kbps for stereo to 384 kbps for 5.1 channel
  sound.
</p></li><li><p>
  <span class="bold"><strong>vcodec</strong></span>:
  <tt class="option">mpeg1video</tt> for VCD;
  <tt class="option">mpeg2video</tt> for SVCD;
  <tt class="option">mpeg2video</tt> is usually used for DVD but you may also use
  <tt class="option">mpeg1video</tt> for CIF resolutions.
</p></li><li><p>
  <span class="bold"><strong>keyint</strong></span>:
  Used to set the GOP size.
  18 for 30fps material, or 15 for 25/24 fps material.
  Commercial producers seem to prefer keyframe intervals of 12.
  It is possible to make this much larger and still retain compatibility 
  with most players.
  A <tt class="option">keyint</tt> of 25 should never cause any problems.
</p></li><li><p>
  <span class="bold"><strong>vrc_buf_size</strong></span>:
  327 for VCD, 917 for SVCD, and 1835 for DVD.
</p></li><li><p>
  <span class="bold"><strong>vrc_minrate</strong></span>:
  1152, for VCD. May be left alone for SVCD and DVD.
</p></li><li><p>
  <span class="bold"><strong>vrc_maxrate</strong></span>:
  1152 for VCD; 2500 for SVCD; 9800 for DVD.
  For SVCD and DVD, you might wish to use lower values depending on your
  own personal preferences and requirements.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?