Mercurial > mplayer.hg
comparison DOCS/encoding.html @ 7699:5d4b0446a557
Cosmetics: Converted 2 spaces to one in section titles, changed some ugly
linebreaks and put "." after sentences in codecs.html.
author | diego |
---|---|
date | Thu, 10 Oct 2002 01:42:27 +0000 |
parents | 427935644581 |
children | 988498df1996 |
comparison
equal
deleted
inserted
replaced
7698:c8d2c444d278 | 7699:5d4b0446a557 |
---|---|
8 </HEAD> | 8 </HEAD> |
9 | 9 |
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><B>MEncoder</B> (<B>MPlayer</B>'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 |
21 for video manipulation.</P> | 21 for video manipulation.</P> |
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 <B>MPlayer</B>'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>, |
42 <CODE>lame</CODE> binary isn't sufficient. BTW: the less optimization | 42 <CODE>lame</CODE> binary isn't sufficient. BTW: the less optimization |
43 you use for lame, the better the quality will be. You can test | 43 you use for lame, the better the quality will be. You can test |
44 quality by running <CODE>make test</CODE> after lame's compiling process | 44 quality by running <CODE>make test</CODE> after lame's compiling process |
45 is over. The resulting number should be less than <B>30</B>. Don't | 45 is over. The resulting number should be less than <B>30</B>. Don't |
46 panic if it's <B>400</B> or so, you shouldn't heard any audible | 46 panic if it's <B>400</B> or so, you shouldn't heard any audible |
47 quality decrease. Oh, and if your compiler doesn't even run <CODE>make test</CODE> ... | 47 quality decrease. Oh, and if your compiler doesn't even run |
48 Well, delete that <B>GCC 2.96</B> or upgrade lame to at least <B>3.90</B>.</LI> | 48 <CODE>make test</CODE> ... Well, delete that <B>GCC 2.96</B> or upgrade |
49 lame to at least <B>3.90</B>.</LI> | |
49 <LI><B>OPTIONAL</B> - <CODE>libjpeg</CODE> and <CODE>libpng</CODE> - | 50 <LI><B>OPTIONAL</B> - <CODE>libjpeg</CODE> and <CODE>libpng</CODE> - |
50 as described in the <A HREF="documentation.html#installation">Installation</A> | 51 as described in the <A HREF="documentation.html#installation">Installation</A> |
51 section</LI> | 52 section</LI> |
52 </UL> | 53 </UL> |
53 | 54 |
54 <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 |
55 <I>avifile</I> library installed. <B>MEncoder</B> doesn't need it at all.</P> | 56 <I>avifile</I> library installed. <B>MEncoder</B> doesn't need it at all.</P> |
56 | 57 |
57 | 58 |
58 <H3><A NAME="features">2.4.2 MEncoder features</A></H3> | 59 <H3><A NAME="features">2.4.2 MEncoder features</A></H3> |
59 | 60 |
60 <UL> | 61 <UL> |
61 <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 <B>MPlayer</B></LI> |
62 <LI>encoding to all the codecs of ffmpeg's | 63 <LI>encoding to all the codecs of ffmpeg's |
63 <A HREF="codecs.html#libavcodec">libavcodec</A></LI> | 64 <A HREF="codecs.html#libavcodec">libavcodec</A></LI> |
86 (creating VOB files with DivX4/Indeo5/VIVO streams :)</LI> | 87 (creating VOB files with DivX4/Indeo5/VIVO streams :)</LI> |
87 <LI>audio encoding from v4l (DONE for FreeBSD ?)</LI> | 88 <LI>audio encoding from v4l (DONE for FreeBSD ?)</LI> |
88 </UL> | 89 </UL> |
89 | 90 |
90 | 91 |
91 <H4><A NAME="2pass">2.4.2.1 Encoding 2 or 3-pass DivX4</A></H4> | 92 <H4><A NAME="2pass">2.4.2.1 Encoding 2 or 3-pass DivX4</A></H4> |
92 | 93 |
93 <P><U><B>2-pass encoding:</B></U> the name comes from the fact that this method | 94 <P><U><B>2-pass encoding:</B></U> the name comes from the fact that this method |
94 encodes the file <I>twice</I>. The first encoding (dubbed <I>pass</I>) | 95 encodes the file <I>twice</I>. The first encoding (dubbed <I>pass</I>) |
95 creates some temporary files (*.log) with a size of few megabytes, do not | 96 creates some temporary files (*.log) with a size of few megabytes, do not |
96 delete them yet (you can delete the AVI). In the second pass, the 2-pass | 97 delete them yet (you can delete the AVI). In the second pass, the 2-pass |
104 <CODE> rm frameno.avi</CODE> - remove this file, which | 105 <CODE> rm frameno.avi</CODE> - remove this file, which |
105 can come from a previous 3-pass encoding (it interferes with current | 106 can come from a previous 3-pass encoding (it interferes with current |
106 one)<BR> | 107 one)<BR> |
107 <CODE> mencoder -dvd 2 -ovc lavc -lavcopts | 108 <CODE> mencoder -dvd 2 -ovc lavc -lavcopts |
108 vcodec=mpeg4:more_options -oac copy -o movie.avi -pass 1<BR> | 109 vcodec=mpeg4:more_options -oac copy -o movie.avi -pass 1<BR> |
109 mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4:more_options | 110 mencoder -dvd 2 -ovc lavc -lavcopts |
110 -oac copy -o movie.avi -pass 2</CODE></P> | 111 vcodec=mpeg4:more_options -oac copy -o movie.avi -pass 2</CODE></P> |
111 | 112 |
112 <P><U><B>3-pass encoding:</B></U> this is an extension of 2-pass encoding, | 113 <P><U><B>3-pass encoding:</B></U> this is an extension of 2-pass encoding, |
113 where the audio encoding takes place in a separate pass. This method enables | 114 where the audio encoding takes place in a separate pass. This method enables |
114 estimation of recommended video bitrate in order to fit on a CD. Also, the | 115 estimation of recommended video bitrate in order to fit on a CD. Also, the |
115 audio is encoded only once, unlike in 2-pass mode. The schematics:</P> | 116 audio is encoded only once, unlike in 2-pass mode. The schematics:</P> |
171 mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o | 172 mencoder -dvd 2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o |
172 movie.avi</CODE></LI> | 173 movie.avi</CODE></LI> |
173 </UL> | 174 </UL> |
174 | 175 |
175 | 176 |
176 <H4><A NAME="rescaling">2.4.2.2 Rescaling movies</A></H4> | 177 <H4><A NAME="rescaling">2.4.2.2 Rescaling movies</A></H4> |
177 | 178 |
178 <P>Often the need to resize movie images' size emerges. Its reasons can be many, | 179 <P>Often the need to resize movie images' size emerges. Its reasons can be many, |
179 examples are decreasing output file size, encoding SVCDs to DivX. Ripped DVDs | 180 examples are decreasing output file size, encoding SVCDs to DivX. Ripped DVDs |
180 are mostly rescaled, for example a 4:3 DVD should be 640x480, especially | 181 are mostly rescaled, for example a 4:3 DVD should be 640x480, especially |
181 when you want it to fit to 1 CD, and have good quality at the same time. | 182 when you want it to fit to 1 CD, and have good quality at the same time. |
193 <CODE> mencoder sample-svcd.mpg -ovc lavc -lavcopts | 194 <CODE> mencoder sample-svcd.mpg -ovc lavc -lavcopts |
194 vcodec=mpeg4:more_options -vop scale=640:480 -oac copy -o | 195 vcodec=mpeg4:more_options -vop scale=640:480 -oac copy -o |
195 output.avi</CODE></P> | 196 output.avi</CODE></P> |
196 | 197 |
197 | 198 |
198 <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> |
199 | 200 |
200 <P><B>MEncoder</B> can handle input streams in two ways: <B>encode</B> or | 201 <P><B>MEncoder</B> can handle input streams in two ways: <B>encode</B> or |
201 <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> |
202 | 203 |
203 <UL> | 204 <UL> |
214 into the output stream. Use the <CODE>-audiofile <filename></CODE> | 215 into the output stream. Use the <CODE>-audiofile <filename></CODE> |
215 option for this.</LI> | 216 option for this.</LI> |
216 </UL> | 217 </UL> |
217 | 218 |
218 | 219 |
219 <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> |
220 | 221 |
221 <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 |
222 <B>MEncoder</B> generates the index. Of course this cannot fix possible bugs | 223 <B>MEncoder</B> generates the index. Of course this cannot fix possible bugs |
223 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 |
224 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 |
225 anymore.</P> | 226 anymore.</P> |
226 | 227 |
227 <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> |
228 | 229 |
229 | 230 |
230 <H4><A NAME="libavcodec">2.4.2.5 Encoding with the libavcodec codec family</A></H4> | 231 <H4><A NAME="libavcodec">2.4.2.5 Encoding with the libavcodec codec family</A></H4> |
231 | 232 |
232 <P><A HREF="codecs.html#libavcodec">libavcodec</A> provides simple encoding to a | 233 <P><A HREF="codecs.html#libavcodec">libavcodec</A> provides simple encoding to a |
233 lot of interesting video and audio formats (currently its audio codecs are | 234 lot of interesting video and audio formats (currently its audio codecs are |
234 unsupported). You can encode to the following codecs:</P> | 235 unsupported). You can encode to the following codecs:</P> |
235 | 236 |
250 <P>An example, with MJPEG compression:<BR> | 251 <P>An example, with MJPEG compression:<BR> |
251 <CODE> mencoder -dvd 2 -o title2.avi -ovc lavc | 252 <CODE> mencoder -dvd 2 -o title2.avi -ovc lavc |
252 -lavcopts vcodec=mjpeg -oac copy</CODE></P> | 253 -lavcopts vcodec=mjpeg -oac copy</CODE></P> |
253 | 254 |
254 | 255 |
255 <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> |
256 | 257 |
257 <P><B>MEncoder</B> is capable of creating movies from one or more JPEG, PNG or TGA | 258 <P><B>MEncoder</B> is capable of creating movies from one or more JPEG, PNG or TGA |
258 files. With simple framecopy it can create MJPEG (Motion JPEG), MPNG | 259 files. With simple framecopy it can create MJPEG (Motion JPEG), MPNG |
259 (Motion PNG) or MTGA (Motion TGA) files.</P> | 260 (Motion PNG) or MTGA (Motion TGA) files.</P> |
260 | 261 |
261 Explanation of the process: | 262 Explanation of the process: |
262 | 263 |
263 <OL> | 264 <OL> |
264 <LI><B>MEncoder</B> <I>decodes</I> the input image(s) with <CODE>libjpeg</CODE> | 265 <LI><B>MEncoder</B> <I>decodes</I> the input image(s) with |
265 (when decoding PNGs, it will use <B>libpng</B>).</LI> | 266 <CODE>libjpeg</CODE> (when decoding PNGs, it will use <B>libpng</B>).</LI> |
266 | 267 |
267 <LI><B>MEncoder</B> then feeds the decoded image to the chosen video compressor | 268 <LI><B>MEncoder</B> then feeds the decoded image to the chosen video compressor |
268 (DivX4, Xvid, ffmpeg msmpeg4, etc...). Watch for the PNG decoder, as | 269 (DivX4, Xvid, ffmpeg msmpeg4, etc...). Watch for the PNG decoder, as |
269 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 |
270 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> |
274 | 275 |
275 <P>The explanation of the <CODE>-mf</CODE> option can be found below in the | 276 <P>The explanation of the <CODE>-mf</CODE> option can be found below in the |
276 global <A HREF="#options">Options</A> section and in the man page.</P> | 277 global <A HREF="#options">Options</A> section and in the man page.</P> |
277 | 278 |
278 <P><I>Creating a DivX4 file from all the JPEG files in the current dir:</I><BR> | 279 <P><I>Creating a DivX4 file from all the JPEG files in the current dir:</I><BR> |
279 <CODE>mencoder \*.jpg -mf on:w=800:h=600:fps=25 -ovc divx4 -oac copy -o | 280 <CODE>mencoder \*.jpg -mf on:w=800:h=600:fps=25 -ovc divx4 |
280 output.avi</CODE></P> | 281 -oac copy -o output.avi</CODE></P> |
281 | 282 |
282 <P><I>Creating a DivX4 file from some JPEG files in the current dir:</I><BR> | 283 <P><I>Creating a DivX4 file from some JPEG files in the current dir:</I><BR> |
283 <CODE>mencoder frame001.jpg,frame002.jpg -mf on:w=800:h=600:fps=25 -ovc divx4 -oac copy -o | 284 <CODE>mencoder frame001.jpg,frame002.jpg -mf on:w=800:h=600:fps=25 |
284 output.avi</CODE></P> | 285 -ovc divx4 -oac copy -o output.avi</CODE></P> |
285 | 286 |
286 <P><I>Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current dir:</I><BR> | 287 <P><I>Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current dir:</I><BR> |
287 <CODE>mencoder \*.jpg -mf on:w=800:h=600:fps=25 -ovc copy | 288 <CODE>mencoder \*.jpg -mf on:w=800:h=600:fps=25 -ovc copy |
288 -oac copy -o output.avi</CODE></P> | 289 -oac copy -o output.avi</CODE></P> |
289 | 290 |
290 <P><I>Creating an uncompressed file from all the PNG files in the current dir:</I><BR> | 291 <P><I>Creating an uncompressed file from all the PNG files in the current dir:</I><BR> |
291 <CODE>mencoder \*.png -mf on:w=800:h=600:fps=25:type=png -ovc raw -oac copy -o | 292 <CODE>mencoder \*.png -mf on:w=800:h=600:fps=25:type=png -ovc raw |
292 output.avi</CODE></P> | 293 -oac copy -o output.avi</CODE></P> |
293 | 294 |
294 <P><I>Creating a Motion PNG (MPNG) file from all the PNG files in the current dir:</I><BR> | 295 <P><I>Creating a Motion PNG (MPNG) file from all the PNG files in the current dir:</I><BR> |
295 <CODE>mencoder \*.png -mf on:w=800:h=600:fps=25:type=png -ovc copy -oac copy | 296 <CODE>mencoder \*.png -mf on:w=800:h=600:fps=25:type=png -ovc copy |
296 -o output.avi</CODE></P> | 297 -oac copy -o output.avi</CODE></P> |
297 | 298 |
298 <P><I>Creating a Motion TGA (MTGA) file from all the TGA files in the current dir:</I><BR> | 299 <P><I>Creating a Motion TGA (MTGA) file from all the TGA files in the current dir:</I><BR> |
299 <CODE>mencoder \*.tga -mf on:w=800:h=600:fps=25:type=tga -ovc copy -oac copy | 300 <CODE>mencoder \*.tga -mf on:w=800:h=600:fps=25:type=tga -ovc copy |
300 -o output.avi</CODE></P> | 301 -oac copy -o output.avi</CODE></P> |
301 | 302 |
302 | 303 |
303 <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> |
304 | 305 |
305 <P><B>MEncoder</B> is capable of extracting subtitles from a DVD into | 306 <P><B>MEncoder</B> is capable of extracting subtitles from a DVD into |
306 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 |
307 <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 |
308 <CODE>.rar</CODE> archive. <B>MPlayer</B> can play these with the | 309 <CODE>.rar</CODE> archive. <B>MPlayer</B> can play these with the |
341 -vobsuboutindex 0 -vobsuboutid fr -sid 1</CODE></P> | 342 -vobsuboutindex 0 -vobsuboutid fr -sid 1</CODE></P> |
342 | 343 |
343 | 344 |
344 <H3><A NAME="options">2.4.3 Available options</A></H3> | 345 <H3><A NAME="options">2.4.3 Available options</A></H3> |
345 | 346 |
346 <P>For the complete list of available <B>MEncoder</B> options and examples, please | 347 <P>For the complete list of available <B>MEncoder</B> options and examples, |
347 see the man page.</P> | 348 please see the man page.</P> |
348 | 349 |
349 </BODY> | 350 </BODY> |
350 </HTML> | 351 </HTML> |