Mercurial > mplayer.hg
comparison DOCS/encoding.html @ 7814:988498df1996
<B>MPlayer</B> ---> MPlayer
author | diego |
---|---|
date | Sun, 20 Oct 2002 12:20:39 +0000 |
parents | 5d4b0446a557 |
children | 533e212cd282 |
comparison
equal
deleted
inserted
replaced
7813:76940a39405a | 7814:988498df1996 |
---|---|
10 <BODY> | 10 <BODY> |
11 | 11 |
12 | 12 |
13 <H2><A NAME="encoding">2.4 Encoding with MEncoder</A></H2> | 13 <H2><A NAME="encoding">2.4 Encoding with MEncoder</A></H2> |
14 | 14 |
15 <P><B>MEncoder</B> (<B>MPlayer</B>'s Movie Encoder) is a simple movie encoder, | 15 <P>MEncoder (MPlayer's Movie Encoder) is a simple movie encoder, |
16 designed to encode MPlayer-playable movies | 16 designed to encode MPlayer-playable movies |
17 (<B>AVI/ASF/OGG/DVD/VCD/VOB/MPG/MOV/VIV/FLI/RM/NUV/NET/PVA</B>) to other | 17 (<B>AVI/ASF/OGG/DVD/VCD/VOB/MPG/MOV/VIV/FLI/RM/NUV/NET/PVA</B>) to other |
18 MPlayer-playable formats (see below). It can encode with various codecs, like | 18 MPlayer-playable formats (see below). It can encode with various codecs, like |
19 <B>DivX4</B> (1 or 2 passes), libavcodec, | 19 <B>DivX4</B> (1 or 2 passes), libavcodec, |
20 <B>PCM</B>/<B>MP3</B>/<B>VBR MP3</B> audio. Also has powerful plugin system | 20 <B>PCM</B>/<B>MP3</B>/<B>VBR MP3</B> audio. Also has powerful plugin system |
22 | 22 |
23 | 23 |
24 <H3><A NAME="compilation">2.4.1 Compilation</A></H3> | 24 <H3><A NAME="compilation">2.4.1 Compilation</A></H3> |
25 | 25 |
26 <UL> | 26 <UL> |
27 <LI><B>OPTIONAL</B> - read <B>MPlayer</B>'s compilation instruction.</LI> | 27 <LI><B>OPTIONAL</B> - read MPlayer's compilation instruction.</LI> |
28 <LI><B>OPTIONAL (LINUX ONLY)</B> - download the newest <B>DivX4linux</B> libs | 28 <LI><B>OPTIONAL (LINUX ONLY)</B> - download the newest <B>DivX4linux</B> libs |
29 from <A HREF="http://avifile.sourceforge.net/download.htm">avifile.sourceforge.net</A>, | 29 from <A HREF="http://avifile.sourceforge.net/download.htm">avifile.sourceforge.net</A>, |
30 and have them PROPERLY installed. You need them if you want DivX4 | 30 and have them PROPERLY installed. You need them if you want DivX4 |
31 (1/2 pass) encoding.</LI> | 31 (1/2 pass) encoding.</LI> |
32 <LI><B>OPTIONAL</B> - <A HREF="codecs.html#xvid">download and install | 32 <LI><B>OPTIONAL</B> - <A HREF="codecs.html#xvid">download and install |
51 as described in the <A HREF="documentation.html#installation">Installation</A> | 51 as described in the <A HREF="documentation.html#installation">Installation</A> |
52 section</LI> | 52 section</LI> |
53 </UL> | 53 </UL> |
54 | 54 |
55 <P>You are ready. As you probably know, other encoding tools need the | 55 <P>You are ready. As you probably know, other encoding tools need the |
56 <I>avifile</I> library installed. <B>MEncoder</B> doesn't need it at all.</P> | 56 <I>avifile</I> library installed. MEncoder doesn't need it at all.</P> |
57 | 57 |
58 | 58 |
59 <H3><A NAME="features">2.4.2 MEncoder features</A></H3> | 59 <H3><A NAME="features">2.4.2 MEncoder features</A></H3> |
60 | 60 |
61 <UL> | 61 <UL> |
62 <LI>encoding from the wide range of fileformats and decoders of <B>MPlayer</B></LI> | 62 <LI>encoding from the wide range of fileformats and decoders of MPlayer</LI> |
63 <LI>encoding to all the codecs of ffmpeg's | 63 <LI>encoding to all the codecs of ffmpeg's |
64 <A HREF="codecs.html#libavcodec">libavcodec</A></LI> | 64 <A HREF="codecs.html#libavcodec">libavcodec</A></LI> |
65 <LI>video encoding from <B>V4L compatible TV tuners</B></LI> | 65 <LI>video encoding from <B>V4L compatible TV tuners</B></LI> |
66 <LI>encoding/multiplexing to interleaved AVI files with proper index</LI> | 66 <LI>encoding/multiplexing to interleaved AVI files with proper index</LI> |
67 <LI>creating files from external audio stream</LI> | 67 <LI>creating files from external audio stream</LI> |
68 <LI>1, 2 or 3 pass encoding</LI> | 68 <LI>1, 2 or 3 pass encoding</LI> |
69 <LI><B>VBR</B> MP3 audio - <B>IMPORTANT NOTE:</B> VBR MP3 audio doesn't | 69 <LI><B>VBR</B> MP3 audio - <B>IMPORTANT NOTE:</B> VBR MP3 audio doesn't |
70 always play nicely on Windows players! On the other hand, currently | 70 always play nicely on Windows players! On the other hand, currently |
71 <B>MEncoder</B>'s CBR encoding is totally broken on Win32 players :)</LI> | 71 MEncoder's CBR encoding is totally broken on Win32 players :)</LI> |
72 <LI>PCM audio</LI> | 72 <LI>PCM audio</LI> |
73 <LI>stream copying</LI> | 73 <LI>stream copying</LI> |
74 <LI>input A/V synchronizing (PTS-based, can be disabled with -mc 0 option)</LI> | 74 <LI>input A/V synchronizing (PTS-based, can be disabled with -mc 0 option)</LI> |
75 <LI>FPS correction with <CODE>-ofps</CODE> option (useful when encoding | 75 <LI>FPS correction with <CODE>-ofps</CODE> option (useful when encoding |
76 29.97fps VOB to 24fps AVI)</LI> | 76 29.97fps VOB to 24fps AVI)</LI> |
120 <P><CODE>rm frameno.avi</CODE></P></LI> | 120 <P><CODE>rm frameno.avi</CODE></P></LI> |
121 <LI>First pass: | 121 <LI>First pass: |
122 <P><CODE>mencoder <file/DVD> -ovc frameno -oac mp3lame -lameopts vbr=3:more_options -o frameno.avi</CODE></P> | 122 <P><CODE>mencoder <file/DVD> -ovc frameno -oac mp3lame -lameopts vbr=3:more_options -o frameno.avi</CODE></P> |
123 <P>An audio-only avi file will be created, containing | 123 <P>An audio-only avi file will be created, containing |
124 <B>only</B> the requested audio stream. Don't forget <CODE>-lameopts</CODE>, | 124 <B>only</B> the requested audio stream. Don't forget <CODE>-lameopts</CODE>, |
125 if you need to set it. If you were encoding a long movie, <B>MEncoder</B> | 125 if you need to set it. If you were encoding a long movie, MEncoder |
126 prints the recommended bitrate values for 650Mb, 700Mb, and 800Mb | 126 prints the recommended bitrate values for 650Mb, 700Mb, and 800Mb |
127 destination sizes, after this pass finishes.</P></LI> | 127 destination sizes, after this pass finishes.</P></LI> |
128 <LI>Second pass: | 128 <LI>Second pass: |
129 <P><CODE>mencoder <file/DVD> -oac copy -pass 1 | 129 <P><CODE>mencoder <file/DVD> -oac copy -pass 1 |
130 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=<bitrate></CODE></P> | 130 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=<bitrate></CODE></P> |
131 <P>Alias the first pass of DivX4 video encoding. | 131 <P>Alias the first pass of DivX4 video encoding. |
132 Optionally specify the video bitrate <B>MEncoder</B> printed at the end of | 132 Optionally specify the video bitrate MEncoder printed at the end of |
133 the previous pass.</P></LI> | 133 the previous pass.</P></LI> |
134 <LI>Third pass: | 134 <LI>Third pass: |
135 <P><CODE>mencoder <file/DVD> -oac copy -pass 2 | 135 <P><CODE>mencoder <file/DVD> -oac copy -pass 2 |
136 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=<bitrate></CODE></P> | 136 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=<bitrate></CODE></P> |
137 <P>Alias the second pass of DivX4 video encoding. | 137 <P>Alias the second pass of DivX4 video encoding. |
138 Optionally specify the video bitrate <B>MEncoder</B> printed at the end of | 138 Optionally specify the video bitrate MEncoder printed at the end of |
139 the previous pass. In this pass, audio from <CODE>frameno.avi</CODE> will | 139 the previous pass. In this pass, audio from <CODE>frameno.avi</CODE> will |
140 be inserted into the destination file.. and it's all ready!</P></LI> | 140 be inserted into the destination file.. and it's all ready!</P></LI> |
141 </OL> | 141 </OL> |
142 | 142 |
143 <H4>Example for 3-pass encoding:</H4> | 143 <H4>Example for 3-pass encoding:</H4> |
185 AVI (DivX) files, you have be aware that AVI headers don't store this | 185 AVI (DivX) files, you have be aware that AVI headers don't store this |
186 value. Thus, the only solution is rescaling.</P> | 186 value. Thus, the only solution is rescaling.</P> |
187 | 187 |
188 <P>The scaling process is handled by the <I>'scale'</I> video filter: | 188 <P>The scaling process is handled by the <I>'scale'</I> video filter: |
189 <CODE>-vop scale=X:Y</CODE>. Its quality can be set with the | 189 <CODE>-vop scale=X:Y</CODE>. Its quality can be set with the |
190 <CODE>-sws</CODE> option. If it's not specified, <B>MEncoder</B> will use 0: | 190 <CODE>-sws</CODE> option. If it's not specified, MEncoder will use 0: |
191 fast bilinear.</P> | 191 fast bilinear.</P> |
192 | 192 |
193 <P>Usage:<BR> | 193 <P>Usage:<BR> |
194 <CODE> mencoder sample-svcd.mpg -ovc lavc -lavcopts | 194 <CODE> mencoder sample-svcd.mpg -ovc lavc -lavcopts |
195 vcodec=mpeg4:more_options -vop scale=640:480 -oac copy -o | 195 vcodec=mpeg4:more_options -vop scale=640:480 -oac copy -o |
196 output.avi</CODE></P> | 196 output.avi</CODE></P> |
197 | 197 |
198 | 198 |
199 <H4><A NAME="copying">2.4.2.3 Stream copying</A></H4> | 199 <H4><A NAME="copying">2.4.2.3 Stream copying</A></H4> |
200 | 200 |
201 <P><B>MEncoder</B> can handle input streams in two ways: <B>encode</B> or | 201 <P>MEncoder can handle input streams in two ways: <B>encode</B> or |
202 <B>copy</B> them. This section is about <B>copying</B>.</P> | 202 <B>copy</B> them. This section is about <B>copying</B>.</P> |
203 | 203 |
204 <UL> | 204 <UL> |
205 <LI><B>Video stream</B> (option <CODE>-ovc copy</CODE>): nice stuff can be | 205 <LI><B>Video stream</B> (option <CODE>-ovc copy</CODE>): nice stuff can be |
206 done :)<BR> | 206 done :)<BR> |
207 Like, putting (not converting) FLI or VIVO or MPEG1 video into | 207 Like, putting (not converting) FLI or VIVO or MPEG1 video into |
208 an AVI file. Of course only <B>MPlayer</B> can play such files :) And it | 208 an AVI file. Of course only MPlayer can play such files :) And it |
209 probably has no real life value at all. Rationally: video stream copying | 209 probably has no real life value at all. Rationally: video stream copying |
210 can be useful for example when only the audio stream has to be encoded | 210 can be useful for example when only the audio stream has to be encoded |
211 (like, uncompressed PCM to MP3).</LI> | 211 (like, uncompressed PCM to MP3).</LI> |
212 | 212 |
213 <LI><B>Audio stream</B> (option <CODE>-oac copy</CODE>): straightforward. | 213 <LI><B>Audio stream</B> (option <CODE>-oac copy</CODE>): straightforward. |
218 | 218 |
219 | 219 |
220 <H4><A NAME="fixing">2.4.2.4 Fixing AVIs with broken index or interleaving</A></H4> | 220 <H4><A NAME="fixing">2.4.2.4 Fixing AVIs with broken index or interleaving</A></H4> |
221 | 221 |
222 <P>Easiest thing. We simply copy the video and audio streams, and | 222 <P>Easiest thing. We simply copy the video and audio streams, and |
223 <B>MEncoder</B> generates the index. Of course this cannot fix possible bugs | 223 MEncoder generates the index. Of course this cannot fix possible bugs |
224 in the video and/or audio streams. It also fixes files with broken | 224 in the video and/or audio streams. It also fixes files with broken |
225 interleaving, thus the <CODE>-ni</CODE> option won't be needed for them | 225 interleaving, thus the <CODE>-ni</CODE> option won't be needed for them |
226 anymore.</P> | 226 anymore.</P> |
227 | 227 |
228 <P>Command: <CODE>mencoder -idx input.avi -ovc copy -oac copy -o output.avi</CODE></P> | 228 <P>Command: <CODE>mencoder -idx input.avi -ovc copy -oac copy -o output.avi</CODE></P> |
253 -lavcopts vcodec=mjpeg -oac copy</CODE></P> | 253 -lavcopts vcodec=mjpeg -oac copy</CODE></P> |
254 | 254 |
255 | 255 |
256 <H4><A NAME="image_files">2.4.2.6 Encoding from multiple input image files (JPEGs, PNGs or TGAs)</A></H4> | 256 <H4><A NAME="image_files">2.4.2.6 Encoding from multiple input image files (JPEGs, PNGs or TGAs)</A></H4> |
257 | 257 |
258 <P><B>MEncoder</B> is capable of creating movies from one or more JPEG, PNG or TGA | 258 <P>MEncoder is capable of creating movies from one or more JPEG, PNG or TGA |
259 files. With simple framecopy it can create MJPEG (Motion JPEG), MPNG | 259 files. With simple framecopy it can create MJPEG (Motion JPEG), MPNG |
260 (Motion PNG) or MTGA (Motion TGA) files.</P> | 260 (Motion PNG) or MTGA (Motion TGA) files.</P> |
261 | 261 |
262 Explanation of the process: | 262 Explanation of the process: |
263 | 263 |
264 <OL> | 264 <OL> |
265 <LI><B>MEncoder</B> <I>decodes</I> the input image(s) with | 265 <LI>MEncoder <I>decodes</I> the input image(s) with |
266 <CODE>libjpeg</CODE> (when decoding PNGs, it will use <B>libpng</B>).</LI> | 266 <CODE>libjpeg</CODE> (when decoding PNGs, it will use <B>libpng</B>).</LI> |
267 | 267 |
268 <LI><B>MEncoder</B> then feeds the decoded image to the chosen video compressor | 268 <LI>MEncoder then feeds the decoded image to the chosen video compressor |
269 (DivX4, Xvid, ffmpeg msmpeg4, etc...). Watch for the PNG decoder, as | 269 (DivX4, Xvid, ffmpeg msmpeg4, etc...). Watch for the PNG decoder, as |
270 currently it can output only to RGB formats, thus can't be used with codecs | 270 currently it can output only to RGB formats, thus can't be used with codecs |
271 that require YUV as input, like DivX4 or ffmpeg's msmpeg4.</LI> | 271 that require YUV as input, like DivX4 or ffmpeg's msmpeg4.</LI> |
272 </OL> | 272 </OL> |
273 | 273 |
301 -oac copy -o output.avi</CODE></P> | 301 -oac copy -o output.avi</CODE></P> |
302 | 302 |
303 | 303 |
304 <H4><A NAME="vobsub">2.4.2.7 Extracting DVD subtitles to Vobsub file</A></H4> | 304 <H4><A NAME="vobsub">2.4.2.7 Extracting DVD subtitles to Vobsub file</A></H4> |
305 | 305 |
306 <P><B>MEncoder</B> is capable of extracting subtitles from a DVD into | 306 <P>MEncoder is capable of extracting subtitles from a DVD into |
307 Vobsub fomat files. They consist of a pair of files ending in | 307 Vobsub fomat files. They consist of a pair of files ending in |
308 <CODE>.idx</CODE> and <CODE>.sub</CODE> and are usually packaged in a single | 308 <CODE>.idx</CODE> and <CODE>.sub</CODE> and are usually packaged in a single |
309 <CODE>.rar</CODE> archive. <B>MPlayer</B> can play these with the | 309 <CODE>.rar</CODE> archive. MPlayer can play these with the |
310 <CODE>-vobsub</CODE> and <CODE>-vobsubid</CODE> options.</P> | 310 <CODE>-vobsub</CODE> and <CODE>-vobsubid</CODE> options.</P> |
311 | 311 |
312 <P>You specify the basename (i.e without the <CODE>.idx</CODE> or | 312 <P>You specify the basename (i.e without the <CODE>.idx</CODE> or |
313 <CODE>.sub</CODE> extension) of the output files with <CODE>-vobsubout</CODE> | 313 <CODE>.sub</CODE> extension) of the output files with <CODE>-vobsubout</CODE> |
314 and the index for this subtitle in the resulting files with | 314 and the index for this subtitle in the resulting files with |
342 -vobsuboutindex 0 -vobsuboutid fr -sid 1</CODE></P> | 342 -vobsuboutindex 0 -vobsuboutid fr -sid 1</CODE></P> |
343 | 343 |
344 | 344 |
345 <H3><A NAME="options">2.4.3 Available options</A></H3> | 345 <H3><A NAME="options">2.4.3 Available options</A></H3> |
346 | 346 |
347 <P>For the complete list of available <B>MEncoder</B> options and examples, | 347 <P>For the complete list of available MEncoder options and examples, |
348 please see the man page.</P> | 348 please see the man page.</P> |
349 | 349 |
350 </BODY> | 350 </BODY> |
351 </HTML> | 351 </HTML> |