whitespace cosmetics: Remove all trailing whitespace.
[mplayer/glamo.git] / DOCS / xml / zh_CN / mencoder.xml
blob81ab1170dcbbe3bf143171e93f275d2253e538a0
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- synced with r21612 -->
3 <chapter id="mencoder">
4 <title><application>MEncoder</application>的基础用法</title>
6 <para>
7 如果你想得到<application>MEncoder</application>的有效选项列表,请参照man页。
8 对于一系列简易的例子以及几个编码参数的详细说明,参照从MPlayer-users邮件列表
9 的一些邮件中搜集来的<ulink url="../../tech/encoding-tips.txt">编码小窍门</ulink>。
10 从<ulink url="http://lists.mplayerhq.hu/pipermail/mplayer-users/">压缩包</ulink>
11 中还可以找到大量的关于<application>MEncoder</application>编码的各个方面的讨论
12 以及用其编码的相关问题。
13 </para>
16 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
19 <sect1 id="menc-feat-selecting-codec">
20 <title>选择编解码器及容器格式</title>
22 <para>
23 编码使用的音频及视频编码器分别通过<option>-oac</option>及
24 <option>-ovc</option>选项指定
25 例如输入如下命令
26 <screen>mencoder -ovc help</screen>
27 可列出你机器上相应版本的<application>MEncoder</application>所支持的所有视频编码。
28 下列选择也是可用的:
29 </para>
31 <para>
32 音频编码器:
33 <informaltable frame="all">
34 <tgroup cols="2">
35 <thead>
36 <row><entry>音频编码器名称</entry><entry>描述</entry></row>
37 </thead>
38 <tbody>
39 <row>
40   <entry>mp3lame</entry>
41   <entry>通过LAME编码为VBR,ABR或CBR格式的MP3文件</entry>
42 </row>
43 <row>
44   <entry>lavc</entry>
45   <entry>利用<link linkend="menc-feat-enc-libavcodec-audio-codecs"><systemitem class="library">libavcodec</systemitem>中的一个编码器</link>
46   </entry>
47 </row>
48 <row>
49   <entry>faac</entry>
50   <entry>FAAC AAC音频编码器</entry>
51 </row>
52 <row>
53   <entry>toolame</entry>
54   <entry>MPEG音频Layer 2编码器</entry>
55 </row>
56 <row>
57   <entry>twolame</entry>
58   <entry>基于tooLAME的MPEG音频Layer 2编码器</entry>
59 </row>
60 <row>
61   <entry>pcm</entry>
62   <entry>未压缩的PCM音频</entry>
63 </row>
64 <row>
65   <entry>copy</entry>
66   <entry>不要重新编码,这是复制已压缩的各桢</entry>
67 </row>
68 </tbody>
69 </tgroup>
70 </informaltable>
71 </para>
73 <para>
74 是频编码器:
75 <informaltable frame="all">
76 <tgroup cols="2">
77 <thead>
78 <row><entry>是频编码器名称</entry><entry>描述</entry></row>
79 </thead>
80 <tbody>
81 <row>
82   <entry>lavc</entry>
83   <entry>使用<link linkend="menc-feat-enc-libavcodec-video-codecs"><systemitem class="library">libavcodec</systemitem>中的一个是频编码器</link>
84   </entry>
85 </row>
86 <row>
87   <entry>xvid</entry>
88   <entry>Xvid, MPEG-4高级简单格式(ASP)编码器</entry>
89 </row>
90 <row>
91   <entry>x264</entry>
92   <entry>x264, MPEG-4高级视频编码(AVC), AKA H.264编码器</entry>
93 </row>
94 <row>
95   <entry>nuv</entry>
96   <entry>nuppel视频,为一些实时程序所用</entry>
97 </row>
98 <row>
99   <entry>raw</entry>
100   <entry>未压缩的视频桢</entry>
101 </row>
102 <row>
103   <entry>copy</entry>
104   <entry>不要重新编码,只是复制已压缩的各桢</entry>
105 </row>
106 <row>
107   <entry>frameno</entry>
108   <entry>用于三通道编码(不推荐)</entry>
109 </row>
110 </tbody>
111 </tgroup>
112 </informaltable>
113 </para>
115 <para>
116 输出容器格式通过<option>-of</option>选项选择。
117 输入:
118 <screen>mencoder -of help</screen>
119 以便列出你机器上相应版本的<application>MEncoder</application>所支持的
120 所有容器。
121 如下选项也是可用的
122 </para>
124 <para>
125 容器格式:
126 <informaltable frame="all">
127 <tgroup cols="2">
128 <thead>
129 <row><entry>容器格式名称</entry><entry>描述</entry></row>
130 </thead>
131 <tbody>
132 <row>
133   <entry>lavf</entry>
134   <entry>由<systemitem class="library">libavformat</systemitem>
135   支持的一种容器</entry>
136 </row>
137 <row>
138   <entry>avi</entry>
139   <entry>音-视频混合</entry>
140 </row>
141 <row>
142   <entry>mpeg</entry>
143   <entry>MPEG-1及MPEG-2节目流</entry>
144 </row>
145 <row>
146   <entry>rawvideo</entry>
147   <entry>原始视频流(未经混合 - 只含一视频流)</entry>
148 </row>
149 <row>
150   <entry>rawaudio</entry>
151   <entry>原始音频流(未经混合 - 只含一音频流)</entry>
152 </row>
153 </tbody>
154 </tgroup>
155 </informaltable>
156 AVI容器是<application>MEncoder</application>的基本容器格式,也就是说它能够
157 被最好的处理,<application>MEncoder</application>也是为之而设计。
158 如上所述,其他容器格式也可被使用,但你使用的时候可能遇到问题。
159 </para>
161 <para>
162 <systemitem class="library">libavformat</systemitem>容器:
163 </para>
165 <para>
166 如果你选择了<systemitem class="library">libavformat</systemitem>
167 来做输出文件的混编(通过使用<option>-of lavf</option>选项),
168 适当的容器将由文件扩展名而定。
169 你也可以通过<systemitem class="library">libavformat</systemitem>的
170 <option>format</option>选项强制一种容器格式。
172 <informaltable frame="all">
173 <tgroup cols="2">
174 <thead><row>
175 <entry><systemitem class="library">libavformat</systemitem>容器名称</entry>
176 <entry>描述</entry>
177 </row></thead>
178 <tbody>
179 <row>
180   <entry>mpg</entry>
181   <entry>MPEG-1及MPEG-2节目流</entry>
182 </row>
183 <row>
184   <entry>asf</entry>
185   <entry>高级流格式</entry>
186 </row>
187 <row>
188   <entry>avi</entry>
189   <entry>音-视频混合</entry>
190 </row>
191 <row>
192   <entry>wav</entry>
193   <entry>波形音频</entry>
194 </row>
195 <row>
196   <entry>swf</entry>
197   <entry>Macromedia Flash</entry>
198 </row>
199 <row>
200   <entry>flv</entry>
201   <entry>Macromedia Flash视频</entry>
202 </row>
203 <row>
204   <entry>rm</entry>
205   <entry>RealMedia</entry>
206 </row>
207 <row>
208   <entry>au</entry>
209   <entry>SUN AU</entry>
210 </row>
211 <row>
212   <entry>nut</entry>
213   <entry>NUT开放容器(实验中,不兼容标准)</entry>
214 </row>
215 <row>
216   <entry>mov</entry>
217   <entry>QuickTime</entry>
218 </row>
219 <row>
220   <entry>mp4</entry>
221   <entry>MPEG-4格式</entry>
222 </row>
223 <row>
224   <entry>dv</entry>
225   <entry>Sony数字视频容器</entry>
226 </row>
227 </tbody>
228 </tgroup>
229 </informaltable>
230 如你所见,<systemitem class="library">libavformat</systemitem>允许
231 <application>MEncoder</application>把媒体混合到各种格式的容器内。
232 不巧的是,因为<application>MEncoder</application>从开始设计的时候
233 没有支持AVI之外的其他容器,你要小心最终生成的文件。
234 请多次检查以确认音频/视频同步是正确的以及文件能在
235 <application>MPlayer</application>之外的播放器中播放。
236 </para>
238 <example id="encode_to_macromedia_flash_format">
239 <title>编码为Macromedia Flash格式</title>
240 <para>
241 生成Macromedia Flash视频,以便在安装有Macromedia Flash插件的网页浏览器中播放:
242 <screen>
243 mencoder <replaceable>input.avi</replaceable> -o <replaceable>output.flv</replaceable> -of lavf \
244     -oac mp3lame -lameopts abr:br=56 -srate 22050 -ovc lavc \
245     -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3
246 </screen>
247 </para>
248 </example>
250 </sect1>
253 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
256 <sect1 id="menc-feat-selecting-input">
257 <title>选择输入文件或设备</title>
259 <para>
260 <application>MEncoder</application>可以从文件或直接从DVD或VCD的盘片进行编码。
261 秩序在命令行中包含文件名以便从文件进行编码,或
262 <option>dvd://</option><replaceable>标题数</replaceable>或
263 <option>vcd://</option><replaceable>轨道数</replaceable>以便从DVD标题或VCD轨
264 道进行编码。
265 如果你已经把DVD复制到你的硬盘上(你可以使用像<application>dvdbackup</application>
266 这样的工具,大多数系统上都有),然后想从副本进行编码,你仍需使用
267 <option>dvd://</option>语法,加上附带了指向DVD副本的根目录的
268 <option>-dvd-device</option>选项。
270 <option>-dvd-device</option>及<option>-cdrom-device</option>选项也能用于
271 覆盖用来直接从光盘中直接读取数据的设备的路径,如果缺省的
272 <filename>/dev/dvd</filename>及<filename>/dev/cdrom</filename>在你的系统上步工作
273 的话。
274 </para>
276 <para>
277 当从DVD进行编码时,最好是选其中的一章或几章进行编码。
278 为此你可以使用<option>-chapter</option>选项。
279 例如<option>-chapter</option> <replaceable>1-4</replaceable>将只编码DVD中的1至4章。
280 如果你针对包含1400MB数据的两张CD进行编码,这将非常有用,因为你可以确定只在一章的边
281 缘处分割,而不是在一个场景中间。
282 </para>
284 <para>
285 如果你有张被支持的电视卡,你也可以通过播放电视节目的设备进行编码。
286 使用<option>tv://</option><replaceable>channelnumber</replaceable>为文件名,
287 并用<option>-tv</option>配置各种截取选项。
288 DVB输入工作原理类似。
289 </para>
290 </sect1>
293 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
296 <sect1 id="menc-feat-mpeg4">
297 <title>编码为双通道MPEG-4 ("DivX")</title>
299 <para>
300 之所以这样命名,是因为这种编码<emphasis>两次</emphasis>对文件进行编码。
301 第一次编码(配音通道)生成一些几兆大的临时文件(<filename>*.log</filename>),
302 先不要删除它们(你可以删除AVI或者通过重定向到<filename>/dev/null</filename>
303 而不生成视频)。第二次编码时,生成了双通道输出文件,使用的即是从临时文件提供
304 的比特律数据。生成文件会有更好的图像质量。如果这是你第一次听说,你可以在互联
305 网上找到相关参考。
306 </para>
308 <example id="copy_audio_track">
309 <title>复制音轨</title>
310 <para>
311 双通道编码在复制音轨时将DVD的第二个轨道转换成MPEG-4 ("DivX") AVI。
312 <screen>
313 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o /dev/null
314 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vpass=2 \
315     -oac copy -o <replaceable>output.avi</replaceable>
316 </screen>
317 </para>
318 </example>
320 <example id="encode_audio_track">
321 <title>对音轨编码</title>
322 <para>
323 将一个DVD编码成MPEG-4 ("DivX") AVI,音轨采用MP3格式
324 使用这个方法的时候要当心,因为有时它可能造成音/视频不同步。
325 <screen>
326 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 \
327     -oac mp3lame -lameopts vbr=3 -o /dev/null
328 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vpass=2 \
329     -oac mp3lame -lameopts vbr=3 -o <replaceable>output.avi</replaceable>
330 </screen>
331 </para>
332 </example>
333 </sect1>
336 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
339 <sect1 id="menc-feat-handheld-psp">
340 <title>编码为Sony PSP视频格式</title>
342 <para>
343 <application>MEncoder</application>支持到Sony PSP的视频格式转换,但是依赖于
344 PSP软件修改,对不同软件限制也许会有不同。
345 如果你遵守如下守则,你将不会遇到什么问题:
346 <itemizedlist>
347 <listitem><para>
348   <emphasis role="bold">比特律</emphasis>:不应超过每秒1500kb,然而过去的版本
349   几乎支持任何比特律只要头文件声明其不是太高。
350 </para></listitem>
351 <listitem><para>
352   <emphasis role="bold">维数</emphasis>:PSP视频的长宽应是16的倍数,并且长*宽的
353   积应&lt;= 64000。
354   在一些情况下,PSP可能播放更高分辨率的文件。
355 </para></listitem>
356 <listitem><para>
357   <emphasis role="bold">音频</emphasis>:其采样率针对MPEG-4应为24kHz,针对H.264
358   为48kHz。
359 </para></listitem>
360 </itemizedlist>
361 </para>
363 <example id="encode_for_psp">
364 <title>编码到PSP</title>
365 <para>
366 <screen>
367 mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \
368     -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \
369     -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames \
370     <replaceable>input.video</replaceable> -o <replaceable>output.psp</replaceable>
371 </screen>
372 注意你可以通过
373 <option>-info name=<replaceable>MovieTitle</replaceable></option>为视频摄者标题。
374 </para>
375 </example>
376 </sect1>
379 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
382 <sect1 id="menc-feat-mpeg">
383 <title>编码为MPEG格式</title>
384 <para>
385 <application>MEncoder</application>可生成MPEG (MPEG-节目流)格式的文件。
386 通常,当你使用MPEG-1或MPEG-2视频,是因为你的编码受限于SVCD, VCD, 或DVD。
387 这些格式所需的特别要求将在
388 <link linkend="menc-feat-vcd-dvd"> VCD及DVD生成指南 </link>
389 中进行解释
390 section.
391 </para>
393 <para>
394 要改变<application>MEncoder</application>的输出文件格式,使用
395 <option>-of mpeg</option>选项。
396 </para>
398 <informalexample>
399 <para>
400 例如:
401 <screen>
402 mencoder <replaceable>input.avi</replaceable> -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video \
403     -oac copy <replaceable>other_options</replaceable> -o <replaceable>output.mpg</replaceable>
404 </screen>
405 可生成为只有有限多媒体支持的系统进行播放的MPEG-1文件,例如默认安装的Windows:
406 <screen>
407 mencoder <replaceable>input.avi</replaceable> -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 \
408     -o <replaceable>output.mpg</replaceable> -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
409     -lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3
410 </screen>
411 同上,但使用了<systemitem class="library">libavformat</systemitem> MPEG混合器:
412 <screen>
413 mencoder <replaceable>input.avi</replaceable> -o <replaceable>VCD.mpg</replaceable> -ofps 25 -vf scale=352:288,harddup -of lavf \
414     -lavfopts format=mpg:i_certify_that_my_video_stream_does_not_use_b_frames \
415     -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
416     -lavcopts vcodec=mpeg1video:vrc_buf_size=327:keyint=15:vrc_maxrate=1152:vbitrate=1152:vmax_b_frames=0
417 </screen>
418 </para>
419 </informalexample>
421 <note><title>提示:</title>
422 <para>
423 如果由于某种原因,第二次编码的效果不能令你满意,你可以使用另外一种比特律
424 重新执行视频编码,只要你保存了前一次编码中生成的统计文件。
425 这是可行因为生成统计文件的主要目的是记录每桢的复杂度,不是特别依赖于比特律。
426 然而,你要注意的是如果所有编码按照与最终生成文件的比特律相差不大的参数执行
427 程序,你将得到最佳效果。
428 </para>
429 </note>
430 </sect1>
433 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
436 <sect1 id="menc-feat-rescale">
437 <title>改变电影大小</title>
439 <para>
440 经常出现要改变电影图片大小的需求。原因可能是多样的:减小文件大小,网络带宽
441 等等。大多数人甚至在将DVD或SVCD转换成DivX AVI时也改变影片大小。如果你想改变
442 影片大小,阅读<link linkend="aspect">保持长宽比</link>一节
443 </para>
445 <para>
446 变换过程由<literal>scale</literal>视频滤镜处理:
447 <option>-vf scale=<replaceable>宽</replaceable>:<replaceable>高</replaceable></option>。
448 输出质量可由<option>-sws</option>选项调节。
449 如果没有设置,<application>MEncoder</application>将使用2:双三次。
450 </para>
452 <para>
453 用法:
454 <screen>
455 mencoder <replaceable>input.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell \
456     -vf scale=640:480 -o <replaceable>output.avi</replaceable>
457 </screen>
458 </para>
459 </sect1>
462 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
465 <sect1 id="menc-feat-streamcopy">
466 <title>媒体流复制</title>
468 <para>
469 <application>MEncoder</application>能以两种方式处理输入媒体流:
470 <emphasis role="bold">编码</emphasis>或<emphasis role="bold">复制</emphasis>。
471 本节是关于<emphasis role="bold">复制</emphasis>的。
472 </para>
474 <itemizedlist>
475 <listitem><para>
476   <emphasis role="bold">视频流</emphasis> (选项<option>-ovc copy</option>):
477   一系列工作可以完成的很好 :) 好像把FLI或VIVO或MPEG-1视频放入(不是转换)到
478   一个AVI文件中!当然,只有<application>MPlayer</application>能播放这样的文
479   件:)并且也许它并没有生活上的实际价值。实际意义上:当只有音频流要被编码(
480   例如从无压缩的PCM到MP3)时,视频流才可能有用。
481 </para></listitem>
482 <listitem><para>
483   <emphasis role="bold">音频流</emphasis> (选项<option>-oac copy</option>):
484   直接的。你可能提取一个外部音频文件(MP3,WAV)并将其合成到一个输出媒体流里。
485   为此可使用<option>-audiofile <replaceable>文件名</replaceable></option>选项。
486 </para></listitem>
487 </itemizedlist>
489 <para>
490 使用<option>-oac copy</option>从一种容器格式复制到另一种容器格式时,你可能需要
491 使用<option>-fafmttag</option>选项以保持原始文件的音频格式标签。例如,如果你将
492 一个使用AAC音频的NSV文件转换到AVI容器中,音频格式文件标签可能是错误的,需要被
493 转换。对于详细的音频格式标签,查看<filename>codecs.conf</filename>。
494 </para>
496 <para>
497 例子:
498 <screen>
499 mencoder <replaceable>input.nsv</replaceable> -oac copy -fafmttag 0x706D \
500     -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -o <replaceable>output.avi</replaceable>
501 </screen>
502 </para>
503 </sect1>
506 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
509 <sect1 id="menc-feat-enc-images">
510 <title>从多个输入图像文件进行编码(JPEG, PNG, TGA等)</title>
512 <para>
513 <application>MEncoder</application>可以通过一个或多个JPEG, PNG, TGA, 或其
514 他图片文件制作电影。使用简单的桢复制,它能生成MJPEG (移动JPEG), MPNG
515 (移动PNG)或MTGA (移动TGA) 文件。
516 </para>
518 <orderedlist>
519 <title>进程描述:</title>
520 <listitem><para>
521   <application>MEncoder</application>使用<systemitem class="library">libjpeg</systemitem>
522   (当解码PNG时,它将使用<systemitem class="library">libpng</systemitem>)将输入图片进行
523   <emphasis>解码</emphasis>。
524 </para></listitem>
525 <listitem><para>
526   <application>MEncoder</application>然后将解码好的图片送到被选定的视频压缩器中
527   (DivX4, Xvid, FFmpeg msmpeg4等)。
528 </para></listitem>
529 </orderedlist>
531 <formalpara>
532 <title>例子</title>
533 <para>
534 关于<option>-mf</option>选项的解释在man页中。
536 <informalexample>
537 <para>
538 使用当前目录下所有JPEG文件生成MPEG-4文件。
539 <screen>
540 mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc \
541     -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o <replaceable>output.avi</replaceable>
542 </screen>
543 </para>
544 </informalexample>
546 <informalexample>
547 <para>
548 使用当前目录中的一些JPEG文件生成MPEG-4文件。
549 <screen>
550 mencoder mf://<replaceable>frame001.jpg,frame002.jpg</replaceable> -mf w=800:h=600:fps=25:type=jpg \
551     -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o <replaceable>output.avi</replaceable>
552 </screen>
553 </para>
554 </informalexample>
556 <informalexample>
557 <para>
558 使用显示指示的一系列JPEG文件生成MPEG-4文件(当前目录下的list.txt包含被用做源的文件列表,
559 一个一行):
560 <screen>
561 mencoder mf://<replaceable>@list.txt</replaceable> -mf w=800:h=600:fps=25:type=jpg \
562     -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o <replaceable>output.avi</replaceable>
563 </screen>
564 </para>
565 </informalexample>
567 <informalexample>
568 <para>
569 使用当前目录下所有JPEG文件生成移动JPEG(MJPEG)文件:
570 <screen>
571 mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc copy -oac copy -o <replaceable>output.avi</replaceable>
572 </screen>
573 </para>
574 </informalexample>
576 <informalexample>
577 <para>
578 使用当前目录下所有PNG文件生成未压缩的文件:
579 <screen>
580 mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc raw -oac copy -o <replaceable>output.avi</replaceable>
581 </screen>
582 </para>
583 </informalexample>
585 <note><para>
586 宽度必须是4的倍数,这是原始RGB AVI文件格式的限制。
587 </para></note>
589 <informalexample>
590 <para>
591 使用当前目录下所有PNG文件生成移动PNG (MPNG)文件:
592 <screen>
593 mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o <replaceable>output.avi</replaceable><!--
594 --></screen>
595 </para>
596 </informalexample>
598 <informalexample>
599 <para>
600 使用当前目录下的所有TGA文件生成移动TGA (MTGA)文件:
601 <screen>
602 mencoder mf://*.tga -mf w=800:h=600:fps=25:type=tga -ovc copy -oac copy -o <replaceable>output.avi</replaceable><!--
603 --></screen>
604 </para>
605 </informalexample>
606 </para>
607 </formalpara>
608 </sect1>
611 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
614 <sect1 id="menc-feat-extractsub">
615 <title>将DVD子标题提取到VOBsub文件</title>
617 <para>
618 <application>MEncoder</application>能将DVD子标题提取到VOBsub格式的文件中。
619 它们是一对由<filename>.idx</filename>及<filename>.sub</filename>结尾的文件
620 组成。并且经常被压缩成一个<filename>.rar</filename>文件。
621 <application>MPlayer</application>可通过
622 <option>-vobsub</option>及<option>-vobsubid</option>选项播放这些文件。
623 </para>
625 <para>
626 你可以通过<option>-vobsubout</option>指定输出文件的基础名(例如不包括
627 <filename>.idx</filename>或<filename>.sub</filename>后缀),对于生成文件
628 子标题的索引使用<option>-vobsuboutindex</option>。
629 </para>
631 <para>
632 如果不是从DVD输入,你应该使用<option>-ifo</option>来表明构建
633 生成的<filename>.idx</filename>文件所需的<filename>.ifo</filename>文件。
634 </para>
636 <para>
637 如果输入不是DVD并且你没有<filename>.ifo</filename>文件,你需使用
638 <option>-vobsubid</option>选项以使其知道放入<filename>.idx</filename>
639 文件的语言标识。
640 </para>
642 <para>
643 如果<filename>.sub</filename>及<filename>.idx</filename>文件存在,每次
644 执行都回添加子标题。所以你再开始前需要手动清除这些文件。
645 </para>
647 <example id="copying_two_subtitles_from_a_dvd_while_doing_two_pass_encoding">
648 <title>在做双通道编码时从DVD复制子标题</title>
649 <screen>
650 rm <replaceable>subtitles.idx</replaceable> <replaceable>subtitles.sub</replaceable>
651 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 \
652     -vobsubout <replaceable>subtitles</replaceable> -vobsuboutindex 0 -sid 2
653 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vpass=2 \
654     -vobsubout <replaceable>subtitles</replaceable> -vobsuboutindex 1 -sid 5<!--
655 --></screen>
656 </example>
658 <example id="copying_a_french_subtitle_from_an_mpeg_file">
659 <title>从一个MPEG文件复制法文子标题</title>
660 <screen>
661 rm <replaceable>subtitles.idx</replaceable> <replaceable>subtitles.sub</replaceable>
662 mencoder <replaceable>movie.mpg</replaceable> -ifo <replaceable>movie.ifo</replaceable> -vobsubout <replaceable>subtitles</replaceable> -vobsuboutindex 0 \
663     -vobsuboutid fr -sid 1 -nosound -ovc copy
664 </screen>
665 </example>
666 </sect1>
669 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
672 <sect1 id="aspect">
673 <title>保持视频画面比例</title>
674 <para>
675 DVD及SVCD(例如MPEG-1/2)文件包含画面比例,此信息可用来指示播放器应如何显示视频流,
676 所以显示的人不会有个鸡蛋头(例如480x480 + 4:3 = 640x480)。然而当编码为AVI(DivX)
677 文件时,你要小心AVI头信息里没有包含这些值。重新设置这些比例是非常讨厌并且很花时间,
678 应该有更好的方法!
679 </para>
681 <para>还有</para>
683 <para>
684 MPEG-4有个独特的特点:视频流可以包含它需要的画面比例。是的,正像MPEG-1/2 (DVD,
685 SVCD)及H.263文件一样。可惜的是,除了<application>MPlayer</application>几乎没有播放器
686 支持这项MPEG-4属性。
687 </para>
689 <para>
690 这种特性之可以与
691 <systemitem class="library">libavcodec</systemitem>的
692 <systemitem>mpeg4</systemitem>编码器一同使用。记住:虽然
693 <application>MPlayer</application>可以正常播放所生成的文件,其他播放器可能使用错误
694 的图象比例。
695 </para>
697 <para>
698 你应剪切电影图像上下方的黑条。针对<systemitem>cropdetect</systemitem>及
699 <systemitem>crop</systemitem>滤镜的用法参考man页。
700 </para>
702 <para>
703 用法
704 <screen>mencoder <replaceable>sample-svcd.mpg</replaceable> -vf crop=714:548:0:14 -oac copy -ovc lavc \
705     -lavcopts vcodec=mpeg4:mbd=2:trell:autoaspect -o <replaceable>output.avi</replaceable></screen>
706 </para>
707 </sect1>
709 </chapter>