Mercurial > mplayer.hg
comparison DOCS/encoding.html @ 3721:66da035c4ee2
some quick updates for the prerelease
author | gabucino |
---|---|
date | Mon, 24 Dec 2001 23:00:07 +0000 |
parents | 0da05bcc72ba |
children | 68dae60dd470 |
comparison
equal
deleted
inserted
replaced
3720:120ac80f13c2 | 3721:66da035c4ee2 |
---|---|
3 | 3 |
4 <FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> | 4 <FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> |
5 | 5 |
6 <P><B><A NAME=2.4>2.4. Encoding with MEncoder</A></B></P> | 6 <P><B><A NAME=2.4>2.4. Encoding with MEncoder</A></B></P> |
7 | 7 |
8 <A NAME=2.4.1><P><B><I>Overview</I></B> | 8 <P><B><A NAME=2.4.1>2.4.1. Overview</B></P> |
9 | |
9 <P><B>MEncoder</B> (<B>MPlayer</B>'s Movie Encoder) is a simple movie encoder, | 10 <P><B>MEncoder</B> (<B>MPlayer</B>'s Movie Encoder) is a simple movie encoder, |
10 designed to encode MPlayer-playable movies | 11 designed to encode MPlayer-playable movies |
11 (<B>AVI/DVD/VCD/VOB/MPG/MOV/VIV/NET</B>) to other MPlayer-playable formats (see | 12 (<B>AVI/DVD/VCD/VOB/MPG/MOV/VIV/NET</B>) to other MPlayer-playable formats (see |
12 below). Currently it's in beta stage, and encodes only to <B>DivX4</B> (1 or 2 | 13 below). Currently it's in beta stage, and encodes only to <B>DivX4</B> (1 or 2 |
13 passes) video, <B>PCM</B>/<B>MP3</B>/<B>VBRMP3</B> audio. Also has stream | 14 passes) video, <B>PCM</B>/<B>MP3</B>/<B>VBRMP3</B> audio. Also has stream |
14 copying abilities. In the future, there will be cropping, resizing filters, and | 15 copying abilities. In the future, there will be cropping, resizing filters, and |
15 other interesting stuff.</P> | 16 other interesting stuff.</P> |
16 | 17 |
17 <A NAME=2.4.2><P><B><I>Compiling</I></B> | 18 <P><B><A NAME=2.4.2>2.4.2. Compiling</B></P> |
19 | |
20 <P> | |
18 <UL> | 21 <UL> |
19 <LI>read <B>MPlayer</B>'s compilation instructions, it contains info about | 22 <LI><B>OPTIONAL</B> - read <B>MPlayer</B>'s compilation instructions, it contains info about |
20 how to install <I>libdvdread</I> for <B>DVD</B> support, etc.</LI> | 23 how to install <I>libdvdread</I> for <B>DVD</B> support, etc.</LI> |
21 <LI>download the newest <B>DivX4linux</B> libs | 24 <LI><B>OPTIONAL</B> - download the newest <B>DivX4linux</B> libs |
22 from <A HREF="http://avifile.sourceforge.net/download.htm">avifile.sourceforge.net</A>, | 25 from <A HREF="http://avifile.sourceforge.net/download.htm">avifile.sourceforge.net</A>, |
23 and have them PROPERLY installed. This is needed for DivX4 (1/2 pass) | 26 and have them PROPERLY installed. This is needed for DivX4 (1/2 pass) |
24 encoding. And since this is mandatory (now), MEncoder is Linux-only.</LI> | 27 encoding. And since this is mandatory (now), MEncoder is Linux-only.</LI> |
25 <LI>download and compile <B>libmp3lame</B> (from lame 3.89beta or lame CVS).<BR> | 28 <LI><B>OPTIONAL</B> - for libavcodec support, install libavcodec as |
29 described in the <A HREF="codecs.html#2.2.1.2">libavcodec section</A>.</LI> | |
30 <LI><B>OPTIONAL</B> - download and compile <B>libmp3lame</B> (from lame 3.89beta or lame CVS).<BR> | |
26 <B>WARNING : DO NOT COMPILE LAME WITH <U>GCC 2.96</U> ! It won't | 31 <B>WARNING : DO NOT COMPILE LAME WITH <U>GCC 2.96</U> ! It won't |
27 work properly !</B><BR> | 32 work properly !</B><BR> |
28 This | 33 This |
29 is needed for CBR/VBR MP3 audio encoding ability. Note that a single | 34 is needed for CBR/VBR MP3 audio encoding ability. Note that a single |
30 <CODE>lame</CODE> binary isn't sufficient. BTW: the less optimization | 35 <CODE>lame</CODE> binary isn't sufficient. BTW: the less optimization |
41 </P> | 46 </P> |
42 | 47 |
43 <P>You are ready. As you probably know, other encoding tools need the | 48 <P>You are ready. As you probably know, other encoding tools need the |
44 <I>avifile</I> library installed. <B>MEncoder</B> doesn't need it at all.</P> | 49 <I>avifile</I> library installed. <B>MEncoder</B> doesn't need it at all.</P> |
45 | 50 |
46 <A NAME=2.4.3><P><B><I>MEncoder features</I></B> : | 51 <P><B><A NAME=2.4.3>2.4.3. MEncoder features</B></P> |
52 | |
53 <P> | |
47 <UL> | 54 <UL> |
48 <LI>encoding from the wide range of fileformats and decoders of <B>MPlayer</B></LI> | 55 <LI>encoding from the wide range of fileformats and decoders of <B>MPlayer</B></LI> |
49 <LI>encoding from <B>V4L compatible TV tuners</B></LI> | 56 <LI>encoding from <B>V4L compatible TV tuners</B></LI> |
50 <LI>encoding/multiplexing to interleaved AVI files with proper index</LI> | 57 <LI>encoding/multiplexing to interleaved AVI files with proper index</LI> |
51 <LI>1 or 2 pass <B>DivX4</B> video</LI> | 58 <LI>1 or 2 pass <B>DivX4</B> video</LI> |
66 <LI>even wider variety of available en/decoding formats/codecs | 73 <LI>even wider variety of available en/decoding formats/codecs |
67 (creating VOB files with DivX4/Indeo5/VIVO streams :)</LI> | 74 (creating VOB files with DivX4/Indeo5/VIVO streams :)</LI> |
68 </UL> | 75 </UL> |
69 </P> | 76 </P> |
70 | 77 |
71 <A NAME=2.4.3.1><P><B><I>Encoding 2-pass DivX4</I></B></P> | 78 <P><B><A NAME=2.4.3.1>2.4.3.1. Encoding 2-pass DivX4</B></P> |
72 | 79 |
73 <P>The name comes from the fact that this method encodes the file <I>twice</I>. | 80 <P>The name comes from the fact that this method encodes the file <I>twice</I>. |
74 The first encoding (dubbed <I>pass</I>) creates some temporary files (*.log) with a | 81 The first encoding (dubbed <I>pass</I>) creates some temporary files (*.log) with a |
75 size of few megabytes, do not delete them yet (you can delete the AVI). In the second pass, the | 82 size of few megabytes, do not delete them yet (you can delete the AVI). In the second pass, the |
76 2-pass output file is created, using the bitrate data from the temporary files. The resulting | 83 2-pass output file is created, using the bitrate data from the temporary files. The resulting |
81 commands are needed :<BR> | 88 commands are needed :<BR> |
82 <CODE> mencoder -dvd 2 -ovc divx4 -oac mp3lame -divx4opts br=1100 | 89 <CODE> mencoder -dvd 2 -ovc divx4 -oac mp3lame -divx4opts br=1100 |
83 -o movie.avi -pass 1<BR> | 90 -o movie.avi -pass 1<BR> |
84 mencoder -dvd 2 -ovc divx4 -oac mp3lame -divx4opts br=1100 -o movie.avi -pass 2</CODE></P> | 91 mencoder -dvd 2 -ovc divx4 -oac mp3lame -divx4opts br=1100 -o movie.avi -pass 2</CODE></P> |
85 | 92 |
86 <A NAME=2.4.3.2><P><B><I>Rescaling movies</I></B></P> | 93 <P><B><A NAME=2.4.3.2>2.4.3.2. Rescaling movies</B></P> |
87 | 94 |
88 <P>Often the need to resize movie images' size emerges. Its reasons can be many, | 95 <P>Often the need to resize movie images' size emerges. Its reasons can be many, |
89 examples are decreasing output file size, encoding SVCDs to DivX. Ripped DVDs | 96 examples are decreasing output file size, encoding SVCDs to DivX. Ripped DVDs |
90 are mostly rescaled, for example a 4:3 DVD should be 640x480, especially | 97 are mostly rescaled, for example a 4:3 DVD should be 640x480, especially |
91 when you want it to fit to 1 CD, and have good quality at the same time. | 98 when you want it to fit to 1 CD, and have good quality at the same time. |
94 AVI (DivX) files, you have be aware that AVI headers don't store this | 101 AVI (DivX) files, you have be aware that AVI headers don't store this |
95 value. Thus, the only solution is rescaling.</P> | 102 value. Thus, the only solution is rescaling.</P> |
96 | 103 |
97 <P>The output size is specified with the <CODE>-x</CODE>, and <CODE>-y</CODE> | 104 <P>The output size is specified with the <CODE>-x</CODE>, and <CODE>-y</CODE> |
98 options. Furthermore, there are 3 rescaling filters in <B>MEncoder</B>, <I>0 | 105 options. Furthermore, there are 3 rescaling filters in <B>MEncoder</B>, <I>0 |
99 : fast 1 : bilinear</I>, <I>2 : bilinear</I>, <I>bicubic</I> (best quality). | 106 : fast bilinear</I>, <I>1 : bilinear</I>, <I>2 : bicubic</I> (best quality). |
100 They can be specified with the <CODE>-sws</CODE> option. If not specified, | 107 They can be specified with the <CODE>-sws</CODE> option. If not specified, |
101 <B>MEncoder</B> will use 0 : fast bilinear.</P> | 108 <B>MEncoder</B> will use 0 : fast bilinear.</P> |
102 | 109 |
103 <P>Rescaling is very simple :<BR> | 110 <P>Rescaling is very simple :<BR> |
104 <CODE> mencoder sample-svcd.mpg -divx4opts br=1300 -x 640 -y 480 -sws 2 -o output.avi</CODE></P> | 111 <CODE> mencoder sample-svcd.mpg -divx4opts br=1300 -x 640 -y 480 -sws 2 -o output.avi</CODE></P> |
105 | 112 |
106 <A NAME=2.4.3.3><P><B><I>Stream copying</I></B></P> | 113 <P><B><A NAME=2.4.3.3>2.4.3.3. Stream copying</B></P> |
107 | 114 |
108 <P><B>MEncoder</B> can handle input streams in two ways : <B>encode</B> or | 115 <P><B>MEncoder</B> can handle input streams in two ways : <B>encode</B> or |
109 <B>copy</B> them. This section is about <B>copying</B>.</P> | 116 <B>copy</B> them. This section is about <B>copying</B>.</P> |
110 | 117 |
111 <P> | 118 <P> |
119 | 126 |
120 <LI><B>Audio stream</B> (option <CODE>-oac copy</CODE>) : straightforward.</LI> | 127 <LI><B>Audio stream</B> (option <CODE>-oac copy</CODE>) : straightforward.</LI> |
121 </UL> | 128 </UL> |
122 </P> | 129 </P> |
123 | 130 |
124 <A NAME=2.4.3.4><P><B><I>Fixing AVIs with broken index</I></B></P> | 131 <P><B><A NAME=2.4.3.4>2.4.3.4. Fixing AVIs with broken index</B></P> |
125 | 132 |
126 <P>Easiest thing. We simply copy the video and audio streams, and | 133 <P>Easiest thing. We simply copy the video and audio streams, and |
127 <B>MEncoder</B> generates the index. Of course this cannot fix possible bugs in | 134 <B>MEncoder</B> generates the index. Of course this cannot fix possible bugs in |
128 the video and/or audio streams.</P> | 135 the video and/or audio streams.</P> |
129 | 136 |
130 <P>Command : <CODE>mencoder input.avi -ovc copy -oac copy -o output.avi</CODE></P> | 137 <P>Command : <CODE>mencoder input.avi -ovc copy -oac copy -o output.avi</CODE></P> |
131 | 138 |
132 <A NAME=2.4.4><P><B><I>Syntax</I></B></P> | 139 |
140 <P><B><A NAME=2.4.3.5>2.4.3.5. Encoding with the <I>libavcodec</I> codec family</B></P> | |
141 | |
142 <P>libavcodec provides simple encoding to a lot of interesting video and audio | |
143 formats (currently its audio codecs are unsupported). You can encode to the | |
144 following codecs :</P> | |
145 | |
146 <P> | |
147 <UL> | |
148 <LI>mjpeg - Motion JPEG</LI> | |
149 <LI>h263p - H263 Plus</LI> | |
150 <LI>mpeg4 - DivX4</LI> | |
151 <LI>msmpeg4 - the old DivX</LI> | |
152 <LI>rv10 - an old RealVideo codec</LI> | |
153 <LI>mpeg1video - MPEG1 video :)</LI> | |
154 </UL> | |
155 </P> | |
156 | |
157 <P>The first column contains the codec names that should be passed after the | |
158 <CODE>vcodec</CODE> config, like : <CODE>-lavcopts vcodec=msmpeg4</CODE></P> | |
159 | |
160 <P><B><A NAME=2.4.4>2.4.4. Syntax</B></P> | |
133 | 161 |
134 <P> <CODE>mencoder [options] [input file] [options] ...</P> | 162 <P> <CODE>mencoder [options] [input file] [options] ...</P> |
135 | 163 |
136 <A NAME=2.4.5><P><B><I>Available options</I></B></P> | 164 <P><B><A NAME=2.4.5>2.4.5. Available options</B></P> |
137 | 165 |
138 <P>NOTE : for all available options, <B>read the manpage !</B></P> | 166 <P>NOTE : for all available options, <B>read the manpage !</B></P> |
139 | 167 |
140 <TABLE BORDER=0> | 168 <TABLE BORDER=0> |
141 <TR> | 169 <TR> |
185 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> | 213 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> |
186 Encode with the given codec (codec names are from codecs.conf). Examples:<BR> | 214 Encode with the given codec (codec names are from codecs.conf). Examples:<BR> |
187 <B>help</B> - get list of available codecs<BR> | 215 <B>help</B> - get list of available codecs<BR> |
188 <B>copy</B> - no encoding, just copy the stream (only from AVI/ASF now)<BR> | 216 <B>copy</B> - no encoding, just copy the stream (only from AVI/ASF now)<BR> |
189 <B>divx4</B> - encode to DivX4<BR> | 217 <B>divx4</B> - encode to DivX4<BR> |
218 <B>lavc</B> - encode with a codec from libavcodec<BR> | |
190 </TD> | 219 </TD> |
191 </TR> | 220 </TR> |
192 <TR> | 221 <TR> |
193 <TD> </TD> | 222 <TD> </TD> |
194 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> | 223 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> |
212 <CODE>-divx4opts br=1800:deinterlace:key=250</CODE><BR> | 241 <CODE>-divx4opts br=1800:deinterlace:key=250</CODE><BR> |
213 Common options: <B>(for full list, check the manpage!)</B><BR> | 242 Common options: <B>(for full list, check the manpage!)</B><BR> |
214 <B>help</B> - get help<BR> | 243 <B>help</B> - get help<BR> |
215 <B>br</B>=XXX - specify bitrate in kbit <4-16000> or bit <16001-24000000><BR> | 244 <B>br</B>=XXX - specify bitrate in kbit <4-16000> or bit <16001-24000000><BR> |
216 <B>q</B>=XXXX - quality (1-fastest, 5-best - default 5)<BR> | 245 <B>q</B>=XXXX - quality (1-fastest, 5-best - default 5)<BR> |
246 <B>key</B>=XXXX - keyframe interval<BR> | |
247 </TD> | |
248 </TR> | |
249 <TR> | |
250 <TD> </TD> | |
251 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> | |
252 <I>-lavcopts</I></TD> | |
253 <TD> </TD> | |
254 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> | |
255 If encoding with libavcodec, you can specify its parameters here, like:<BR> | |
256 <CODE>-lavcopts vcodec=msmpeg4:vbitrate=1800:vhq:keyint=250</CODE><BR> | |
257 Common options: <B>(for full list, check the manpage!)</B><BR> | |
258 <B>help</B> - get help<BR> | |
259 <B>vcodec</B>=XXX - select videocodec (for the full list, see the libavcodec section above)<BR> | |
260 <B>vbitrate</B>=XXX - specify bitrate in kbit <4-16000> or bit <16001-24000000><BR> | |
261 <B>vhq</B> - high quality<BR> | |
262 <B>keyint</B>=XXX - keyframe interval<BR> | |
217 </TD> | 263 </TD> |
218 </TR> | 264 </TR> |
219 <TR> | 265 <TR> |
220 <TD> </TD> | 266 <TD> </TD> |
221 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> | 267 <TD><FONT face="Verdana, Arial, Helvetica, sans-serif" size=2> |
232 <B>q</B>=XXXX - quality (0-highest, 9-fastest - default 0) (this is for <B>VBR</B> only!)<BR> | 278 <B>q</B>=XXXX - quality (0-highest, 9-fastest - default 0) (this is for <B>VBR</B> only!)<BR> |
233 </TD> | 279 </TD> |
234 </TR> | 280 </TR> |
235 </TABLE> | 281 </TABLE> |
236 | 282 |
237 <A NAME=2.4.6><P><B><I>Examples</I></B></P> | 283 <P><B><A NAME=2.4.6>2.4.6. Examples</B></P> |
238 | 284 |
239 <P>Using <B>MEncoder</B> is the easiest thing on Earth. See the following :</P> | 285 <P>Using <B>MEncoder</B> is the easiest thing on Earth. See the following :</P> |
240 | 286 |
241 <P>Encoding from DVD, title 2 :<BR> | 287 <P>Encoding from DVD, title 2 :<BR> |
242 <CODE> mencoder -dvd 2 -o title2.avi</CODE></P> | 288 <CODE> mencoder -dvd 2 -o title2.avi</CODE></P> |
289 | |
290 <P>The same, but with libavcodec family, MJPEG compression :<BR> | |
291 <CODE> mencoder -dvd 2 -o title2.avi -ovc lavc -lavcopts vcodec=mjpeg -ffourcc mjpg</CODE></P> | |
243 | 292 |
244 <P>Encoding from DVD, title 2, with rescaling :<BR> | 293 <P>Encoding from DVD, title 2, with rescaling :<BR> |
245 <CODE> mencoder -dvd 2 -x 640 -y 480 -sws 2 -o title2.avi</CODE></P> | 294 <CODE> mencoder -dvd 2 -x 640 -y 480 -sws 2 -o title2.avi</CODE></P> |
246 | 295 |
247 <P>Encoding from HTTP :<BR> | 296 <P>Encoding from HTTP :<BR> |