annotate DOCS/Chinese/encoding.html @ 8335:0e1d45e44813

set channel count to a saner value if the card reports an unknown audio mode
author henry
date Tue, 03 Dec 2002 13:24:10 +0000
parents 363959276ef2
children e7aad3a3bb7c
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>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
5 <TITLE>编码 -- MEncoder -- Linux的电影编码器</TITLE>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
6 <LINK REL="stylesheet" TYPE="text/css" HREF="default.css">
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
7 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb_2312-80">
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
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
13 <H2><A NAME="encoding">2.4 用MEncoder编码</A></H2>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
14
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
15 <P><B>MEncoder</B>(<B>MPlayer</B>的电影编码器)是一个简单的电影编码器,设计用来把MPlayer可播放的电影(<B>AVI/ASF/OGG/DVD/VCD/VOB/MPG/MOV/
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
16 VIV/FLI/RM/NUV/NET</B>)编码成其它MPlayer可播放的格式(见下面)。它能以各种各样的编码格式进行编码,像<B>DivX4</B>(1或者2 pass),libavcodec,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
17 <B>PCM</B>/<B>MP3</B>/<B>VBR MP3</B>音频。同时也有强大的插件系统来操控视频。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
18
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
19
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
20 <H3><A NAME="compilation">2.4.1 编缉</A></H3>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
21
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
22 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
23 <LI><B>可选</B> -- 阅读<B>MPlayer</B>的编缉指令。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
24 <LI><B>可选(Linux仅仅)</B> -- 从<A HREF="http://avifile.sourceforge.net/download.htm">avifile.sourceforge.net</A>下载最新<B>DivX4linux</B>的库,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
25 并且正确的安装他们。你需要他们如果你希望使用DivX4(1/2 passes)编码。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
26 <LI><B>可选</B> -- <A HREF="codecs.html#xvid">下载并且安装<B>XViD</B></A>。不是十分有用,libavcodec的<I>mpeg4</I>编码器能以比XViD
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
27 或者DivX4/5好得多的速度和质量编码。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
28 <LI><B>可选</B> -- 对于libavcodec支持,按<A HREF="codecs.html#libavcodec">libavcodec部分</A>的内容安装libavcodec。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
29 <LI><B>可选</B> -- 下载并且编译<B>libmp3lame</B>(lame 3.89beta或者lame的CVS中的)。<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
30 <B>警告:不要用<U>GCC 2.96</U>编辑LAME &lt; 3.90! 它将不能正常工作!</B><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
31 这对于CBR/VBR MP3音频编码的是需要的。注意,单一<CODE>lame</CODE>的二进制文件是不够的。顺便说一下:你对lame使用的优化越少,质量越好。lame编译完成之后,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
32 你能通过运行<CODE>make test</CODE>来测试质量。结果的数字应该少于<B>30</B>。如果它是<B>400</B>之类也不必惊慌,你不应该听到任何可觉察的质量降低。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
33 啊,如果你的编译程序连<CODE>make test</CODE>都运行不了...好吧,把那个<B>GCC 2.96</B>删掉或者把lame升级到至少<B>3.90</B>。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
34 <LI><B>可选</B> -- <CODE>libjpeg</CODE>和<CODE>libpng</CODE>,-- 如同<A HREF="documentation.html#installation">安装</A>部分中所说的</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
35 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
36
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
37 <P>准备完毕。正如你可能知道的,其它编码的工具需要安装<I>avifile</I>的库。<B>MEncoder</B>根本不需要。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
38
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
39
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
40 <H3><A NAME="features">2.4.2 MEncoder特性</A></H3>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
41
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
42 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
43 <LI>在<B>MPlayer</B>支持的广泛的文件格式和译码器中编码</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
44 <LI>编码所有ffmpeg的<A HREF="codecs.html#libavcodec">libavcodec</A>的编码格式</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
45 <LI>从<B>V4L兼容的电视选台器</B>编码视频</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
46 <LI>编码/复用有适当索引的交错的AVI文件</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
47 <LI>从外部音频流创建文件</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
48 <LI>1,2或者3 pass编码</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
49 <LI><B>VBR</B> MP3音频 -- <B>重要的注意事项:</B>VBR MP3的音频在Windows的播放器上播放的效果并不总是很好!另一方面,目前<B>MEncoder</B>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
50 的CBR编码在Win32播放器上完全不能播放:)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
51 <LI>PCM音频</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
52 <LI>流复制</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
53 <LI>输入A/V同步(基于PTS,用-mc 0选项禁用)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
54 <LI>用<CODE>-ofps</CODE>选项进行FPS修正(用于把29.97fps的VOB编码成为24fps的AVI)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
55 <LI>使用我们的十分强大的插件系统(裁减,扩展,翻转,后处理,旋转,缩放,rgb/yuv转化)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
56 <LI>能把DVD与VOBsub<B>和</B>文本字幕编码到输出文件中</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
57 <LI>能把DVD的字幕提取为Vobsub格式</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
58 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
59
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
60 <H4>计划中的特性:</H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
61
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
62 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
63 <LI>更加广泛的可用的编/解码格式/解码器(用DivX4/Indeo5/VIVO流创建VOB文件 :)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
64 <LI>v4l的音频编码(FreeBSD已完成?)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
65 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
66
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
67
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
68 <H4><A NAME="2pass">2.4.2.1 编码2或者3-pass的DivX4</A></H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
69
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
70 <P><U><B>2-pass编码:</B></U>名称来自这种方法实际把文件编码<I>两次</I>的事实。第一次编码(又称为<I>pass</I>)创建一些临时性的几兆的文件(*.log),
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
71 先不要删除他们(你可以把AVI删了)。在第二次pass中,将使用临时文件的比特率数据创建输出文件,最后产生的文件将有好得多的图象质量。如果这是你第一次听到这个,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
72 你应该在网上查阅一些可用的指南。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
73
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
74 <P>这个例子演示如何把DVD编码成为2-pass DivX4 AVI。只需要两个命令:<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
75 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;rm frameno.avi</CODE> -- 删掉这个文件,它可能来自以前的3-pass编码(它会干扰当前这个)<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
76 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder -dvd 2 -lavcopts
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
77 -vcodec=mpeg4:more_options -o movie.avi -pass 1<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
78 &nbsp;&nbsp;&nbsp;&nbsp;mencoder -dvd 2 -lavcopts vcodec=mpeg4:more_options
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
79 -o movie.avi -pass 2</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
80
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
81 <P><U><B>3-pass编码:</B></U>这是2-pass编码的扩展,对音频的编码使用一个单独的pass。这种方法提供推荐视频比特率的估计以使之能够适合CD的容量。同时,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
82 不同于2-pass方式,音频仅仅被编码一次。示例:</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
83
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
84 <OL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
85 <LI>删除冲突的临时性的文件:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
86 <P><CODE>rm frameno.avi</CODE></P></LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
87 <LI>第一次pass:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
88 <P><CODE>mencoder &lt;file/DVD&gt; -ovc frameno -o frameno.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
89 <P>将创建一个只有音频的avi文件,<B>只</B>包含要求的音频流。不要忘记<CODE>-lameopts</CODE>,如果需要的话设置它。如果你对一部长的电影进行编码,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
90 <B>MEncoder</B>在这个pass结束之后,将对于650Mb,700Mb,和800Mb的目标大小打印推荐的比特率值。</P></LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
91 <LI>第二次pass:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
92 <P><CODE>mencoder &lt;file/DVD&gt; -oac copy -pass 1
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
93 -ovc divx4 -divx4opts br=&lt;bitrate&gt;</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
94 <P>又称为DivX4视频编码的第一次pass。可以选择指定在上一步结束时<B>MEncoder</B>打印的视频比特率。</P></LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
95 <LI>第三次pass:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
96 <P><CODE>mencoder &lt;file/DVD&gt; -oac copy -pass 2
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
97 -ovc divx4 -divx4opts br=&lt;bitrate&gt;</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
98 <P>又称为DivX4视频编码的第二次pass。可以选择指定在上一步结束时<B>MEncoder</B>打印的视频比特率。在这次pass中,用<CODE>frameno.avi</CODE>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
99 中的音频将被插入到目的文件中..这就全部搞定了!</P></LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
100 </OL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
101
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
102 <H4>3-pass编码的例子:</H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
103
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
104 <P><CODE>&nbsp;&nbsp;&nbsp;&nbsp;rm frameno.avi</CODE> -- 移去这个文件,它可能来自以前的3-pass编码(它会干扰当前这个)<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
105 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder -dvd 2 -ovc frameno
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
106 -o frameno.avi<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
107 &nbsp;&nbsp;&nbsp;&nbsp;mencoder -dvd 2
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
108 -lavcopts vcodec=mpeg4:more_options -oac copy -o movie.avi -pass 1<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
109 &nbsp;&nbsp;&nbsp;&nbsp;mencoder -dvd 2
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
110 -lavcopts vcodec=mpeg4:more_options -oac copy -o movie.avi -pass 2</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
111
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
112 <P><U><B>使用内部的libavcodec控制器的2或者3-pass编码:</B></U>你可以选择使用libavcodec内部的2或者3-pass方式,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
113 它在使用libavcodec时可能能提供比使用外部的DivX4制作的2-pass控制器更好的最终比特率的精确度。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
114
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
115 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
116 <LI><B>2-pass编码:</B><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
117 <CODE>rm -f lavc_stats.txt<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
118 mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 (audio-options) -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
119 movie.avi<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
120 mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 (audio-options) -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
121 movie.avi</CODE></LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
122 <LI><B>3-pass编码:</B><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
123 <CODE>rm -f frameno.avi lavc_stats.txt<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
124 mencoder -dvd 2 -ovc frameno (audio-options) -o frameno.avi<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
125 mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
126 movie.avi<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
127 mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
128 movie.avi</CODE></LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
129 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
130
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
131
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
132 <H4><A NAME="rescaling">2.4.2.2 重新缩放电影</A></H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
133
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
134 <P>把电影图象的尺寸重新设置的需要经常出现。原因可能很多,例如减小输出文件的大小,把SVCD编码为到DivX。提取的DVD多半需要重新缩放,例如一个4:3的
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
135 DVD应该是640x480,当你希望它合适1张CD,并且同时还有不错的质量的时候。SVCD是480x480的尺寸,而他们的头部包含播放器应该使用的长宽比(例如:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
136 480x480 + 4:3 = 640x480)。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
137 然而当编码成为AVI(DivX)文件时,你必须了解AVI的头部不存储这个值。这样,唯一的解决方法是重新缩放。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
138
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
139 <P>缩放过程由<I>'scale'</I>视频滤镜处理:<CODE>-vop scale=X:Y</CODE>。其质量由<CODE>-sws</CODE>选项控制。如果它没有指定,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
140 <B>MEncoder</B>将使用0:快速二次线性。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
141
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
142 <P>用法:<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
143 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder sample-svcd.mpg -lavcopts
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
144 vcodec=mpeg4:more_options -vop scale=640:480 -sws 2 -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
145 output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
146
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
147
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
148 <H4><A NAME="copying">2.4.2.3 流复制</A></H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
149
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
150 <P><B>MEncoder</B>能用两种方式处理输入流:<B>编码</B>或者<B>复制</B>他们。这部分是关于<B>复制</B>的。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
151
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
152 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
153 <LI><B>视频流</B>(<CODE>-ovc copy</CODE>选项): 可以干的很好:)<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
154 比如,把FLI或者VIVO或者MPEG1的视频放(不是转化)到AVI文件中。当然只有<B>MPlayer</B>能播放这样的文件:)。而且可能在现实生活中没有任何价值。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
155 合理使用:视频流复制可以用于例如只有音频流需要被编码(比如,非压缩的PCM到MP3)时。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
156
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
157 <LI><B>音频流</B>(<CODE>-oac copy</CODE>选项): 直接了当。可以把一个外部音频文件(MP3,Vorbis)合波到输出流中。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
158 使用<CODE>-audiofile &lt;filename&gt;</CODE>选择来实现这个功能。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
159 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
160
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
161
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
162 <H4><A NAME="fixing">2.4.2.4 修复索引或者交错损坏的AVI </A></H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
163
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
164 <P>最容易的事情。我们简单地复制视频和音频流,并用<B>MEncoder</B>产生索引。当然这不能修复视频和/或者音频流中可能的错误。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
165 这同样也可以修复交错损坏的文件,
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
166 使它们不再需要<CODE>-ni</CODE>选项。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
167
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
168 <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
169
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
170
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
171 <H4><A NAME="libavcodec">2.4.2.5 用libavcodec编码器族编码</A></H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
172
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
173 <P><A HREF="codecs.html#libavcodec">libavcodec</A>提供简单编码许多有趣的视频和音频格式(目前其音频编码器还不支持)的方法。
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
174 你能编码下列的编码格式:</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
175
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
176 <UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
177 <LI>mjpeg -- Motion JPEG</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
178 <LI>h263 -- H263</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
179 <LI>h263p -- H263 Plus</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
180 <LI>mpeg4 -- DivX4</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
181 <LI>msmpeg4 -- 老的DivX</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
182 <LI>msmpeg4v2 -- Micro$oft MPEG4 V2 (DivX的又称为MP43的前辈)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
183 <LI>rv10 -- 老的RealVideo编码格式</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
184 <LI>mpeg1video -- MPEG1视频:)</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
185 </UL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
186
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
187 <P>第一个列包含应该传给<CODE>vcodec</CODE>配置的编码格式的名称,比如:<CODE>-lavcopts vcodec=msmpeg4</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
188
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
189 <P>例如,对于使用MJPEG压缩:<BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
190 <CODE>&nbsp;&nbsp;&nbsp;&nbsp;mencoder -dvd 2 -o title2.avi -ovc lavc
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
191 -lavcopts vcodec=mjpeg</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
192
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
193
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
194 <H4><A NAME="image_files">2.4.2.6 从多个图象文件(JPEG,PNG或TGA)的输入编码</A></H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
195
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
196 <P><B>MEncoder</B>具有从一个或多个JPEG,PNG或TGA文件创建电影的能力。通过简单的framecopy它能创建MJPEG(Motion JPEG),
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
197 MPNG(Motion PNG )或MTGA(Motion TGA)文件。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
198
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
199 处理过程的解释:
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
200
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
201 <OL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
202 <LI><B>MEncoder</B>使用<CODE>libjpeg</CODE><I>解码</I>输入图像(当解码PNG时将使用<B>libpng</B>)。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
203
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
204 <LI><B>MEncoder</B>接着把解码后的图象喂给所选的的视频压缩器(DivX4,Xvid,ffmpeg msmpeg4等等)。注意因为PNG解码器
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
205 目前只能输出RGB格式,所以不能用于要求YUV输入的编码格式,像DivX4或者ffmpeg的msmpeg4之类。</LI>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
206 </OL>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
207
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
208 <H4>例子</H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
209
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
210 <P><CODE>-mf</CODE>选项的解释能在全局<A HREF="#options">选项</A>部分和manpage中被找到。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
211
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
212 <P><I>用当前目录中的所有JPEG文件创建DivX4文件:</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
213 &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
214 output.avi</CODE></P></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
215
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
216 <P><I>用当前目录中的一些JPEG文件创建DivX4文件:</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
217 &nbsp;&nbsp;<CODE>mencoder frame001.jpg,frame002.jpg -mf on:w=800:h=600:fps=25 -ovc divx4 -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
218 output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
219
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
220 <P><I>用当前目录中的所有JPEG文件创建Motion JPEG(MJPEG)文件:</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
221 &nbsp;&nbsp;<CODE>mencoder \*.jpg -mf on:w=800:h=600:fps=25 -ovc copy
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
222 -o output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
223
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
224 <P><I>用当前目录中的所有PNG文件创建一个非压缩的文件:</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
225 &nbsp;&nbsp;<CODE>mencoder \*.png -mf on:w=800:h=600:fps=25:type=png -ovc raw -o
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
226 output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
227
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
228 <P><I>用当前目录中的所有PNG文件创建Motion PNG(MPNG)文件:</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
229 &nbsp;&nbsp;<CODE>mencoder \*.png -mf on:w=800:h=600:fps=25:type=png -ovc copy
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
230 -o output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
231
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
232 <P><I>用当前目录中的所有TGA文件创建Motion TGA(MTGA)文件:</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
233 &nbsp;&nbsp;<CODE>mencoder \*.tga -mf on:w=800:h=600:fps=25:type=tga -ovc copy
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
234 -o output.avi</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
235
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
236
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
237 <H4><A NAME="vobsub">2.4.2.7 DVD字幕提取为Vobsub文件</A></H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
238
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
239 <P><B>MEncoder</B>有把DVD字幕提取到Vobsub格式的文件的能力。包括以<CODE>.idx</CODE>和<CODE>.sub</CODE>结尾的一对
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
240 文件而且通常打包在一个单一的<CODE>.rar</CODE>文档中。<B>MPlayer</B>能使用<CODE>-vobsub</CODE>和<CODE>-vobsubid</CODE>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
241 选项播放它们。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
242
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
243 <P>你使用<CODE>-vobsubout</CODE>选项规定输出文件的基名称(就是不包括<CODE>.idx</CODE>或者<CODE>.sub</CODE>的后缀)和
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
244 <CODE>-vobsuboutindex</CODE>指定字幕在输出文件中的索引号。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
245
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
246 <P>如果输入不是来自DVD你必须使用<CODE>-ifo</CODE>来指明构造<CODE>.idx</CODE>文件需要的<CODE>.ifo</CODE>文件。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
247
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
248 <P>如果输入不是来自DVD而且你也没有<CODE>.ifo</CODE>文件你将需要使用<CODE>-vobsubid</CODE>选项让它了解在<CODE>.idx</CODE>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
249 文件中放置什么样的language id。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
250
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
251 <P>如果<CODE>.idx</CODE>和<CODE>.sub</CODE>文件已经存在,每次运行将追加运行获得的字幕。因此,你应该在开始之前删掉所有东西。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
252
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
253 <H4>例子</H4>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
254
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
255 <P><I>在进行3-pass编码的同时从DVD复制两份字幕</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
256 &nbsp;&nbsp;<CODE>rm subtitles.idx subtitles.sub</CODE><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
257 &nbsp;&nbsp;<CODE>mencoder -dvd 1 -vobsubout subtitles -vobsuboutindex 0
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
258 -sid 2 -o frameno.avi -ovc frameno</CODE><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
259 &nbsp;&nbsp;<CODE>mencoder -dvd 1 -oac copy -ovc divx4 -pass 1</CODE><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
260 &nbsp;&nbsp;<CODE>mencoder -dvd 1 -oac copy -ovc divx4 -pass 2 -vobsubout
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
261 subtitles -vobsuboutindex 1 -sid 5</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
262
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
263 <P><I>从一个MPEG文件中复制法语字幕</I><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
264 &nbsp;&nbsp;<CODE>rm subtitles.idx subtitles.sub</CODE><BR>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
265 &nbsp;&nbsp;<CODE>mencoder movie.mpg -ifo movie.ifo -vobsubout subtitles
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
266 -vobsuboutindex 0 -vobsuboutid fr -sid 1</CODE></P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
267
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
268
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
269 <H3><A NAME="options">2.4.3 可用的选项</A></H3>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
270
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
271 <P><B>MEncoder</B>可用的选项和例子的完全列表,请参见manpage。</P>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
272
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
273 </BODY>
363959276ef2 by cvs hephooey@fastmail.fm
jaf
parents:
diff changeset
274 </HTML>