annotate DOCS/zh/encoding.html @ 17974:9a5a62f480e6

Rename the default GUI skins directory from 'Skin' to 'skins', keeping backwards compatibility.
author diego
date Mon, 27 Mar 2006 11:39:27 +0000
parents a5785a0b9ee1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
2 <HTML>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
3
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
4 <HEAD>
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
5 <TITLE>编码 -- MEncoder -- Linux下的电影编码器</TITLE>
9512
883f38591d47 now all translations link to ../default.css
gabucino
parents: 9332
diff changeset
6 <LINK REL="stylesheet" TYPE="text/css" HREF="../default.css">
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
7 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gbk">
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
8 </HEAD>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
9
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
10 <BODY>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
11
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
12
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
13 <H1><A NAME="encoding">7. 用MEncoder编码</A></H1>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
14
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
15 <P>MEncoder的全部可用选项和示例请看man page。一些实用的例子和对一些编码参数的详尽的解释请看从<A
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
16 HREF="http://mplayerhq.hu/mailman/listinfo/mplayer-users">mplayer-users</A>邮件列表中搜集来的<A
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
17 HREF="../tech/encoding-tips.txt">编码技巧</A>。搜索<A HREF="http://mplayerhq.hu/pipermail/mplayer-users/">邮件
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
18 文档</A>可以找到用MEncoder编码的各方面以及所遇到问题的丰富的讨论。</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
19
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
20
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
21 <H4><A NAME="2pass">7.1 2或者3-pass的MPEG-4("DivX")编码</A></H4>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
22
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
23 <P><U><B>2-pass编码:</B></U>名称来自这种方法实际把文件编码<I>两次</I>的事实。第一次编码(又称为<I>pass</I>)创建一些临时性的几兆的文件(*.log),
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
24 先不要删除他们(你可以把AVI删了)。在第二次编码中,将使用临时文件的比特率数据创建输出文件,最后产生的文件将有好得多的图象质量。如果这是你第一次听到这个,
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
25 你应该在网上查阅一些可用的指南。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
26
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
27 <P>这个例子演示如何把DVD编码成为2-pass的MPEG-4("DIVX")的AVI。只需要两个命令:<BR>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
28 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;rm frameno.avi</CODE> -- 删掉这个文件,它可能来自以前的3-pass编码(它会干扰当前编码)<BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
29 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder dvd://2 -ovc lavc -lavcopts
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
30 vcodec=mpeg4:vpass=1 -oac copy -o movie.avi<BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
31 &nbsp;&nbsp;&nbsp;&nbsp;mencoder dvd://2 -ovc lavc -lavcopts
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
32 vcodec=mpeg4:vpass=2 -oac copy -o movie.avi</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
33
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
34 <P><U><B>3-pass编码:</B></U>这是2-pass编码的扩展,对音频的编码使用一个单独的编码。这种方法提供推荐视频比特率的估计以使之能够适合CD的容量。同时,
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
35 不同于2-pass方式,音频仅仅被编码一次。操作列表:</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
36
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
37 <OL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
38 <LI>删除冲突的临时性的文件:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
39 <P><CODE>rm frameno.avi</CODE></P></LI>
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
40 <LI>第一次编码:
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
41 <P><CODE>mencoder &lt;file/DVD&gt; -ovc frameno -oac mp3lame -lameopts vbr=3 -o frameno.avi</CODE></P> <P>将创建一个只有音频的avi文件,<B>只</B>包含要求的音频流。不要忘记<CODE>-lameopts</CODE>,如果需要的话设置它。如果你对一部长的电影进行编码,
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
42 MEncoder在这个pass结束之后,将对于650Mb,700Mb,和800Mb的目标大小打印推荐的比特率值。</P></LI>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
43 <LI>第二次编码:
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
44 <P><CODE>mencoder &lt;file/DVD&gt; -oac copy
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
45 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=&lt;bitrate&gt;</CODE></P>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
46 <P>这是第一次视频编码。可以选择指定在上一步结束时MEncoder打印的视频比特率。</P></LI>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
47 <LI>第三次pass:
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
48 <P><CODE>mencoder &lt;file/DVD&gt; -oac copy
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
49 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=&lt;bitrate&gt;</CODE></P>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
50 <P>这是第二次视频编码。指定跟上一次编码一样的比特率除非你真的知道自己在干什么。在这次编码中,用<CODE>frameno.avi</CODE>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
51 中的音频将被插入到目的文件中..这就全部搞定了!</P></LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
52 </OL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
53
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
54 <H4>3-pass编码的例子:</H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
55
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
56 <P><CODE>&nbsp;&nbsp;&nbsp;&nbsp;rm frameno.avi</CODE> -- 移去这个文件,它可能来自以前的3-pass编码(它会干扰当前编码)<BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
57 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder dvd://2 -ovc frameno
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
58 -o frameno.avi -oac mp3lame -lameopts vbr=3<BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
59 &nbsp;&nbsp;&nbsp;&nbsp;mencoder dvd://2 -ovc lavc
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
60 -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o movie.avi<BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
61 &nbsp;&nbsp;&nbsp;&nbsp;mencoder dvd://2 -ovc lavc
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
62 -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o movie.avi</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
63
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
64 <H2><A NAME="mpeg">7.2 编码为MPEG格式</A></H2>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
65
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
66 <P>MEncoder可以生成MPEG(MPEG-PS)格式的输出文件。它们可能只能用于libavcodec的<I>mpeg1video</I>编解码器,因为一般播放器 -
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
67 - 除了MPlayer -- 认为MPEG文件中包含的是MPEG1视频流和MPEG1 layer 2(MP2)音频流。</P>
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
68
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
69 <P>这个特性目前来说没有什么用处,而且可能还有很多bug,其重要性在于目前MEncoder无法编码MPEG1 layer 2 (MP2)的音频,而它正是别的播放
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
70 器认为MPEG文件中应该有的。</P>
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
71
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
72 <P>要改变MEncoder的输出文件格式,可以使用<CODE>-of mpeg</CODE>选项。</P>
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
73
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
74 <P>示例:<BR>
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
75 &nbsp;&nbsp;<CODE>mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
76 -oac copy &lt;other options&gt; media.avi -o output.mpg</CODE></P>
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
77
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
78
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
79 <H2><A NAME="rescaling">7.3 电影再缩放</A></H2>
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
80
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
81 <P>把电影图象的尺寸重新设置的需要经常出现。原因可能很多,例如减小输出文件的大小,网络带宽等等,很多人甚至再把DVD或SVCD编码为到DivX
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
82 的AVI的时候也重新缩放,<B>这是错误的</B>。在这么做之前,请先阅读<A HREF="#aspect">保持屏幕高宽比</A>部分。</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
83
9644
0fe056bdb135 vop -> vf change, small fixes. The Polish documentation should be checked for correctness.
jonas
parents: 9614
diff changeset
84 <P>缩放过程由<I>'scale'</I>视频滤镜处理:<CODE>-vf scale=width:height</CODE>。其质量由<CODE>-sws</CODE>选项控制。如果它没有指定,
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
85 MEncoder将使用0:快速二次线性缩放。</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
86
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
87 <H4>用法:</H4>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
88 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder sample-svcd.mpg -lavcopts
9644
0fe056bdb135 vop -> vf change, small fixes. The Polish documentation should be checked for correctness.
jonas
parents: 9614
diff changeset
89 vcodec=mpeg4:more_options -vf scale=640:480 -sws 2 -o
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
90 output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
91
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
92
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
93 <H2><A NAME="copying">7.4 流复制</A></H2>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
94
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
95 <P>MEncoder能用两种方式处理输入流:<B>编码</B>或者<B>复制</B>他们。这部分是关于<B>复制</B>的。</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
96
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
97 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
98 <LI><B>视频流</B>(<CODE>-ovc copy</CODE>选项): 可以干的很好:)<BR>
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
99 比如,把FLI或者VIVO或者MPEG1的视频放(不是转化)到AVI文件中。当然只有MPlayer能播放这样的文件:)。而且可能在现实生活中没有任何价值。
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
100 合理使用:比如视频流复制可以用于只有音频流需要被编码的情况(比如,从非压缩的PCM编码为MP3)。</LI>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
101
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
102 <LI><B>音频流</B>(<CODE>-oac copy</CODE>选项): 直接了当。可以把一个外部音频文件(MP3,Vorbis)合波到输出流中。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
103 使用<CODE>-audiofile &lt;filename&gt;</CODE>选择来实现这个功能。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
104 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
105
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
106
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
107 <H2><A NAME="fixing">7.5 修复索引或者交错损坏的AVI </A></H2>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
108
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
109 <P>最容易的事情。我们简单地复制视频和音频流,并用MEncoder产生索引。当然这不能修复视频和/或者音频流中可能的错误。
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
110 这同样也可以修复交错损坏的文件,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
111 使它们不再需要<CODE>-ni</CODE>选项。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
112
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
113 <P>命令:<CODE>mencoder -idx input.avi -ovc copy -oac copy -o output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
114
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
115 <H3><A NAME="appending">7.5.1 合并多个AVI文件</A></H3>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
116
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
117 <P>作为副产品,修复损坏的AVI文件的功能使MEncoder可以用来修复两个或多个AVI文件合并生成的文件:</P>
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
118
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
119 <P>命令:<CODE>cat 1.avi 2.avi | mencoder -noidx -ovc copy -oac copy -o output.avi -</CODE></P>
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
120
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
121 <P><B>注意:</B>这要求<CODE>1.avi</CODE>和<CODE>2.avi</CODE>使用同样的编解码器,分辨率,流速率
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
122 等等,并且至少1.avi不是损坏的。你可能需要先修复你的AVI输入文件,按照<A HREF="#fixing">上面</A>所说的方法。</P>
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
123
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
124
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
125 <H2><A NAME="libavcodec">7.6 用libavcodec编解码器族编码</A></H2>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
126
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
127 <P><A HREF="codecs.html#libavcodec">libavcodec</A>提供简单编码许多有趣的视频和音频格式(目前其音频编码器还不支持)的方法。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
128 你能编码下列的编码格式:</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
129
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
130 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
131 <LI>mjpeg -- Motion JPEG</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
132 <LI>h263 -- H263</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
133 <LI>h263p -- H263 Plus</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
134 <LI>mpeg4 -- DivX4</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
135 <LI>msmpeg4 -- 老的DivX</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
136 <LI>msmpeg4v2 -- Micro$oft MPEG4 V2 (DivX的又称为MP43的前辈)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
137 <LI>rv10 -- 老的RealVideo编码格式</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
138 <LI>mpeg1video -- MPEG1视频:)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
139 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
140
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
141 <P>第一栏是应该在<CODE>vcodec</CODE>选项里设置的编码格式的名称,比如:<CODE>-lavcopts vcodec=msmpeg4</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
142
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
143 <P>例如,对于使用MJPEG压缩:<BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
144 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder dvd://2 -o title2.avi -ovc lavc
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
145 -lavcopts vcodec=mjpeg -oac copy</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
146
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
147
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
148 <H2><A NAME="image_files">7.7 用输入的多幅图象文件(JPEG,PNG或TGA)进行编码</A></H2>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
149
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
150 <P>MEncoder具有从一个或多个JPEG,PNG或TGA文件创建电影的能力。通过简单的framecopy它能创建MJPEG(Motion JPEG),
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
151 MPNG(Motion PNG )或MTGA(Motion TGA)文件。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
152
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
153 处理过程的解释:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
154
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
155 <OL>
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
156 <LI>MEncoder使用<CODE>libjpeg</CODE><I>解码</I>输入图像(当解码PNG时将使用<B>libpng</B>)。</LI>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
157
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
158 <LI>MEncoder接着把解码后的图象喂给所选的的视频压缩器(DivX4,Xvid,ffmpeg msmpeg4等等)。</LI>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
159 </OL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
160
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
161 <H4>例子</H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
162
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
163 <P><CODE>-mf</CODE>选项的解释能在man page中找到。</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
164
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
165 <P><I>用当前目录中的所有JPEG文件创建DivX4文件:</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
166 &nbsp;&nbsp;<CODE>mencoder \*.jpg -mf on:w=800:h=600:fps=25 -ovc divx4 -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
167 output.avi</CODE></P></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
168
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
169 <P><I>用当前目录中的一些JPEG文件创建DivX4文件:</I><BR>
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
170 &nbsp;&nbsp;<CODE>mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi \*.jpg</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
171
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
172 <P><I>用当前目录中的所有JPEG文件创建Motion JPEG(MJPEG)文件:</I><BR>
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
173 &nbsp;&nbsp;<CODE>mencoder -mf on:w=800:h=600:fps=25 -ovc copy -o output.avi \*.jpg</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
174
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
175 <P><I>用当前目录中的所有PNG文件创建一个非压缩的文件:</I><BR>
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
176 &nbsp;&nbsp;<CODE>mencoder -mf on:w=800:h=600:fps=25:type=png -ovc rawrgb -o output.avi \*.png</CODE></P>
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
177
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
178 <P><B>注意:</B>宽度必须是4的整数倍,这是RAW RGB AVI格式的一个限制。</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
179
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
180 <P><I>用当前目录中的所有PNG文件创建Motion PNG(MPNG)文件:</I><BR>
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
181 &nbsp;&nbsp;<CODE>mencoder -mf on:w=800:h=600:fps=25:type=png -ovc copy -o output.avi \*.png</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
182
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
183 <P><I>用当前目录中的所有TGA文件创建Motion TGA(MTGA)文件:</I><BR>
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
184 &nbsp;&nbsp;<CODE>mencoder -mf on:w=800:h=600:fps=25:type=tga -ovc copy -o output.avi \*.tga</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
185
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
186
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
187 <H2><A NAME="vobsub">7.8 将DVD字幕提取为Vobsub文件</A></H4>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
188
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
189 <P>MEncoder有把DVD字幕提取到Vobsub格式的文件的能力。包括以<CODE>.idx</CODE>和<CODE>.sub</CODE>结尾的一对
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
190 文件而且通常打包在一个单一的<CODE>.rar</CODE>文档中。MPlayer能使用<CODE>-vobsub</CODE>和<CODE>-vobsubid</CODE>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
191 选项播放它们。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
192
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
193 <P>你使用<CODE>-vobsubout</CODE>选项规定输出文件的基名称(就是不包括<CODE>.idx</CODE>或者<CODE>.sub</CODE>的后缀)和
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
194 <CODE>-vobsuboutindex</CODE>指定字幕在输出文件中的索引号。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
195
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
196 <P>如果输入不是来自DVD你必须使用<CODE>-ifo</CODE>来指明构造<CODE>.idx</CODE>文件需要的<CODE>.ifo</CODE>文件。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
197
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
198 <P>如果输入不是来自DVD而且你也没有<CODE>.ifo</CODE>文件你将需要使用<CODE>-vobsubid</CODE>选项让它了解在<CODE>.idx</CODE>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
199 文件中放置什么样的language id。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
200
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
201 <P>如果<CODE>.idx</CODE>和<CODE>.sub</CODE>文件已经存在,每次运行将追加运行获得的字幕。因此,你应该在开始之前删掉所有东西。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
202
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
203 <H4>例子</H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
204
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
205 <P><I>在进行3-pass编码的同时从DVD复制两份字幕</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
206 &nbsp;&nbsp;<CODE>rm subtitles.idx subtitles.sub</CODE><BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
207 &nbsp;&nbsp;<CODE>mencoder dvd://1 -vobsubout subtitles -vobsuboutindex 0
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
208 -sid 2 -o frameno.avi -ovc frameno</CODE><BR>
10405
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
209 &nbsp;&nbsp;<CODE>mencoder dvd://1 -oac copy -ovc divx4 -pass 1</CODE><BR>
a5785a0b9ee1 -dvd -> dvd:// and -vcd -> vcd://
jonas
parents: 9644
diff changeset
210 &nbsp;&nbsp;<CODE>mencoder dvd://1 -oac copy -ovc divx4 -pass 2 -vobsubout
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
211 subtitles -vobsuboutindex 1 -sid 5</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
212
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
213 <P><I>从一个MPEG文件中复制法语字幕</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
214 &nbsp;&nbsp;<CODE>rm subtitles.idx subtitles.sub</CODE><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
215 &nbsp;&nbsp;<CODE>mencoder movie.mpg -ifo movie.ifo -vobsubout subtitles
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
216 -vobsuboutindex 0 -vobsuboutid fr -sid 1</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
217
9268
a76b8962c0bd Sync by Lu Ran <hephooey@fastmail.fm>.
diego
parents: 9080
diff changeset
218 <H2><A NAME="aspect">7.9 保持屏幕高宽比</A></H2>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
219
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
220 <P>DVD和SVCD(也就是MPEG1/2)文件通常包含屏幕高宽比的值,它描述播放器如何正确缩放视频流,保证人不会长鸡蛋脑袋
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
221 (ex.: 480x480 + 4:3 = 640x480)。但当编码成AVI(DivX)文件时,你必须清醒的认识到AVI的文件头中没有储存这个数据。重新缩放电影
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
222 是令人厌恶的而且消耗时间。必须有一个更好的特性!</P>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
223
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
224 <P>下面就是。</P>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
225
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
226 <P>MPEG4有一个特性:视频流可以包含它所需要的屏幕高宽比,没错,就跟MPEG1/2文件(DVD, SVCD)一样。遗憾的是,除了MPlayer
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
227 之外<U>没有</U>视频播放器支持这个特性。</P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
228
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
229 <P>这个特性只能用于<B>libavcodec</B>的<CODE>mpeg4</CODE>编解码器。牢牢记住这一点:尽管MPlayer能正确播放所创建的文件。
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
230 别的播放器还会使用错误的屏幕高宽比。</P>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
231
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
232 <P>你应该认真的把电影上下的黑边切掉。看man page了解<CODE>cropdetect</CODE>和<CODE>crop</CODE>滤镜的使用。</P>
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
233
9614
05b3a03fdd8f Sync by <hephooey@fastmail.fm>.
diego
parents: 9512
diff changeset
234 <H4>用法:</H4>
9080
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
235
e7aad3a3bb7c sync by <hephooey@fastmail.fm>
diego
parents: 7597
diff changeset
236 <P><CODE>$ mencoder sample-svcd.mpg -ovc lavc -lavcopts
9644
0fe056bdb135 vop -> vf change, small fixes. The Polish documentation should be checked for correctness.
jonas
parents: 9614
diff changeset
237 vcodec=mpeg4:aspect=16.0/9.0 -vf crop=714:548:0:14 -oac copy -o output.avi</CODE></P>
7597
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
238
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
239 </BODY>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
240 </HTML>