Mercurial > mplayer.hg
annotate DOCS/xml/en/mencoder.xml @ 10869:364d43cee33e
sync with HTML
author | diego |
---|---|
date | Mon, 15 Sep 2003 01:21:04 +0000 |
parents | 3cabc04945c9 |
children | 49b1a67e7381 |
rev | line source |
---|---|
9675 | 1 <?xml version="1.0" encoding="iso-8859-1"?> |
2 <chapter id="mencoder"> | |
3 <title>Encoding with MEncoder</title> | |
4 | |
5 <para> | |
6 For the complete list of available <application>MEncoder</application> options | |
7 and examples, please see the man page. For a series of hands-on examples and | |
8 detailed guides on using several encoding parameters, read the | |
9 <ulink url="../../tech/encoding-tips.txt">encoding-tips</ulink> that were | |
10 collected from several mailing list threads on mplayer-users. Search the | |
11 <ulink url="http://mplayerhq.hu/pipermail/mplayer-users/">archives</ulink> | |
12 for a wealth of discussions about all aspects of and problems related to | |
13 encoding with <application>MEncoder</application>. | |
14 </para> | |
15 | |
16 <sect1 id="menc-feat-divx4"> | |
17 <title>Encoding 2 or 3-pass MPEG-4 ("DivX")</title> | |
18 | |
19 <formalpara> | |
20 <title>2-pass encoding</title> | |
21 <para> | |
22 The name comes from the fact that this method encodes the file <emphasis>twice</emphasis>. | |
23 The first encoding (dubbed pass) creates some temporary files | |
24 (<filename>*.log</filename>) with a size of few megabytes, do not delete | |
25 them yet (you can delete the AVI). In the second pass, the 2-pass output | |
26 file is created, using the bitrate data from the temporary files. The | |
27 resulting file will have much better image quality. If this is the first | |
28 time you heard about this, you should consult some guides available on the | |
29 Net. | |
30 </para> | |
31 </formalpara> | |
32 | |
33 <para> | |
34 This example shows how to encode a DVD to a 2-pass MPEG-4 ("DivX") AVI. | |
35 Just two commands are needed: | |
36 <screen>rm frameno.avi</screen> | |
37 remove this file, which can come from a previous 3-pass encoding (it interferes | |
38 with current one) | |
39 <screen> | |
10184
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
40 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o movie.avi |
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
41 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o movie.avi |
9675 | 42 </screen> |
43 </para> | |
44 | |
45 <formalpara> | |
46 <title>3-pass encoding</title> | |
47 <para> | |
48 This is an extension of 2-pass encoding, where the audio encoding takes | |
49 place in a separate pass. This method enables estimation of recommended | |
50 video bitrate in order to fit on a CD. Also, the audio is encoded only | |
51 once, unlike in 2-pass mode. The schematics: | |
52 </para> | |
53 </formalpara> | |
54 | |
55 <procedure> | |
56 <step><para> | |
57 Remove conflicting temporary file: | |
58 <screen>rm frameno.avi</screen> | |
59 </para></step> | |
60 <step><para> | |
61 <emphasis>First pass:</emphasis> | |
62 | |
63 <screen>mencoder <replaceable>file/DVD</replaceable> -ovc frameno -oac mp3lame -lameopts vbr=3 -o frameno.avi</screen> | |
64 | |
65 An audio-only avi file will be created, containing | |
66 <emphasis role="bold">only</emphasis> the requested audio stream. Don't forget | |
67 <option>-lameopts</option>, if you need to set it. If you were encoding a | |
68 long movie, <application>MEncoder</application> prints the recommended | |
69 bitrate values for 650Mb, 700Mb, and 800Mb destination sizes, after this | |
70 pass finishes. | |
71 </para></step> | |
72 <step><para> | |
73 <emphasis>Second pass:</emphasis> | |
74 <screen> | |
75 mencoder <replaceable>file/DVD</replaceable> -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=<replaceable>bitrate</replaceable><!-- | |
76 --></screen> | |
77 This is the first pass of video encoding. Optionally specify the video | |
78 bitrate MEncoder printed at the end of the previous pass. | |
79 </para></step> | |
80 <step><para> | |
81 <emphasis>Third pass:</emphasis> | |
82 <screen> | |
83 mencoder <replaceable>file/DVD</replaceable> -oac copy -pass 2 \ | |
84 -ovc divx4 -divx4opts br=<replaceable>bitrate</replaceable> | |
85 </screen> | |
86 This is the second pass of video encoding. Specify the same bitrate | |
87 as in the previous pass unless you really know what you are doing. | |
88 In this pass, audio from <filename>frameno.avi</filename> will be | |
89 inserted into the destination file...and it's all ready! | |
90 </para></step> | |
91 </procedure> | |
92 | |
93 <example> | |
94 <title>Example of 3-pass encoding</title> | |
95 <para> | |
96 <screen>rm frameno.avi</screen> | |
97 remove this file, which can come from a previous 3-pass encoding | |
98 (it interferes with current one) | |
99 <screen> | |
10184
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
100 mencoder dvd://2 -ovc frameno -o frameno.avi -oac mp3lame -lameopts vbr=3 |
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
101 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac copy -o movie.avi |
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
102 mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac copy -o movie.avi |
9675 | 103 </screen> |
104 </para> | |
105 </example> | |
106 </sect1> | |
107 | |
108 <sect1 id="menc-feat-mpeg"> | |
109 <title>Encoding to MPEG format</title> | |
110 <para> | |
111 <application>MEncoder</application> can create MPEG (MPEG-PS) format output | |
10869 | 112 files. It's probably useful only with <link linkend="ffmpeg">libavcodec</link>'s |
113 <emphasis>mpeg1video</emphasis> codec, because players - except | |
114 <application>MPlayer</application> - expect MPEG1 video, and MPEG1 layer 2 (MP2) | |
115 audio streams in MPEG files. | |
9675 | 116 </para> |
117 | |
118 <para> | |
119 this feature is not very useful right now, aside that it probably has many bugs, | |
120 but the more importantly because MEncoder currently cannot encode MPEG1 layer 2 | |
121 (MP2) audio, which all other players expect in MPEG files. | |
122 </para> | |
123 | |
124 <para> | |
125 To change MEncoder's output file format, use the <option>-of mpeg</option> option. | |
126 </para> | |
127 | |
128 <para> | |
129 Example: | |
130 <screen> | |
131 mencoder -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video -oac copy <replaceable>other options</replaceable> media.avi -o output.mpg | |
132 </screen> | |
133 </para> | |
134 </sect1> | |
135 | |
136 | |
137 <sect1 id="menc-feat-rescale"> | |
138 <title>Rescaling movies</title> | |
139 | |
140 <para> | |
141 Often the need to resize movie images' size emerges. Its reasons can be | |
142 many: decreasing file size, network bandwidth,etc. Most people even do | |
143 rescaling when converting DVDs or SVCDs to DivX AVI. This is <emphasis role="bold">bad</emphasis>. | |
144 Instead of even you doing so, read the <link linkend="aspect">Preserving aspect ratio</link> | |
145 section. | |
146 </para> | |
147 | |
148 <para> | |
149 The scaling process is handled by the <literal>scale</literal> video filter: | |
9677 | 150 <option>-vf scale=<replaceable>width</replaceable>:<replaceable>height</replaceable></option>. |
9675 | 151 Its quality can be set with the <option>-sws</option> option. |
152 If it's not specified, <application>MEncoder</application> will use 0: fast | |
153 bilinear. | |
154 </para> | |
155 | |
156 <para> | |
157 Usage: | |
158 <screen> | |
9677 | 159 mencoder <replaceable>input.mpg</replaceable> -ovc lavc -lavcopts vcodec=mpeg4 -vf scale=640:480-o <replaceable>output.avi</replaceable> |
9675 | 160 </screen> |
161 </para> | |
162 </sect1> | |
163 | |
164 | |
165 <sect1 id="menc-feat-streamcopy"> | |
166 <title>Stream copying</title> | |
167 | |
168 <para> | |
169 <application>MEncoder</application> can handle input streams in two ways: | |
170 <emphasis role="bold">encode</emphasis> or <emphasis role="bold">copy</emphasis> | |
171 them. This section is about <emphasis role="bold">copying</emphasis>. | |
172 </para> | |
173 | |
174 <itemizedlist> | |
175 <listitem><para> | |
176 <emphasis role="bold">Video stream</emphasis> (option <option>-ovc copy</option>): | |
177 nice stuff can be done :) Like, putting (not converting!) FLI or VIVO or | |
178 MPEG1 video into an AVI file! Of course only | |
179 <application>MPlayer</application> can play such files :) And it probably | |
180 has no real life value at all. Rationally: video stream copying can be | |
181 useful for example when only the audio stream has to be encoded (like, | |
182 uncompressed PCM to MP3). | |
183 </para></listitem> | |
184 <listitem><para> | |
185 <emphasis role="bold">Audio stream</emphasis> (option <option>-oac copy</option>): | |
186 straightforward. It is possible to take an external audio file (MP3, | |
10429 | 187 WAV) and mux it into the output stream. Use the |
9675 | 188 <option>-audiofile <replaceable>filename</replaceable></option> option |
189 for this. | |
190 </para></listitem> | |
191 </itemizedlist> | |
192 </sect1> | |
193 | |
194 | |
195 <sect1 id="menc-feat-fix-avi"> | |
196 <title>Fixing AVIs with broken index or interleaving</title> | |
197 | |
198 <para> | |
199 Easiest thing. We simply copy the video and audio streams, and | |
200 <application>MEncoder</application> generates the index. Of course this cannot fix possible bugs in | |
201 the video and/or audio streams. It also fixes files with broken interleaving, | |
202 thus the <option>-ni</option> option won't be needed for them anymore. | |
203 </para> | |
204 | |
205 <para> | |
206 Command: | |
207 <screen> | |
208 mencoder -idx <replaceable>input.avi</replaceable> -ovc copy -oac copy -o <replaceable>output.avi</replaceable><!-- | |
209 --></screen> | |
210 </para> | |
211 | |
212 | |
213 <sect2 id="menc-feat-appending"> | |
214 <title>Appending multiple AVI files</title> | |
215 | |
216 <para> | |
217 As a side-effect, the broken AVI fixer function enables MEncoder to append | |
218 2 (or more) AVI files: | |
219 </para> | |
220 | |
221 <para> | |
222 Command: | |
223 <screen>cat 1.avi 2.avi | mencoder -noidx -ovc copy -oac copy -o output.avi -</screen> | |
224 </para> | |
225 | |
226 <note><para> | |
227 This expects <filename>1.avi</filename> and <filename>2.avi</filename> to use | |
228 the same codecs, resolution, stream rate etc, and at least <filename>1.avi</filename> | |
229 must not be broken. You may need to fix your input AVI files first, as described | |
230 <link linkend="menc-feat-fix-avi">above</link>. | |
231 </para></note> | |
232 </sect2> | |
233 </sect1> | |
234 | |
235 <sect1 id="menc-feat-enc-libavcodec"> | |
236 <title>Encoding with the libavcodec codec family</title> | |
237 | |
238 <para> | |
239 <link linkend="ffmpeg">libavcodec</link> provides simple encoding to a lot | |
240 of interesting video and audio formats (currently its audio codecs are | |
10869 | 241 unsupported). You can encode to the following codecs (more or less up to date): |
9675 | 242 |
243 <informaltable frame="all"> | |
244 <tgroup cols="2"> | |
245 <thead> | |
246 <row><entry>Codec name</entry><entry>Description</entry></row> | |
247 </thead> | |
248 <tbody> | |
249 <row><entry>mjpeg</entry><entry> | |
250 Motion JPEG | |
251 </entry></row> | |
10869 | 252 <row><entry>ljpeg</entry><entry> |
253 Lossless JPEG | |
254 </entry></row> | |
9675 | 255 <row><entry>h263</entry><entry> |
256 H263 | |
257 </entry></row> | |
258 <row><entry>h263p</entry><entry> | |
259 H263 Plus | |
260 </entry></row> | |
261 <row><entry>mpeg4</entry><entry> | |
262 ISO standard MPEG-4 (DivX 5, XVID compatible) | |
263 </entry></row> | |
264 <row><entry>msmpeg4</entry><entry> | |
265 pre-standard MPEG-4 variant by MS, v3 (aka DivX3) | |
266 </entry></row> | |
267 <row><entry>msmpeg4v2</entry><entry> | |
268 pre-standard MPEG-4 by MS, v2 (used in old asf files) | |
269 </entry></row> | |
10869 | 270 <row><entry>wmv1</entry><entry> |
9675 | 271 Windows Media Video, version 1 (aka WMV7) |
272 </entry></row> | |
10869 | 273 <row><entry>wmv2</entry><entry> |
274 Windows Media Video, version 2 (aka WMV8) | |
275 </entry></row> | |
9675 | 276 <row><entry>rv10</entry><entry> |
277 an old RealVideo codec | |
278 </entry></row> | |
279 <row><entry>mpeg1video</entry><entry> | |
10869 | 280 MPEG1 video |
281 </entry></row> | |
282 <row><entry>mpeg2video</entry><entry> | |
283 MPEG2 video | |
9675 | 284 </entry></row> |
285 <row><entry>huffyuv</entry><entry> | |
286 lossless compression | |
287 </entry></row> | |
10869 | 288 <row><entry>asv1</entry><entry> |
289 ASUS Video v1 | |
290 </entry></row> | |
291 <row><entry>asv2</entry><entry> | |
292 ASUS Video v2 | |
293 </entry></row> | |
294 <row><entry>ffv1</entry><entry> | |
295 FFmpeg's lossless video codec | |
296 </entry></row> | |
9675 | 297 </tbody> |
298 </tgroup> | |
299 </informaltable> | |
300 | |
301 The first column contains the codec names that should be passed after the | |
302 <literal>vcodec</literal> config, like: <option>-lavcopts vcodec=msmpeg4</option> | |
303 </para> | |
304 | |
305 <informalexample> | |
306 <para> | |
307 An example, with MJPEG compression: | |
10184
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
308 <screen>mencoder dvd://2 -o title2.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy</screen> |
9675 | 309 </para> |
310 </informalexample> | |
311 </sect1> | |
312 | |
313 | |
314 <sect1 id="menc-feat-enc-images"> | |
315 <title>Encoding from multiple input image files (JPEGs,PNGs or TGAs)</title> | |
316 | |
317 <para> | |
318 <application>MEncoder</application> is capable of creating movies from one | |
319 or more JPEG, PNG or TGA files. With simple framecopy it can create MJPEG | |
320 (Motion JPEG), MPNG (Motion PNG) or MTGA (Motion TGA) files. | |
321 </para> | |
322 | |
323 <orderedlist> | |
324 <title>Explanation of the process:</title> | |
325 <listitem><para> | |
326 <application>MEncoder</application> <emphasis>decodes</emphasis> the input image(s) with | |
327 <systemitem class="library">libjpeg</systemitem> (when decoding PNGs, it | |
328 will use <systemitem class="library">libpng</systemitem>). | |
329 </para></listitem> | |
330 <listitem><para> | |
331 <application>MEncoder</application> then feeds the decoded image to the | |
332 chosen video compressor (DivX4, Xvid, ffmpeg msmpeg4, etc.). | |
333 </para></listitem> | |
334 </orderedlist> | |
335 | |
336 <formalpara> | |
337 <title>Examples</title> | |
338 <para> | |
339 The explanation of the <option>-mf</option> option can be found below in | |
340 the man page. | |
341 | |
342 <informalexample> | |
343 <para> | |
344 Creating a DivX4 file from all the JPEG files in the current dir: | |
345 <screen> | |
346 mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi \*.jpg<!-- | |
347 --></screen> | |
348 </para> | |
349 </informalexample> | |
350 | |
351 <informalexample> | |
352 <para> | |
353 Creating a DivX4 file from some JPEG files in the current dir: | |
354 <screen> | |
355 mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi frame001.jpg,frame002.jpg <!-- | |
356 --></screen> | |
357 </para> | |
358 </informalexample> | |
359 | |
360 <informalexample> | |
361 <para> | |
362 Creating a Motion JPEG (MJPEG) file from all the JPEG files in the current | |
363 dir: | |
364 <screen> | |
365 mencoder -mf on:w=800:h=600:fps=25 -ovc copy -o output.avi \*.jpg<!-- | |
366 --></screen> | |
367 </para> | |
368 </informalexample> | |
369 | |
370 <informalexample> | |
371 <para> | |
372 Creating an uncompressed file from all the PNG files in the current dir: | |
373 <screen> | |
374 mencoder -mf on:w=800:h=600:fps=25:type=png -ovc raw -o output.avi \*.png<!-- | |
375 --></screen> | |
376 </para> | |
377 </informalexample> | |
378 | |
379 <note><para> | |
380 Width must be integer multiple of 4, it's a limitation of the RAW RGB AVI format. | |
381 </para></note> | |
382 | |
383 <informalexample> | |
384 <para> | |
385 Creating a Motion PNG (MPNG) file from all the PNG files in the current | |
386 dir: | |
387 <screen> | |
388 mencoder -mf on:w=800:h=600:fps=25:type=png -ovc copy -o output.avi \*.png<!-- | |
389 --></screen> | |
390 </para> | |
391 </informalexample> | |
392 | |
393 <informalexample> | |
394 <para> | |
395 Creating a Motion TGA (MTGA) file from all the TGA files in the current | |
396 dir: | |
397 <screen> | |
398 mencoder -mf on:w=800:h=600:fps=25:type=tga -ovc copy -o output.avi \*.tga<!-- | |
399 --></screen> | |
400 </para> | |
401 </informalexample> | |
402 | |
403 </para> | |
404 </formalpara> | |
405 </sect1> | |
406 | |
407 | |
408 <sect1 id="menc-feat-extractsub"> | |
409 <title>Extracting DVD subtitles to Vobsub file</title> | |
410 | |
411 <para> | |
412 <application>MEncoder</application> is capable of extracting subtitles from | |
413 a DVD into Vobsub fomat files. They consist of a pair of files ending in | |
414 <filename>.idx</filename> and <filename>.sub</filename> and are usually | |
415 packaged in a single <filename>.rar</filename> archive. | |
416 <application>MPlayer</application> can play these with the | |
417 <option>-vobsub</option> and <option>-vobsubid</option> options. | |
418 </para> | |
419 | |
420 <para> | |
421 You specify the basename (i.e without the <filename>.idx</filename> or | |
422 <filename>.sub</filename> extension) of the output files with | |
423 <option>-vobsubout</option> and the index for this subtitle in the | |
424 resulting files with <option>-vobsuboutindex</option>. | |
425 </para> | |
426 | |
427 <para> | |
428 If the input is not from a DVD you should use <option>-ifo</option> to | |
429 indicate the <filename>.ifo</filename> file needed to construct the | |
430 resulting <filename>.idx</filename> file. | |
431 </para> | |
432 | |
433 <para> | |
434 If the input is not from a DVD and you do not have the | |
435 <filename>.ifo</filename> file you will need to use the | |
436 <option>-vobsubid</option> option to let it know what language id to put in | |
437 the <filename>.idx</filename> file. | |
438 </para> | |
439 | |
440 <para> | |
441 Each run will append the running subtitle if the <filename>.idx</filename> | |
442 and <filename>.sub</filename> files already exist. So you should remove any | |
443 before starting. | |
444 </para> | |
445 | |
446 <example> | |
447 <title>Copying two subtitles from a DVD while doing 3-pass encoding</title> | |
448 <screen> | |
449 rm subtitles.idx subtitles.sub | |
10184
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
450 mencoder dvd://1 -vobsubout subtitles -vobsuboutindex 0 -sid 2 -o frameno.avi -ovc frameno |
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
451 mencoder dvd://1 -oac copy -ovc divx4 -pass 1 |
b6c63ab184a4
Changed a few remaining -dvd and -vcd options to dvd:// and vcd://.
diego
parents:
10065
diff
changeset
|
452 mencoder dvd://1 -oac copy -ovc divx4 -pass 2 -vobsubout subtitles -vobsuboutindex 1 -sid 5<!-- |
9675 | 453 --></screen> |
454 </example> | |
455 | |
456 <example> | |
457 <title>Copying a french subtitle from an MPEG file</title> | |
458 <screen> | |
459 rm subtitles.idx subtitles.sub | |
460 mencoder movie.mpg -ifo movie.ifo -vobsubout subtitles -vobsuboutindex 0 -vobsuboutid fr -sid 1<!-- | |
461 --></screen> | |
462 </example> | |
463 | |
464 </sect1> | |
465 | |
466 <sect1 id="aspect"> | |
467 <title>Preserving aspect ratio</title> | |
468 <para> | |
469 DVDs and SVCDs (i.e. MPEG1/2) files contain an aspect ratio value, which | |
10065
422876da049e
Error in the aspect ratio calculation, plus typos and rewordings.
diego
parents:
9677
diff
changeset
|
470 describes how the player should scale the video stream, so humans won't |
9675 | 471 have egg heads (ex.: 480x480 + 4:3 = 640x480). However when encoding to AVI |
472 (DivX) files, you have be aware that AVI headers don't store this value. | |
10065
422876da049e
Error in the aspect ratio calculation, plus typos and rewordings.
diego
parents:
9677
diff
changeset
|
473 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
|
474 way! |
9675 | 475 </para> |
476 | |
477 <para>There is</para> | |
478 | |
479 <para> | |
480 MPEG4 has an unique feature: the video stream can contain its needed aspect | |
10869 | 481 ratio. Yes, just like MPEG1/2 (DVD, SVCD) and H263 files. Regretfully, there are |
9675 | 482 <emphasis role="bold">no</emphasis> video players outside which support this |
10869 | 483 attribute of MPEG4, except <application>MPlayer</application>. |
9675 | 484 </para> |
485 | |
486 <para> | |
10869 | 487 This feature can be used only with <link linkend="ffmpeg">libavcodec</link>'s |
488 <systemitem>mpeg4</systemitem> codec. Keep in mind: although | |
489 <application>MPlayer</application> will correctly play the created file, | |
490 other players will use the wrong aspect ratio. | |
9675 | 491 </para> |
492 | |
493 <para> | |
494 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
|
495 See the man page for the usage of the <systemitem>cropdetect</systemitem> and |
9675 | 496 <systemitem>crop</systemitem> filters. |
497 </para> | |
498 | |
499 <para> | |
10869 | 500 Usage |
10065
422876da049e
Error in the aspect ratio calculation, plus typos and rewordings.
diego
parents:
9677
diff
changeset
|
501 <screen>mencoder sample-svcd.mpg -ovc lavc -lavcopts vcodec=mpeg4:autoaspect -vf crop=714:548:0:14 -oac copy -o output.avi</screen> |
9675 | 502 </para> |
10869 | 503 </sect1> |
504 | |
505 <sect1 id="custommatrices"><title>Custom inter/intra matrices</title> | |
506 | |
507 <para> | |
508 With this feature of <link linkend="ffmpeg">libavcodec</link> you are | |
509 able to set custom inter (I-frames/key frames) and intra (P-frames/predicted | |
510 frames) matrices. It is supported by many of the codecs: | |
511 <systemitem>mpeg1video</systemitem> and <systemitem>mpeg2video</systemitem> | |
512 are reported as working. | |
513 </para> | |
514 | |
515 <para> | |
516 A typical usage of this feature is to set the matrices preferred by the | |
517 <ulink url="http://www.kvcd.net/">KVCD</ulink> specifications. | |
518 </para> | |
519 | |
520 <para> | |
521 The <emphasis role="bold">KVCD "Notch" Quantization Matrix:</emphasis> | |
522 </para> | |
523 | |
524 <para> | |
525 Intra: | |
526 <screen> | |
527 8 9 12 22 26 27 29 34 | |
528 9 10 14 26 27 29 34 37 | |
529 12 14 18 27 29 34 37 38 | |
530 22 26 27 31 36 37 38 40 | |
531 26 27 29 36 39 38 40 48 | |
532 27 29 34 37 38 40 48 58 | |
533 29 34 37 38 40 48 58 69 | |
534 34 37 38 40 48 58 69 79 | |
535 </screen> | |
536 | |
537 Inter: | |
538 <screen> | |
539 16 18 20 22 24 26 28 30 | |
540 18 20 22 24 26 28 30 32 | |
541 20 22 24 26 28 30 32 34 | |
542 22 24 26 30 32 32 34 36 | |
543 24 26 28 32 34 34 36 38 | |
544 26 28 30 32 34 36 38 40 | |
545 28 30 32 34 36 38 42 42 | |
546 30 32 34 36 38 40 42 44 | |
547 </screen> | |
548 </para> | |
549 | |
550 <para> | |
551 Usage: | |
552 <screen> | |
553 $ mencoder input.avi -o output.avi -oac copy -ovc lavc -lavcopts inter_matrix=...:intra_matrix=... | |
554 </screen> | |
555 </para> | |
556 | |
557 <para> | |
558 <screen> | |
559 $ mencoder input.avi -ovc lavc -lavcopts | |
560 vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37, | |
561 12,14,18,27,29,34,37,38,22,26,27,31,36,37,38,40,26,27,29,36,39,38,40,48,27, | |
562 29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79 | |
563 :inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26, | |
564 28,30,32,34,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,26,28,30,32,34, | |
565 36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg | |
566 </screen> | |
567 </para> | |
9675 | 568 </sect1> |
569 | |
570 </chapter> |