summaryrefslogtreecommitdiffstats
path: root/DOCS/xml/zh_CN/mencoder.xml
blob: bc443a55f861fab6773b4b04cf055ecf0a46d499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<?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编码为VBR,ABR或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 -lavcopts 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>):
  直接的。你可能提取一个外部音频文件(MP3,WAV)并将其合成到一个输出媒体流里。
  为此可使用<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文件生成移动JPEG(MJPEG)文件:
<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>