mpv/DOCS/xml/zh_CN/mencoder.xml

710 lines
23 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- synced with r21612 -->
<chapter id="mencoder">
<title><application>MEncoder</application>的基础用法</title>
<para>
如果你想得到<application>MEncoder</application>的有效选项列表请参照man页。
对于一系列简易的例子以及几个编码参数的详细说明参照从MPlayer-users邮件列表
的一些邮件中搜集来的<ulink url="../../tech/encoding-tips.txt">编码小窍门</ulink>
<ulink url="http://lists.mplayerhq.hu/pipermail/mplayer-users/">压缩包</ulink>
中还可以找到大量的关于<application>MEncoder</application>编码的各个方面的讨论
以及用其编码的相关问题。
</para>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-selecting-codec">
<title>选择编解码器及容器格式</title>
<para>
编码使用的音频及视频编码器分别通过<option>-oac</option>
<option>-ovc</option>选项指定
例如输入如下命令
<screen>mencoder -ovc help</screen>
可列出你机器上相应版本的<application>MEncoder</application>所支持的所有视频编码。
下列选择也是可用的:
</para>
<para>
音频编码器:
<informaltable frame="all">
<tgroup cols="2">
<thead>
<row><entry>音频编码器名称</entry><entry>描述</entry></row>
</thead>
<tbody>
<row>
<entry>mp3lame</entry>
<entry>通过LAME编码为VBRABR或CBR格式的MP3文件</entry>
</row>
<row>
<entry>lavc</entry>
<entry>利用<link linkend="menc-feat-enc-libavcodec-audio-codecs"><systemitem class="library">libavcodec</systemitem>中的一个编码器</link>
</entry>
</row>
<row>
<entry>faac</entry>
<entry>FAAC AAC音频编码器</entry>
</row>
<row>
<entry>toolame</entry>
<entry>MPEG音频Layer 2编码器</entry>
</row>
<row>
<entry>twolame</entry>
<entry>基于tooLAME的MPEG音频Layer 2编码器</entry>
</row>
<row>
<entry>pcm</entry>
<entry>未压缩的PCM音频</entry>
</row>
<row>
<entry>copy</entry>
<entry>不要重新编码,这是复制已压缩的各桢</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
<para>
是频编码器:
<informaltable frame="all">
<tgroup cols="2">
<thead>
<row><entry>是频编码器名称</entry><entry>描述</entry></row>
</thead>
<tbody>
<row>
<entry>lavc</entry>
<entry>使用<link linkend="menc-feat-enc-libavcodec-video-codecs"><systemitem class="library">libavcodec</systemitem>中的一个是频编码器</link>
</entry>
</row>
<row>
<entry>xvid</entry>
<entry>Xvid, MPEG-4高级简单格式(ASP)编码器</entry>
</row>
<row>
<entry>x264</entry>
<entry>x264, MPEG-4高级视频编码(AVC), AKA H.264编码器</entry>
</row>
<row>
<entry>nuv</entry>
<entry>nuppel视频为一些实时程序所用</entry>
</row>
<row>
<entry>raw</entry>
<entry>未压缩的视频桢</entry>
</row>
<row>
<entry>copy</entry>
<entry>不要重新编码,只是复制已压缩的各桢</entry>
</row>
<row>
<entry>frameno</entry>
<entry>用于三通道编码(不推荐)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
<para>
输出容器格式通过<option>-of</option>选项选择。
输入:
<screen>mencoder -of help</screen>
以便列出你机器上相应版本的<application>MEncoder</application>所支持的
所有容器。
如下选项也是可用的
</para>
<para>
容器格式:
<informaltable frame="all">
<tgroup cols="2">
<thead>
<row><entry>容器格式名称</entry><entry>描述</entry></row>
</thead>
<tbody>
<row>
<entry>lavf</entry>
<entry><systemitem class="library">libavformat</systemitem>
支持的一种容器</entry>
</row>
<row>
<entry>avi</entry>
<entry>音-视频混合</entry>
</row>
<row>
<entry>mpeg</entry>
<entry>MPEG-1及MPEG-2节目流</entry>
</row>
<row>
<entry>rawvideo</entry>
<entry>原始视频流(未经混合 - 只含一视频流)</entry>
</row>
<row>
<entry>rawaudio</entry>
<entry>原始音频流(未经混合 - 只含一音频流)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
AVI容器是<application>MEncoder</application>的基本容器格式,也就是说它能够
被最好的处理,<application>MEncoder</application>也是为之而设计。
如上所述,其他容器格式也可被使用,但你使用的时候可能遇到问题。
</para>
<para>
<systemitem class="library">libavformat</systemitem>容器:
</para>
<para>
如果你选择了<systemitem class="library">libavformat</systemitem>
来做输出文件的混编(通过使用<option>-of lavf</option>选项),
适当的容器将由文件扩展名而定。
你也可以通过<systemitem class="library">libavformat</systemitem>
<option>format</option>选项强制一种容器格式。
<informaltable frame="all">
<tgroup cols="2">
<thead><row>
<entry><systemitem class="library">libavformat</systemitem>容器名称</entry>
<entry>描述</entry>
</row></thead>
<tbody>
<row>
<entry>mpg</entry>
<entry>MPEG-1及MPEG-2节目流</entry>
</row>
<row>
<entry>asf</entry>
<entry>高级流格式</entry>
</row>
<row>
<entry>avi</entry>
<entry>音-视频混合</entry>
</row>
<row>
<entry>wav</entry>
<entry>波形音频</entry>
</row>
<row>
<entry>swf</entry>
<entry>Macromedia Flash</entry>
</row>
<row>
<entry>flv</entry>
<entry>Macromedia Flash视频</entry>
</row>
<row>
<entry>rm</entry>
<entry>RealMedia</entry>
</row>
<row>
<entry>au</entry>
<entry>SUN AU</entry>
</row>
<row>
<entry>nut</entry>
<entry>NUT开放容器实验中不兼容标准</entry>
</row>
<row>
<entry>mov</entry>
<entry>QuickTime</entry>
</row>
<row>
<entry>mp4</entry>
<entry>MPEG-4格式</entry>
</row>
<row>
<entry>dv</entry>
<entry>Sony数字视频容器</entry>
</row>
</tbody>
</tgroup>
</informaltable>
如你所见,<systemitem class="library">libavformat</systemitem>允许
<application>MEncoder</application>把媒体混合到各种格式的容器内。
不巧的是,因为<application>MEncoder</application>从开始设计的时候
没有支持AVI之外的其他容器你要小心最终生成的文件。
请多次检查以确认音频/视频同步是正确的以及文件能在
<application>MPlayer</application>之外的播放器中播放。
</para>
<example>
<title>编码为Macromedia Flash格式</title>
<para>
生成Macromedia Flash视频以便在安装有Macromedia Flash插件的网页浏览器中播放
<screen>
mencoder <replaceable>input.avi</replaceable> -o <replaceable>output.flv</replaceable> -of lavf \
-oac mp3lame -lameopts abr:br=56 -srate 22050 -ovc lavc \
-lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3
</screen>
</para>
</example>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-selecting-input">
<title>选择输入文件或设备</title>
<para>
<application>MEncoder</application>可以从文件或直接从DVD或VCD的盘片进行编码。
秩序在命令行中包含文件名以便从文件进行编码,或
<option>dvd://</option><replaceable>标题数</replaceable>
<option>vcd://</option><replaceable>轨道数</replaceable>以便从DVD标题或VCD轨
道进行编码。
如果你已经把DVD复制到你的硬盘上你可以使用像<application>dvdbackup</application>
这样的工具,大多数系统上都有),然后想从副本进行编码,你仍需使用
<option>dvd://</option>语法加上附带了指向DVD副本的根目录的
<option>-dvd-device</option>选项。
<option>-dvd-device</option><option>-cdrom-device</option>选项也能用于
覆盖用来直接从光盘中直接读取数据的设备的路径,如果缺省的
<filename>/dev/dvd</filename><filename>/dev/cdrom</filename>在你的系统上步工作
的话。
</para>
<para>
当从DVD进行编码时最好是选其中的一章或几章进行编码。
为此你可以使用<option>-chapter</option>选项。
例如<option>-chapter</option> <replaceable>1-4</replaceable>将只编码DVD中的1至4章。
如果你针对包含1400MB数据的两张CD进行编码这将非常有用因为你可以确定只在一章的边
缘处分割,而不是在一个场景中间。
</para>
<para>
如果你有张被支持的电视卡,你也可以通过播放电视节目的设备进行编码。
使用<option>tv://</option><replaceable>channelnumber</replaceable>为文件名,
并用<option>-tv</option>配置各种截取选项。
DVB输入工作原理类似。
</para>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-mpeg4">
<title>编码为双通道MPEG-4 ("DivX")</title>
<para>
之所以这样命名,是因为这种编码<emphasis>两次</emphasis>对文件进行编码。
第一次编码(配音通道)生成一些几兆大的临时文件(<filename>*.log</filename>)
先不要删除它们你可以删除AVI或者通过重定向到<filename>/dev/null</filename>
而不生成视频)。第二次编码时,生成了双通道输出文件,使用的即是从临时文件提供
的比特律数据。生成文件会有更好的图像质量。如果这是你第一次听说,你可以在互联
网上找到相关参考。
</para>
<example id="copy_audio_track">
<title>复制音轨</title>
<para>
双通道编码在复制音轨时将DVD的第二个轨道转换成MPEG-4 ("DivX") AVI。
<screen>
mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o /dev/null
mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vpass=2 \
-oac copy -o <replaceable>output.avi</replaceable>
</screen>
</para>
</example>
<example id="encode_audio_track">
<title>对音轨编码</title>
<para>
将一个DVD编码成MPEG-4 ("DivX") AVI音轨采用MP3格式
使用这个方法的时候要当心,因为有时它可能造成音/视频不同步。
<screen>
mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 \
-oac mp3lame -lameopts vbr=3 -o /dev/null
mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vpass=2 \
-oac mp3lame -lameopts vbr=3 -o <replaceable>output.avi</replaceable>
</screen>
</para>
</example>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-handheld-psp">
<title>编码为Sony PSP视频格式</title>
<para>
<application>MEncoder</application>支持到Sony PSP的视频格式转换但是依赖于
PSP软件修改对不同软件限制也许会有不同。
如果你遵守如下守则,你将不会遇到什么问题:
<itemizedlist>
<listitem><para>
<emphasis role="bold">比特律</emphasis>不应超过每秒1500kb然而过去的版本
几乎支持任何比特律只要头文件声明其不是太高。
</para></listitem>
<listitem><para>
<emphasis role="bold">维数</emphasis>PSP视频的长宽应是16的倍数并且长*宽的
积应&lt;= 64000。
在一些情况下PSP可能播放更高分辨率的文件。
</para></listitem>
<listitem><para>
<emphasis role="bold">音频</emphasis>其采样率针对MPEG-4应为24kHz针对H.264
为48kHz。
</para></listitem>
</itemizedlist>
</para>
<example id="encode_for_psp">
<title>编码到PSP</title>
<para>
<screen>
mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \
-oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \
-lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames \
<replaceable>input.video</replaceable> -o <replaceable>output.psp</replaceable>
</screen>
注意你可以通过
<option>-info name=<replaceable>MovieTitle</replaceable></option>为视频摄者标题。
</para>
</example>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-mpeg">
<title>编码为MPEG格式</title>
<para>
<application>MEncoder</application>可生成MPEG (MPEG-节目流)格式的文件。
通常当你使用MPEG-1或MPEG-2视频是因为你的编码受限于SVCD, VCD, 或DVD。
这些格式所需的特别要求将在
<link linkend="menc-feat-vcd-dvd"> VCD及DVD生成指南 </link>
中进行解释
section.
</para>
<para>
要改变<application>MEncoder</application>的输出文件格式,使用
<option>-of mpeg</option>选项。
</para>
<informalexample>
<para>
例如:
<screen>
mencoder <replaceable>input.avi</replaceable> -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video \
-oac copy <replaceable>other_options</replaceable> -o <replaceable>output.mpg</replaceable>
</screen>
可生成为只有有限多媒体支持的系统进行播放的MPEG-1文件例如默认安装的Windows
<screen>
mencoder <replaceable>input.avi</replaceable> -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 \
-o <replaceable>output.mpg</replaceable> -oac lavc -lavcoptc acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3
</screen>
同上,但使用了<systemitem class="library">libavformat</systemitem> MPEG混合器
<screen>
mencoder <replaceable>input.avi</replaceable> -o <replaceable>VCD.mpg</replaceable> -ofps 25 -vf scale=352:288,harddup -of lavf \
-lavfopts format=mpg:i_certify_that_my_video_stream_does_not_use_b_frames \
-oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg1video:vrc_buf_size=327:keyint=15:vrc_maxrate=1152:vbitrate=1152:vmax_b_frames=0
</screen>
</para>
</informalexample>
<note><title>提示:</title>
<para>
如果由于某种原因,第二次编码的效果不能令你满意,你可以使用另外一种比特律
重新执行视频编码,只要你保存了前一次编码中生成的统计文件。
这是可行因为生成统计文件的主要目的是记录每桢的复杂度,不是特别依赖于比特律。
然而,你要注意的是如果所有编码按照与最终生成文件的比特律相差不大的参数执行
程序,你将得到最佳效果。
</para>
</note>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-rescale">
<title>改变电影大小</title>
<para>
经常出现要改变电影图片大小的需求。原因可能是多样的:减小文件大小,网络带宽
等等。大多数人甚至在将DVD或SVCD转换成DivX AVI时也改变影片大小。如果你想改变
影片大小,阅读<link linkend="aspect">保持长宽比</link>一节
</para>
<para>
变换过程由<literal>scale</literal>视频滤镜处理:
<option>-vf scale=<replaceable></replaceable>:<replaceable></replaceable></option>
输出质量可由<option>-sws</option>选项调节。
如果没有设置,<application>MEncoder</application>将使用2双三次。
</para>
<para>
用法:
<screen>
mencoder <replaceable>input.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell \
-vf scale=640:480 -o <replaceable>output.avi</replaceable>
</screen>
</para>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-streamcopy">
<title>媒体流复制</title>
<para>
<application>MEncoder</application>能以两种方式处理输入媒体流:
<emphasis role="bold">编码</emphasis><emphasis role="bold">复制</emphasis>
本节是关于<emphasis role="bold">复制</emphasis>的。
</para>
<itemizedlist>
<listitem><para>
<emphasis role="bold">视频流</emphasis> (选项<option>-ovc copy</option>)
一系列工作可以完成的很好 :) 好像把FLI或VIVO或MPEG-1视频放入不是转换
一个AVI文件中当然只有<application>MPlayer</application>能播放这样的文
件:)并且也许它并没有生活上的实际价值。实际意义上:当只有音频流要被编码(
例如从无压缩的PCM到MP3视频流才可能有用。
</para></listitem>
<listitem><para>
<emphasis role="bold">音频流</emphasis> (选项<option>-oac copy</option>)
直接的。你可能提取一个外部音频文件MP3WAV并将其合成到一个输出媒体流里。
为此可使用<option>-audiofile <replaceable>文件名</replaceable></option>选项。
</para></listitem>
</itemizedlist>
<para>
使用<option>-oac copy</option>从一种容器格式复制到另一种容器格式时,你可能需要
使用<option>-fafmttag</option>选项以保持原始文件的音频格式标签。例如,如果你将
一个使用AAC音频的NSV文件转换到AVI容器中音频格式文件标签可能是错误的需要被
转换。对于详细的音频格式标签,查看<filename>codecs.conf</filename>
</para>
<para>
例子:
<screen>
mencoder <replaceable>input.nsv</replaceable> -oac copy -fafmttag 0x706D \
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -o <replaceable>output.avi</replaceable>
</screen>
</para>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-enc-images">
<title>从多个输入图像文件进行编码(JPEG, PNG, TGA等)</title>
<para>
<application>MEncoder</application>可以通过一个或多个JPEG, PNG, TGA, 或其
他图片文件制作电影。使用简单的桢复制它能生成MJPEG (移动JPEG), MPNG
(移动PNG)或MTGA (移动TGA) 文件。
</para>
<orderedlist>
<title>进程描述:</title>
<listitem><para>
<application>MEncoder</application>使用<systemitem class="library">libjpeg</systemitem>
当解码PNG时它将使用<systemitem class="library">libpng</systemitem>)将输入图片进行
<emphasis>解码</emphasis>
</para></listitem>
<listitem><para>
<application>MEncoder</application>然后将解码好的图片送到被选定的视频压缩器中
(DivX4, Xvid, FFmpeg msmpeg4等)。
</para></listitem>
</orderedlist>
<formalpara>
<title>例子</title>
<para>
关于<option>-mf</option>选项的解释在man页中。
<informalexample>
<para>
使用当前目录下所有JPEG文件生成MPEG-4文件。
<screen>
mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc \
-lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o <replaceable>output.avi</replaceable>
</screen>
</para>
</informalexample>
<informalexample>
<para>
使用当前目录中的一些JPEG文件生成MPEG-4文件。
<screen>
mencoder mf://<replaceable>frame001.jpg,frame002.jpg</replaceable> -mf w=800:h=600:fps=25:type=jpg \
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o <replaceable>output.avi</replaceable>
</screen>
</para>
</informalexample>
<informalexample>
<para>
使用显示指示的一系列JPEG文件生成MPEG-4文件当前目录下的list.txt包含被用做源的文件列表
一个一行):
<screen>
mencoder mf://<replaceable>@list.txt</replaceable> -mf w=800:h=600:fps=25:type=jpg \
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o <replaceable>output.avi</replaceable>
</screen>
</para>
</informalexample>
<informalexample>
<para>
使用当前目录下所有JPEG文件生成移动JPEGMJPEG文件
<screen>
mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc copy -oac copy -o <replaceable>output.avi</replaceable>
</screen>
</para>
</informalexample>
<informalexample>
<para>
使用当前目录下所有PNG文件生成未压缩的文件
<screen>
mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc raw -oac copy -o <replaceable>output.avi</replaceable>
</screen>
</para>
</informalexample>
<note><para>
宽度必须是4的倍数这是原始RGB AVI文件格式的限制。
</para></note>
<informalexample>
<para>
使用当前目录下所有PNG文件生成移动PNG (MPNG)文件:
<screen>
mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o <replaceable>output.avi</replaceable><!--
--></screen>
</para>
</informalexample>
<informalexample>
<para>
使用当前目录下的所有TGA文件生成移动TGA (MTGA)文件:
<screen>
mencoder mf://*.tga -mf w=800:h=600:fps=25:type=tga -ovc copy -oac copy -o <replaceable>output.avi</replaceable><!--
--></screen>
</para>
</informalexample>
</para>
</formalpara>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="menc-feat-extractsub">
<title>将DVD子标题提取到VOBsub文件</title>
<para>
<application>MEncoder</application>能将DVD子标题提取到VOBsub格式的文件中。
它们是一对由<filename>.idx</filename><filename>.sub</filename>结尾的文件
组成。并且经常被压缩成一个<filename>.rar</filename>文件。
<application>MPlayer</application>可通过
<option>-vobsub</option><option>-vobsubid</option>选项播放这些文件。
</para>
<para>
你可以通过<option>-vobsubout</option>指定输出文件的基础名(例如不包括
<filename>.idx</filename><filename>.sub</filename>后缀),对于生成文件
子标题的索引使用<option>-vobsuboutindex</option>
</para>
<para>
如果不是从DVD输入你应该使用<option>-ifo</option>来表明构建
生成的<filename>.idx</filename>文件所需的<filename>.ifo</filename>文件。
</para>
<para>
如果输入不是DVD并且你没有<filename>.ifo</filename>文件,你需使用
<option>-vobsubid</option>选项以使其知道放入<filename>.idx</filename>
文件的语言标识。
</para>
<para>
如果<filename>.sub</filename><filename>.idx</filename>文件存在,每次
执行都回添加子标题。所以你再开始前需要手动清除这些文件。
</para>
<example id="copying_two_subtitles_from_a_dvd_while_doing_two_pass_encoding">
<title>在做双通道编码时从DVD复制子标题</title>
<screen>
rm <replaceable>subtitles.idx</replaceable> <replaceable>subtitles.sub</replaceable>
mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 \
-vobsubout <replaceable>subtitles</replaceable> -vobsuboutindex 0 -sid 2
mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vpass=2 \
-vobsubout <replaceable>subtitles</replaceable> -vobsuboutindex 1 -sid 5<!--
--></screen>
</example>
<example id="copying_a_french_subtitle_from_an_mpeg_file">
<title>从一个MPEG文件复制法文子标题</title>
<screen>
rm <replaceable>subtitles.idx</replaceable> <replaceable>subtitles.sub</replaceable>
mencoder <replaceable>movie.mpg</replaceable> -ifo <replaceable>movie.ifo</replaceable> -vobsubout <replaceable>subtitles</replaceable> -vobsuboutindex 0 \
-vobsuboutid fr -sid 1 -nosound -ovc copy
</screen>
</example>
</sect1>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sect1 id="aspect">
<title>保持视频画面比例</title>
<para>
DVD及SVCD(例如MPEG-1/2)文件包含画面比例,此信息可用来指示播放器应如何显示视频流,
所以显示的人不会有个鸡蛋头例如480x480 + 4:3 = 640x480。然而当编码为AVI(DivX)
文件时你要小心AVI头信息里没有包含这些值。重新设置这些比例是非常讨厌并且很花时间
应该有更好的方法!
</para>
<para>还有</para>
<para>
MPEG-4有个独特的特点视频流可以包含它需要的画面比例。是的正像MPEG-1/2 (DVD,
SVCD)及H.263文件一样。可惜的是,除了<application>MPlayer</application>几乎没有播放器
支持这项MPEG-4属性。
</para>
<para>
这种特性之可以与
<link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>
<systemitem>mpeg4</systemitem>编码器一同使用。记住:虽然
<application>MPlayer</application>可以正常播放所生成的文件,其他播放器可能使用错误
的图象比例。
</para>
<para>
你应剪切电影图像上下方的黑条。针对<systemitem>cropdetect</systemitem>
<systemitem>crop</systemitem>滤镜的用法参考man页。
</para>
<para>
用法
<screen>mencoder <replaceable>sample-svcd.mpg</replaceable> -vf crop=714:548:0:14 -oac copy -ovc lavc \
-lavcopts vcodec=mpeg4:mbd=2:trell:autoaspect -o <replaceable>output.avi</replaceable></screen>
</para>
</sect1>
</chapter>