Mercurial > mplayer.hg
annotate DOCS/xml/en/mencoder.xml @ 16228:88ed8890152c
-fafmttag can be needed while steam copying.
author | gpoirier |
---|---|
date | Mon, 15 Aug 2005 16:30:31 +0000 |
parents | 809452f0da6e |
children | cf10f859d829 |
rev | line source |
---|---|
9675 | 1 <?xml version="1.0" encoding="iso-8859-1"?> |
10913
49b1a67e7381
Add revision keyword to english xml files, to ease translation synchronization
lumag
parents:
10869
diff
changeset
|
2 <!-- $Revision$ --> |
9675 | 3 <chapter id="mencoder"> |
16080
baae7cdb0726
re-organize MEncoder doc in a more sensible way: splitting "basic mencoder usage" and "encoding with mencoder".
gpoirier
parents:
16020
diff
changeset
|
4 <title>Basic usage of <application>MEncoder</application></title> |
9675 | 5 |
6 <para> | |
7 For the complete list of available <application>MEncoder</application> options | |
8 and examples, please see the man page. For a series of hands-on examples and | |
9 detailed guides on using several encoding parameters, read the | |
10 <ulink url="../../tech/encoding-tips.txt">encoding-tips</ulink> that were | |
15029 | 11 collected from several mailing list threads on MPlayer-users. Search the |
9675 | 12 <ulink url="http://mplayerhq.hu/pipermail/mplayer-users/">archives</ulink> |
13 for a wealth of discussions about all aspects of and problems related to | |
14 encoding with <application>MEncoder</application>. | |
15 </para> | |
16 | |
12400
903ac68f2bc8
divx --> lavc, spelling, more sensible section name
diego
parents:
12399
diff
changeset
|
17 <sect1 id="menc-feat-mpeg4"> |
14421 | 18 <title>Encoding two pass MPEG-4 ("DivX")</title> |
9675 | 19 |
20 <para> | |
21 The name comes from the fact that this method encodes the file <emphasis>twice</emphasis>. | |
22 The first encoding (dubbed pass) creates some temporary files | |
23 (<filename>*.log</filename>) with a size of few megabytes, do not delete | |
14421 | 24 them yet (you can delete the AVI). In the second pass, the two pass output |
9675 | 25 file is created, using the bitrate data from the temporary files. The |
26 resulting file will have much better image quality. If this is the first | |
27 time you heard about this, you should consult some guides available on the | |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
28 net. |
9675 | 29 </para> |
30 | |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
31 <example> |
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
32 <title>copy audio track</title> |
9675 | 33 <para> |
14421 | 34 Two pass encode of a DVD to an MPEG-4 ("DivX") AVI while copying |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
35 the audio track. |
9675 | 36 <screen> |
11710 | 37 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o <replaceable>movie.avi</replaceable> |
38 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o <replaceable>movie.avi</replaceable> | |
9675 | 39 </screen> |
40 </para> | |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
41 </example> |
9675 | 42 |
43 <example> | |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
44 <title>encode audio track</title> |
9675 | 45 <para> |
14421 | 46 Two pass encode of a DVD to an MPEG-4 ("DivX") AVI while encoding |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
47 the audio track to MP3. |
9675 | 48 <screen> |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
49 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac mp3lame -lameopts vbr=3 -o <replaceable>movie.avi</replaceable> |
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
50 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac mp3lame -lameopts vbr=3 -o <replaceable>movie.avi</replaceable> |
9675 | 51 </screen> |
52 </para> | |
53 </example> | |
54 </sect1> | |
55 | |
56 <sect1 id="menc-feat-mpeg"> | |
57 <title>Encoding to MPEG format</title> | |
58 <para> | |
59 <application>MEncoder</application> can create MPEG (MPEG-PS) format output | |
16157
809452f0da6e
Fix outdated "Encoding to MPEG format" (MEncoder improved a lot :-) )
gpoirier
parents:
16080
diff
changeset
|
60 files. |
809452f0da6e
Fix outdated "Encoding to MPEG format" (MEncoder improved a lot :-) )
gpoirier
parents:
16080
diff
changeset
|
61 Usually, when you are using MPEG-1 or MPEG-2 video, it is because you are |
809452f0da6e
Fix outdated "Encoding to MPEG format" (MEncoder improved a lot :-) )
gpoirier
parents:
16080
diff
changeset
|
62 encoding for a constrained format such as SVCD, VCD, or DVD. |
809452f0da6e
Fix outdated "Encoding to MPEG format" (MEncoder improved a lot :-) )
gpoirier
parents:
16080
diff
changeset
|
63 The specific requirements for these formats are explained in the |
809452f0da6e
Fix outdated "Encoding to MPEG format" (MEncoder improved a lot :-) )
gpoirier
parents:
16080
diff
changeset
|
64 <link linkend="menc-feat-vcd-dvd"> VCD and DVD creation guide</link> |
809452f0da6e
Fix outdated "Encoding to MPEG format" (MEncoder improved a lot :-) )
gpoirier
parents:
16080
diff
changeset
|
65 section. |
9675 | 66 </para> |
67 | |
68 <para> | |
12578 | 69 To change <application>MEncoder</application>'s output file format, |
11540 | 70 use the <option>-of mpeg</option> option. |
9675 | 71 </para> |
72 | |
73 <para> | |
74 Example: | |
75 <screen> | |
11710 | 76 mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video -oac copy <replaceable>other_options</replaceable> <replaceable>media.avi</replaceable> -o <replaceable>output.mpg</replaceable> |
9675 | 77 </screen> |
78 </para> | |
79 </sect1> | |
80 | |
81 <sect1 id="menc-feat-rescale"> | |
82 <title>Rescaling movies</title> | |
83 | |
84 <para> | |
85 Often the need to resize movie images' size emerges. Its reasons can be | |
86 many: decreasing file size, network bandwidth,etc. Most people even do | |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
87 rescaling when converting DVDs or SVCDs to DivX AVI. If you wish to rescale, |
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
88 read the <link linkend="aspect">Preserving aspect ratio</link> section. |
9675 | 89 </para> |
90 | |
91 <para> | |
92 The scaling process is handled by the <literal>scale</literal> video filter: | |
9677 | 93 <option>-vf scale=<replaceable>width</replaceable>:<replaceable>height</replaceable></option>. |
9675 | 94 Its quality can be set with the <option>-sws</option> option. |
15329 | 95 If it is not specified, <application>MEncoder</application> will use 2: bicubic. |
9675 | 96 </para> |
97 | |
98 <para> | |
99 Usage: | |
100 <screen> | |
12484
58056bc98dd9
Remove 3-pass encoding guide (can break A/V sync), rescaling is not
diego
parents:
12400
diff
changeset
|
101 mencoder <replaceable>input.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=640:480 -o <replaceable>output.avi</replaceable> |
9675 | 102 </screen> |
103 </para> | |
104 </sect1> | |
105 | |
106 | |
107 <sect1 id="menc-feat-streamcopy"> | |
108 <title>Stream copying</title> | |
109 | |
110 <para> | |
111 <application>MEncoder</application> can handle input streams in two ways: | |
112 <emphasis role="bold">encode</emphasis> or <emphasis role="bold">copy</emphasis> | |
113 them. This section is about <emphasis role="bold">copying</emphasis>. | |
114 </para> | |
115 | |
116 <itemizedlist> | |
117 <listitem><para> | |
118 <emphasis role="bold">Video stream</emphasis> (option <option>-ovc copy</option>): | |
119 nice stuff can be done :) Like, putting (not converting!) FLI or VIVO or | |
14024 | 120 MPEG-1 video into an AVI file! Of course only |
9675 | 121 <application>MPlayer</application> can play such files :) And it probably |
122 has no real life value at all. Rationally: video stream copying can be | |
123 useful for example when only the audio stream has to be encoded (like, | |
124 uncompressed PCM to MP3). | |
125 </para></listitem> | |
126 <listitem><para> | |
127 <emphasis role="bold">Audio stream</emphasis> (option <option>-oac copy</option>): | |
12758
250ce1b2ef8f
improved DVD ripping guide by Jason Tackaberry <tack@sault.org>
diego
parents:
12615
diff
changeset
|
128 straightforward. It is possible to take an external audio file (MP3, |
10429 | 129 WAV) and mux it into the output stream. Use the |
9675 | 130 <option>-audiofile <replaceable>filename</replaceable></option> option |
131 for this. | |
132 </para></listitem> | |
133 </itemizedlist> | |
16228 | 134 |
135 <para> | |
136 Using <option>-oac copy</option> to copy from one container format to | |
137 another may require the use of <option>-fafmttag</option> to keep the | |
138 audio format tag of the original file. | |
139 For example, if you are converting an NSV file with AAC audio to an AVI | |
140 container, the audio format tag will be incorrect and it will have to | |
141 be changed. For a list of audio format tags, check | |
142 <filename>codecs.conf</filename>. | |
143 </para> | |
144 | |
145 <para> | |
146 Example: | |
147 <screen> | |
148 mencoder <replaceable>input.nsv</replaceable> -oac copy -fafmttag 0x706D -ovc lavc -lavcopts vcodec=mpeg4 -o <replaceable>output.avi</replaceable> | |
149 </screen> | |
150 </para> | |
151 | |
9675 | 152 </sect1> |
153 | |
154 | |
155 <sect1 id="menc-feat-enc-images"> | |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
156 <title>Encoding from multiple input image files (JPEG, PNG, TGA, SGI)</title> |
9675 | 157 |
158 <para> | |
159 <application>MEncoder</application> is capable of creating movies from one | |
12758
250ce1b2ef8f
improved DVD ripping guide by Jason Tackaberry <tack@sault.org>
diego
parents:
12615
diff
changeset
|
160 or more JPEG, PNG or TGA files. With simple framecopy it can create MJPEG |
9675 | 161 (Motion JPEG), MPNG (Motion PNG) or MTGA (Motion TGA) files. |
162 </para> | |
163 | |
164 <orderedlist> | |
165 <title>Explanation of the process:</title> | |
166 <listitem><para> | |
167 <application>MEncoder</application> <emphasis>decodes</emphasis> the input image(s) with | |
168 <systemitem class="library">libjpeg</systemitem> (when decoding PNGs, it | |
169 will use <systemitem class="library">libpng</systemitem>). | |
170 </para></listitem> | |
171 <listitem><para> | |
172 <application>MEncoder</application> then feeds the decoded image to the | |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
173 chosen video compressor (DivX4, XviD, FFmpeg msmpeg4, etc.). |
9675 | 174 </para></listitem> |
175 </orderedlist> | |
176 | |
177 <formalpara> | |
178 <title>Examples</title> | |
179 <para> | |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
180 The explanation of the <option>-mf</option> option is in the man page. |
9675 | 181 |
182 <informalexample> | |
183 <para> | |
14024 | 184 Creating an MPEG-4 file from all the JPEG files in the current directory: |
9675 | 185 <screen> |
14093
3bf74bf969ff
Unify all image encoding examples and fix a typo (*.jpg vs *.png) noticed
diego
parents:
14024
diff
changeset
|
186 mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o <replaceable>output.avi</replaceable> |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
187 </screen> |
9675 | 188 </para> |
189 </informalexample> | |
190 | |
191 <informalexample> | |
192 <para> | |
14024 | 193 Creating an MPEG-4 file from some JPEG files in the current directory: |
9675 | 194 <screen> |
14093
3bf74bf969ff
Unify all image encoding examples and fix a typo (*.jpg vs *.png) noticed
diego
parents:
14024
diff
changeset
|
195 mencoder mf://<replaceable>frame001.jpg,frame002.jpg</replaceable> -mf w=800:h=600:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o <replaceable>output.avi</replaceable> |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
196 </screen> |
9675 | 197 </para> |
198 </informalexample> | |
199 | |
200 <informalexample> | |
201 <para> | |
202 Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current | |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
203 directory: |
9675 | 204 <screen> |
14093
3bf74bf969ff
Unify all image encoding examples and fix a typo (*.jpg vs *.png) noticed
diego
parents:
14024
diff
changeset
|
205 mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc copy -oac copy -o <replaceable>output.avi</replaceable> |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
206 </screen> |
9675 | 207 </para> |
208 </informalexample> | |
209 | |
210 <informalexample> | |
211 <para> | |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
212 Creating an uncompressed file from all the PNG files in the current directory: |
9675 | 213 <screen> |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
214 mencoder mf:// -mf w=800:h=600:fps=25:type=png -ovc raw -oac copy -o <replaceable>output.avi</replaceable> |
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
215 </screen> |
9675 | 216 </para> |
217 </informalexample> | |
218 | |
219 <note><para> | |
15329 | 220 Width must be integer multiple of 4, it is a limitation of the RAW RGB AVI format. |
9675 | 221 </para></note> |
222 | |
223 <informalexample> | |
224 <para> | |
225 Creating a Motion PNG (MPNG) file from all the PNG files in the current | |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
226 directory: |
9675 | 227 <screen> |
14093
3bf74bf969ff
Unify all image encoding examples and fix a typo (*.jpg vs *.png) noticed
diego
parents:
14024
diff
changeset
|
228 mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o <replaceable>output.avi</replaceable> <!-- |
9675 | 229 --></screen> |
230 </para> | |
231 </informalexample> | |
232 | |
233 <informalexample> | |
234 <para> | |
235 Creating a Motion TGA (MTGA) file from all the TGA files in the current | |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
236 directory: |
9675 | 237 <screen> |
12399
9403b245fcda
Obsolet -mf syntax replaced by mf://, based on a patch sent by Compn, bug
diego
parents:
11913
diff
changeset
|
238 mencoder mf://*.tga -mf w=800:h=600:fps=25:type=tga -ovc copy -oac copy -o <replaceable>output.avi</replaceable><!-- |
9675 | 239 --></screen> |
240 </para> | |
241 </informalexample> | |
242 | |
243 </para> | |
244 </formalpara> | |
245 </sect1> | |
246 | |
247 | |
248 <sect1 id="menc-feat-extractsub"> | |
12615 | 249 <title>Extracting DVD subtitles to VOBsub file</title> |
9675 | 250 |
251 <para> | |
252 <application>MEncoder</application> is capable of extracting subtitles from | |
12615 | 253 a DVD into VOBsub formatted files. They consist of a pair of files ending in |
9675 | 254 <filename>.idx</filename> and <filename>.sub</filename> and are usually |
255 packaged in a single <filename>.rar</filename> archive. | |
256 <application>MPlayer</application> can play these with the | |
257 <option>-vobsub</option> and <option>-vobsubid</option> options. | |
258 </para> | |
259 | |
260 <para> | |
261 You specify the basename (i.e without the <filename>.idx</filename> or | |
262 <filename>.sub</filename> extension) of the output files with | |
263 <option>-vobsubout</option> and the index for this subtitle in the | |
264 resulting files with <option>-vobsuboutindex</option>. | |
265 </para> | |
266 | |
267 <para> | |
268 If the input is not from a DVD you should use <option>-ifo</option> to | |
269 indicate the <filename>.ifo</filename> file needed to construct the | |
270 resulting <filename>.idx</filename> file. | |
271 </para> | |
272 | |
273 <para> | |
274 If the input is not from a DVD and you do not have the | |
275 <filename>.ifo</filename> file you will need to use the | |
276 <option>-vobsubid</option> option to let it know what language id to put in | |
277 the <filename>.idx</filename> file. | |
278 </para> | |
279 | |
280 <para> | |
281 Each run will append the running subtitle if the <filename>.idx</filename> | |
282 and <filename>.sub</filename> files already exist. So you should remove any | |
283 before starting. | |
284 </para> | |
285 | |
286 <example> | |
14421 | 287 <title>Copying two subtitles from a DVD while doing two pass encoding</title> |
9675 | 288 <screen> |
289 rm subtitles.idx subtitles.sub | |
12776 | 290 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -vobsubout subtitles -vobsuboutindex 0 -sid 2 |
12400
903ac68f2bc8
divx --> lavc, spelling, more sensible section name
diego
parents:
12399
diff
changeset
|
291 mencoder dvd://1 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -vobsubout subtitles -vobsuboutindex 1 -sid 5<!-- |
9675 | 292 --></screen> |
293 </example> | |
294 | |
295 <example> | |
296 <title>Copying a french subtitle from an MPEG file</title> | |
297 <screen> | |
298 rm subtitles.idx subtitles.sub | |
15492 | 299 mencoder <replaceable>movie.mpg</replaceable> -ifo <replaceable>movie.ifo</replaceable> -vobsubout subtitles -vobsuboutindex 0 -vobsuboutid fr -sid 1 -nosound -ovc copy |
300 </screen> | |
9675 | 301 </example> |
302 | |
303 </sect1> | |
304 | |
305 <sect1 id="aspect"> | |
306 <title>Preserving aspect ratio</title> | |
307 <para> | |
14024 | 308 DVDs and SVCDs (i.e. MPEG-1/2) files contain an aspect ratio value, which |
15329 | 309 describes how the player should scale the video stream, so humans will not |
9675 | 310 have egg heads (ex.: 480x480 + 4:3 = 640x480). However when encoding to AVI |
15329 | 311 (DivX) files, you have be aware that AVI headers do not store this value. |
10065
422876da049e
Error in the aspect ratio calculation, plus typos and rewordings.
diego
parents:
9677
diff
changeset
|
312 Rescaling the movie is disgusting and time consuming, there has to be a better |
422876da049e
Error in the aspect ratio calculation, plus typos and rewordings.
diego
parents:
9677
diff
changeset
|
313 way! |
9675 | 314 </para> |
315 | |
316 <para>There is</para> | |
317 | |
318 <para> | |
14024 | 319 MPEG-4 has an unique feature: the video stream can contain its needed aspect |
320 ratio. Yes, just like MPEG-1/2 (DVD, SVCD) and H.263 files. Regretfully, there are | |
9675 | 321 <emphasis role="bold">no</emphasis> video players outside which support this |
14024 | 322 attribute of MPEG-4, except <application>MPlayer</application>. |
9675 | 323 </para> |
324 | |
325 <para> | |
11822
359eaf957bf1
Add <systemitem class="library"> tags to libavcodec and a few others.
diego
parents:
11820
diff
changeset
|
326 This feature can be used only with |
359eaf957bf1
Add <systemitem class="library"> tags to libavcodec and a few others.
diego
parents:
11820
diff
changeset
|
327 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link>'s |
10869 | 328 <systemitem>mpeg4</systemitem> codec. Keep in mind: although |
329 <application>MPlayer</application> will correctly play the created file, | |
330 other players will use the wrong aspect ratio. | |
9675 | 331 </para> |
332 | |
333 <para> | |
334 You seriously should crop the black bands over and below the movie image. | |
10065
422876da049e
Error in the aspect ratio calculation, plus typos and rewordings.
diego
parents:
9677
diff
changeset
|
335 See the man page for the usage of the <systemitem>cropdetect</systemitem> and |
9675 | 336 <systemitem>crop</systemitem> filters. |
337 </para> | |
338 | |
339 <para> | |
10869 | 340 Usage |
11710 | 341 <screen>mencoder <replaceable>sample-svcd.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4:autoaspect -vf crop=714:548:0:14 -oac copy -o <replaceable>output.avi</replaceable></screen> |
9675 | 342 </para> |
10869 | 343 </sect1> |
344 | |
9675 | 345 </chapter> |