Mercurial > mplayer.hg
comparison DOCS/xml/en/encoding-guide.xml @ 21521:b210a229fbcb
General reformatting round:
- fix some " -> "
- reindent with more consistency
- visual markup of <sect?> tags
- break overly long lines
- add missing <replaceable> tags in examples
- cola truck standing by
author | torinthiel |
---|---|
date | Fri, 08 Dec 2006 11:38:06 +0000 |
parents | 1351ac8b333f |
children | f746c28a324c |
comparison
equal
deleted
inserted
replaced
21520:0977cf2eb136 | 21521:b210a229fbcb |
---|---|
2 <!-- $Revision$ --> | 2 <!-- $Revision$ --> |
3 <chapter id="encoding-guide"> | 3 <chapter id="encoding-guide"> |
4 <title>Encoding with <application>MEncoder</application></title> | 4 <title>Encoding with <application>MEncoder</application></title> |
5 | 5 |
6 <sect1 id="menc-feat-dvd-mpeg4"> | 6 <sect1 id="menc-feat-dvd-mpeg4"> |
7 <title>Making a high quality MPEG-4 ("DivX") rip of a DVD movie</title> | 7 <title>Making a high quality MPEG-4 ("DivX") |
8 | 8 rip of a DVD movie</title> |
9 <para> | 9 |
10 One frequently asked question is "How do I make the highest quality rip for | 10 <para> |
11 a given size?". Another question is "How do I make the highest quality DVD | 11 One frequently asked question is "How do I make the highest quality rip |
12 rip possible? I do not care about file size, I just want the best quality." | 12 for a given size?". Another question is "How do I make the highest |
13 </para> | 13 quality DVD rip possible? I do not care about file size, I just want the best |
14 | 14 quality." |
15 <para> | 15 </para> |
16 The latter question is perhaps at least somewhat wrongly posed. After all, if | 16 |
17 you do not care about file size, why not simply copy the entire MPEG-2 video | 17 <para> |
18 stream from the the DVD? Sure, your AVI will end up being 5GB, give | 18 The latter question is perhaps at least somewhat wrongly posed. After all, if |
19 or take, but if you want the best quality and do not care about size, | 19 you do not care about file size, why not simply copy the entire MPEG-2 video |
20 this is certainly your best option. | 20 stream from the the DVD? Sure, your AVI will end up being 5GB, give |
21 </para> | 21 or take, but if you want the best quality and do not care about size, |
22 | 22 this is certainly your best option. |
23 <para> | 23 </para> |
24 In fact, the reason you want to transcode a DVD into MPEG-4 is | 24 |
25 specifically because you <emphasis role="bold">do</emphasis> care about | 25 <para> |
26 file size. | 26 In fact, the reason you want to transcode a DVD into MPEG-4 is |
27 </para> | 27 specifically because you <emphasis role="bold">do</emphasis> care about |
28 | 28 file size. |
29 <para> | 29 </para> |
30 It is difficult to offer a cookbook recipe on how to create a very high | 30 |
31 quality DVD rip. There are several factors to consider, and you should | 31 <para> |
32 understand these details or else you are likely to end up disappointed | 32 It is difficult to offer a cookbook recipe on how to create a very high |
33 with your results. Below we will investigate some of these issues, and | 33 quality DVD rip. There are several factors to consider, and you should |
34 then have a look at an example. We assume you are using | 34 understand these details or else you are likely to end up disappointed |
35 <systemitem class="library">libavcodec</systemitem> to encode the video, | 35 with your results. Below we will investigate some of these issues, and |
36 although the theory applies to other codecs as well. | 36 then have a look at an example. We assume you are using |
37 </para> | 37 <systemitem class="library">libavcodec</systemitem> to encode the video, |
38 | 38 although the theory applies to other codecs as well. |
39 <para> | 39 </para> |
40 If this seems to be too much for you, you should probably use one of the | 40 |
41 many fine frontends that are listed in the | 41 <para> |
42 <ulink url="http://www.mplayerhq.hu/design7/projects.html#mencoder_frontends">MEncoder section</ulink> | 42 If this seems to be too much for you, you should probably use one of the |
43 of our related projects page. | 43 many fine frontends that are listed in the |
44 That way, you should be able to achieve high quality rips without too much | 44 <ulink url="http://www.mplayerhq.hu/design7/projects.html#mencoder_frontends">MEncoder section</ulink> |
45 thinking, because most of those tools are designed to take clever decisions | 45 of our related projects page. |
46 for you. | 46 That way, you should be able to achieve high quality rips without too much |
47 </para> | 47 thinking, because most of those tools are designed to take clever decisions |
48 for you. | |
49 </para> | |
50 | |
51 <!-- ********** --> | |
48 | 52 |
49 <sect2 id="menc-feat-dvd-mpeg4-preparing-encode"> | 53 <sect2 id="menc-feat-dvd-mpeg4-preparing-encode"> |
50 <title>Preparing to encode: Identifying source material and framerate</title> | 54 <title>Preparing to encode: Identifying source material and framerate</title> |
51 <para> | 55 |
52 Before you even think about encoding a movie, you need to take | 56 <para> |
53 several preliminary steps. | 57 Before you even think about encoding a movie, you need to take |
54 </para> | 58 several preliminary steps. |
55 | 59 </para> |
56 <para> | 60 |
57 The first and most important step before you encode should be | 61 <para> |
58 determining what type of content you are dealing with. | 62 The first and most important step before you encode should be |
59 If your source material comes from DVD or broadcast/cable/satellite | 63 determining what type of content you are dealing with. |
60 TV, it will be stored in one of two formats: NTSC for North | 64 If your source material comes from DVD or broadcast/cable/satellite |
61 America and Japan, PAL for Europe, etc. | 65 TV, it will be stored in one of two formats: NTSC for North |
62 It is important to realize, however, that this is just the formatting for | 66 America and Japan, PAL for Europe, etc. |
63 presentation on a television, and often does | 67 It is important to realize, however, that this is just the formatting for |
64 <emphasis role="bold">not</emphasis> correspond to the | 68 presentation on a television, and often does |
65 original format of the movie. | 69 <emphasis role="bold">not</emphasis> correspond to the |
66 Experience shows that NTSC material is a lot more difficult to encode, | 70 original format of the movie. |
67 because there more elements to identify in the source. | 71 Experience shows that NTSC material is a lot more difficult to encode, |
68 In order to produce a suitable encode, you need to know the original | 72 because there more elements to identify in the source. |
69 format. | 73 In order to produce a suitable encode, you need to know the original |
70 Failure to take this into account will result in various flaws in your | 74 format. |
71 encode, including ugly combing (interlacing) artifacts and duplicated | 75 Failure to take this into account will result in various flaws in your |
72 or even lost frames. | 76 encode, including ugly combing (interlacing) artifacts and duplicated |
73 Besides being ugly, the artifacts also harm coding efficiency: | 77 or even lost frames. |
74 You will get worse quality per unit bitrate. | 78 Besides being ugly, the artifacts also harm coding efficiency: |
75 </para> | 79 You will get worse quality per unit bitrate. |
80 </para> | |
81 | |
76 | 82 |
77 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-fps"> | 83 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-fps"> |
78 <title>Identifying source framerate</title> | 84 <title>Identifying source framerate</title> |
79 <para> | 85 |
80 Here is a list of common types of source material, where you are | 86 <para> |
81 likely to find them, and their properties: | 87 Here is a list of common types of source material, where you are |
82 </para> | 88 likely to find them, and their properties: |
89 </para> | |
90 | |
83 <itemizedlist> | 91 <itemizedlist> |
84 <listitem><para> | 92 <listitem><para> |
85 <emphasis role="bold">Standard Film</emphasis>: Produced for | 93 <emphasis role="bold">Standard Film</emphasis>: Produced for |
86 theatrical display at 24fps. | 94 theatrical display at 24fps. |
87 </para></listitem> | 95 </para></listitem> |
120 framerates. | 128 framerates. |
121 </para></listitem> | 129 </para></listitem> |
122 </itemizedlist> | 130 </itemizedlist> |
123 </sect3> | 131 </sect3> |
124 | 132 |
133 | |
125 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-material"> | 134 <sect3 id="menc-feat-dvd-mpeg4-preparing-encode-material"> |
126 <title>Identifying source material</title> | 135 <title>Identifying source material</title> |
127 <para> | 136 |
128 Movies consisting of frames are referred to as progressive, | 137 <para> |
129 while those consisting of independent fields are called | 138 Movies consisting of frames are referred to as progressive, |
130 either interlaced or video - though this latter term is | 139 while those consisting of independent fields are called |
131 ambiguous. | 140 either interlaced or video - though this latter term is |
132 </para> | 141 ambiguous. |
133 <para> | 142 </para> |
134 To further complicate matters, some movies will be a mix of | 143 |
135 several of the above. | 144 <para> |
136 </para> | 145 To further complicate matters, some movies will be a mix of |
137 <para> | 146 several of the above. |
138 The most important distinction to make between all of these | 147 </para> |
139 formats is that some are frame-based, while others are | 148 |
140 field-based. | 149 <para> |
141 <emphasis role="bold">Whenever</emphasis> a movie is prepared | 150 The most important distinction to make between all of these |
142 for display on television (including DVD), it is converted to a | 151 formats is that some are frame-based, while others are |
143 field-based format. | 152 field-based. |
144 The various methods by which this can be done are collectively | 153 <emphasis role="bold">Whenever</emphasis> a movie is prepared |
145 referred to as "telecine", of which the infamous NTSC | 154 for display on television (including DVD), it is converted to a |
146 "3:2 pulldown" is one variety. | 155 field-based format. |
147 Unless the original material was also field-based (and the same | 156 The various methods by which this can be done are collectively |
148 fieldrate), you are getting the movie in a format other than the | 157 referred to as "telecine", of which the infamous NTSC |
149 original. | 158 "3:2 pulldown" is one variety. |
159 Unless the original material was also field-based (and the same | |
160 fieldrate), you are getting the movie in a format other than the | |
161 original. | |
150 </para> | 162 </para> |
151 | 163 |
152 <itemizedlist> | 164 <itemizedlist> |
153 <title>There are several common types of pulldown:</title> | 165 <title>There are several common types of pulldown:</title> |
154 <listitem><para> | 166 <listitem><para> |
181 Nice, just like 2:2 PAL pulldown. | 193 Nice, just like 2:2 PAL pulldown. |
182 </para></listitem> | 194 </para></listitem> |
183 </itemizedlist> | 195 </itemizedlist> |
184 | 196 |
185 <para> | 197 <para> |
186 There are also methods for converting between NTSC and PAL video, | 198 There are also methods for converting between NTSC and PAL video, |
187 but such topics are beyond the scope of this guide. | 199 but such topics are beyond the scope of this guide. |
188 If you encounter such a movie and want to encode it, your best | 200 If you encounter such a movie and want to encode it, your best |
189 bet is to find a copy in the original format. | 201 bet is to find a copy in the original format. |
190 Conversion between these two formats is highly destructive and | 202 Conversion between these two formats is highly destructive and |
191 cannot be reversed cleanly, so your encode will greatly suffer | 203 cannot be reversed cleanly, so your encode will greatly suffer |
192 if it is made from a converted source. | 204 if it is made from a converted source. |
193 </para> | 205 </para> |
194 <para> | 206 |
195 When video is stored on DVD, consecutive pairs of fields are | 207 <para> |
196 grouped as a frame, even though they are not intended to be shown | 208 When video is stored on DVD, consecutive pairs of fields are |
197 at the same moment in time. | 209 grouped as a frame, even though they are not intended to be shown |
198 The MPEG-2 standard used on DVD and digital TV provides a | 210 at the same moment in time. |
199 way both to encode the original progressive frames and to store | 211 The MPEG-2 standard used on DVD and digital TV provides a |
200 the number of fields for which a frame should be shown in the | 212 way both to encode the original progressive frames and to store |
201 header of that frame. | 213 the number of fields for which a frame should be shown in the |
202 If this method has been used, the movie will often be described | 214 header of that frame. |
203 as "soft-telecined", since the process only directs the | 215 If this method has been used, the movie will often be described |
204 DVD player to apply pulldown to the movie rather than altering | 216 as "soft-telecined", since the process only directs the |
205 the movie itself. | 217 DVD player to apply pulldown to the movie rather than altering |
206 This case is highly preferable since it can easily be reversed | 218 the movie itself. |
207 (actually ignored) by the encoder, and since it preserves maximal | 219 This case is highly preferable since it can easily be reversed |
208 quality. | 220 (actually ignored) by the encoder, and since it preserves maximal |
209 However, many DVD and broadcast production studios do not use | 221 quality. |
210 proper encoding techniques but instead produce movies with | 222 However, many DVD and broadcast production studios do not use |
211 "hard telecine", where fields are actually duplicated in the | 223 proper encoding techniques but instead produce movies with |
212 encoded MPEG-2. | 224 "hard telecine", where fields are actually duplicated in the |
213 </para> | 225 encoded MPEG-2. |
214 <para> | 226 </para> |
215 The procedures for dealing with these cases will be covered | 227 |
216 <link linkend="menc-feat-telecine">later in this guide</link>. | 228 <para> |
217 For now, we leave you with some guides to identifying which type | 229 The procedures for dealing with these cases will be covered |
218 of material you are dealing with: | 230 <link linkend="menc-feat-telecine">later in this guide</link>. |
231 For now, we leave you with some guides to identifying which type | |
232 of material you are dealing with: | |
219 </para> | 233 </para> |
220 | 234 |
221 <itemizedlist> | 235 <itemizedlist> |
222 <title>NTSC regions:</title> | 236 <title>NTSC regions:</title> |
223 <listitem><para> | 237 <listitem><para> |
230 If <application>MPlayer</application> shows the framerate | 244 If <application>MPlayer</application> shows the framerate |
231 switching back and forth between 24000/1001 and 30000/1001, and you see | 245 switching back and forth between 24000/1001 and 30000/1001, and you see |
232 "combing" at times, then there are several possibilities. | 246 "combing" at times, then there are several possibilities. |
233 The 24000/1001 fps segments are almost certainly progressive | 247 The 24000/1001 fps segments are almost certainly progressive |
234 content, "soft telecined", but the 30000/1001 fps parts could be | 248 content, "soft telecined", but the 30000/1001 fps parts could be |
235 either hard-telecined 24000/1001 fps content or 60000/1001 fields per second NTSC video. | 249 either hard-telecined 24000/1001 fps content or 60000/1001 fields per second |
236 Use the same guidelines as the following two cases to determine | 250 NTSC video. |
237 which. | 251 Use the same guidelines as the following two cases to determine which. |
238 </para></listitem> | 252 </para></listitem> |
239 <listitem><para> | 253 <listitem><para> |
240 If <application>MPlayer</application> never shows the framerate | 254 If <application>MPlayer</application> never shows the framerate |
241 changing, and every single frame with motion appears combed, your | 255 changing, and every single frame with motion appears combed, your |
242 movie is NTSC video at 60000/1001 fields per second. | 256 movie is NTSC video at 60000/1001 fields per second. |
266 <note><title>Hint:</title> | 280 <note><title>Hint:</title> |
267 <para> | 281 <para> |
268 <application>MPlayer</application> can slow down movie playback | 282 <application>MPlayer</application> can slow down movie playback |
269 with the -speed option or play it frame-by-frame. | 283 with the -speed option or play it frame-by-frame. |
270 Try using <option>-speed</option> 0.2 to watch the movie very | 284 Try using <option>-speed</option> 0.2 to watch the movie very |
271 slowly or press the "<keycap>.</keycap>" key repeatedly to play one frame at a time | 285 slowly or press the "<keycap>.</keycap>" key repeatedly to play one frame at |
272 and identify the pattern, if you cannot see it at full speed. | 286 a time and identify the pattern, if you cannot see it at full speed. |
273 </para> | 287 </para> |
274 </note> | 288 </note> |
275 </sect3> | 289 </sect3> |
276 </sect2> | 290 </sect2> |
277 | 291 |
292 <!-- ********** --> | |
293 | |
278 <sect2 id="menc-feat-dvd-mpeg4-2pass"> | 294 <sect2 id="menc-feat-dvd-mpeg4-2pass"> |
279 <title>Constant quantizer vs. multipass</title> | 295 <title>Constant quantizer vs. multipass</title> |
280 | 296 |
281 <para> | 297 <para> |
282 It is possible to encode your movie at a wide range of qualities. | 298 It is possible to encode your movie at a wide range of qualities. |
283 With modern video encoders and a bit of pre-codec compression | 299 With modern video encoders and a bit of pre-codec compression |
284 (downscaling and denoising), it is possible to achieve very good | 300 (downscaling and denoising), it is possible to achieve very good |
285 quality at 700 MB, for a 90-110 minute widescreen movie. | 301 quality at 700 MB, for a 90-110 minute widescreen movie. |
286 Furthermore, all but the longest movies can be encoded with near-perfect | 302 Furthermore, all but the longest movies can be encoded with near-perfect |
287 quality at 1400 MB. | 303 quality at 1400 MB. |
288 </para> | 304 </para> |
289 | 305 |
290 <para> | 306 <para> |
291 There are three approaches to encoding the video: constant bitrate | 307 There are three approaches to encoding the video: constant bitrate |
292 (CBR), constant quantizer, and multipass (ABR, or average bitrate). | 308 (CBR), constant quantizer, and multipass (ABR, or average bitrate). |
293 </para> | 309 </para> |
294 | 310 |
295 <para> | 311 <para> |
296 The complexity of the frames of a movie, and thus the number of bits | 312 The complexity of the frames of a movie, and thus the number of bits |
297 required to compress them, can vary greatly from one scene to another. | 313 required to compress them, can vary greatly from one scene to another. |
298 Modern video encoders can adjust to these needs as they go and vary | 314 Modern video encoders can adjust to these needs as they go and vary |
299 the bitrate. | 315 the bitrate. |
300 In simple modes such as CBR, however, the encoders do not know the | 316 In simple modes such as CBR, however, the encoders do not know the |
301 bitrate needs of future scenes and so cannot exceed the requested | 317 bitrate needs of future scenes and so cannot exceed the requested |
302 average bitrate for long stretches of time. | 318 average bitrate for long stretches of time. |
303 More advanced modes, such as multipass encode, can take into account | 319 More advanced modes, such as multipass encode, can take into account |
304 the statistics from previous passes; this fixes the problem mentioned | 320 the statistics from previous passes; this fixes the problem mentioned |
305 above. | 321 above. |
306 </para> | 322 </para> |
307 | 323 |
308 <note><title>Note:</title> | 324 <note><title>Note:</title> |
309 <para> | 325 <para> |
310 Most codecs which support ABR encode only support two pass encode | 326 Most codecs which support ABR encode only support two pass encode |
311 while some others such as <systemitem class="library">x264</systemitem>, | 327 while some others such as <systemitem class="library">x264</systemitem>, |
312 <systemitem class="library">Xvid</systemitem> | 328 <systemitem class="library">Xvid</systemitem> |
313 and <systemitem class="library">libavcodec</systemitem> support | 329 and <systemitem class="library">libavcodec</systemitem> support |
314 multipass, which slightly improves quality at each pass, | 330 multipass, which slightly improves quality at each pass, |
315 yet this improvement is no longer measurable nor noticeable after the | 331 yet this improvement is no longer measurable nor noticeable after the |
316 4th or so pass. | 332 4th or so pass. |
317 Therefore, in this section, two pass and multipass will be used | 333 Therefore, in this section, two pass and multipass will be used |
318 interchangeably. | 334 interchangeably. |
319 </para> | 335 </para> |
320 </note> | 336 </note> |
321 | 337 |
322 <para> | 338 <para> |
323 In each of these modes, the video codec (such as | 339 In each of these modes, the video codec (such as |
324 <systemitem class="library">libavcodec</systemitem>) | 340 <systemitem class="library">libavcodec</systemitem>) |
325 breaks the video frame into 16x16 pixel macroblocks and then applies a | 341 breaks the video frame into 16x16 pixel macroblocks and then applies a |
326 quantizer to each macroblock. The lower the quantizer, the better the | 342 quantizer to each macroblock. The lower the quantizer, the better the |
327 quality and higher the bitrate. | 343 quality and higher the bitrate. |
328 The method the movie encoder uses to determine | 344 The method the movie encoder uses to determine |
329 which quantizer to use for a given macroblock varies and is highly | 345 which quantizer to use for a given macroblock varies and is highly |
330 tunable. (This is an extreme over-simplification of the actual | 346 tunable. (This is an extreme over-simplification of the actual |
331 process, but the basic concept is useful to understand.) | 347 process, but the basic concept is useful to understand.) |
332 </para> | 348 </para> |
333 | 349 |
334 <para> | 350 <para> |
335 When you specify a constant bitrate, the video codec will encode the video, | 351 When you specify a constant bitrate, the video codec will encode the video, |
336 discarding | 352 discarding |
337 detail as much as necessary and as little as possible in order to remain | 353 detail as much as necessary and as little as possible in order to remain |
338 lower than the given bitrate. If you truly do not care about file size, | 354 lower than the given bitrate. If you truly do not care about file size, |
339 you could as well use CBR and specify a bitrate of infinity. (In | 355 you could as well use CBR and specify a bitrate of infinity. (In |
340 practice, this means a value high enough so that it poses no limit, like | 356 practice, this means a value high enough so that it poses no limit, like |
341 10000Kbit.) With no real restriction on bitrate, the result is that | 357 10000Kbit.) With no real restriction on bitrate, the result is that |
342 the codec will use the lowest | 358 the codec will use the lowest |
343 possible quantizer for each macroblock (as specified by | 359 possible quantizer for each macroblock (as specified by |
344 <option>vqmin</option> for | 360 <option>vqmin</option> for |
345 <systemitem class="library">libavcodec</systemitem>, which is 2 by default). | 361 <systemitem class="library">libavcodec</systemitem>, which is 2 by default). |
346 As soon as you specify a | 362 As soon as you specify a |
347 low enough bitrate that the codec | 363 low enough bitrate that the codec |
348 is forced to use a higher quantizer, then you are almost certainly ruining | 364 is forced to use a higher quantizer, then you are almost certainly ruining |
349 the quality of your video. | 365 the quality of your video. |
350 In order to avoid that, you should probably downscale your video, according | 366 In order to avoid that, you should probably downscale your video, according |
351 to the method described later on in this guide. | 367 to the method described later on in this guide. |
352 In general, you should avoid CBR altogether if you care about quality. | 368 In general, you should avoid CBR altogether if you care about quality. |
353 </para> | 369 </para> |
354 | 370 |
355 <para> | 371 <para> |
356 With constant quantizer, the codec uses the same quantizer, as | 372 With constant quantizer, the codec uses the same quantizer, as |
357 specified by the <option>vqscale</option> option (for | 373 specified by the <option>vqscale</option> option (for |
358 <systemitem class="library">libavcodec</systemitem>), on every macroblock. | 374 <systemitem class="library">libavcodec</systemitem>), on every macroblock. |
359 If you want the highest quality rip possible, again ignoring bitrate, | 375 If you want the highest quality rip possible, again ignoring bitrate, |
360 you can use <option>vqscale=2</option>. | 376 you can use <option>vqscale=2</option>. |
361 This will yield the same bitrate and PSNR (peak signal-to-noise ratio) | 377 This will yield the same bitrate and PSNR (peak signal-to-noise ratio) |
362 as CBR with | 378 as CBR with |
363 <option>vbitrate</option>=infinity and the default <option>vqmin</option> | 379 <option>vbitrate</option>=infinity and the default <option>vqmin</option> |
364 of 2. | 380 of 2. |
365 </para> | 381 </para> |
366 | 382 |
367 <para> | 383 <para> |
368 The problem with constant quantizing is that it uses the given quantizer | 384 The problem with constant quantizing is that it uses the given quantizer |
369 whether the macroblock needs it or not. That is, it might be possible | 385 whether the macroblock needs it or not. That is, it might be possible |
370 to use a higher quantizer on a macroblock without sacrificing visual | 386 to use a higher quantizer on a macroblock without sacrificing visual |
371 quality. Why waste the bits on an unnecessarily low quantizer? Your | 387 quality. Why waste the bits on an unnecessarily low quantizer? Your |
372 CPU has as many cycles as there is time, but there is only so many bits | 388 CPU has as many cycles as there is time, but there is only so many bits |
373 on your hard disk. | 389 on your hard disk. |
374 </para> | 390 </para> |
375 | 391 |
376 <para> | 392 <para> |
377 With a two pass encode, the first pass will rip the movie as though it | 393 With a two pass encode, the first pass will rip the movie as though it |
378 were CBR, but it will keep a log of properties for each frame. This | 394 were CBR, but it will keep a log of properties for each frame. This |
379 data is then used during the second pass in order to make intelligent | 395 data is then used during the second pass in order to make intelligent |
380 decisions about which quantizers to use. During fast action or high | 396 decisions about which quantizers to use. During fast action or high |
381 detail scenes, higher quantizers will likely be used, and during | 397 detail scenes, higher quantizers will likely be used, and during |
382 slow moving or low detail scenes, lower quantizers will be used. | 398 slow moving or low detail scenes, lower quantizers will be used. |
383 Normally, the amount of motion is much more important than the | 399 Normally, the amount of motion is much more important than the |
384 amount of detail. | 400 amount of detail. |
385 </para> | 401 </para> |
386 | 402 |
387 <para> | 403 <para> |
388 If you use <option>vqscale=2</option>, then you are wasting bits. If you | 404 If you use <option>vqscale=2</option>, then you are wasting bits. If you |
389 use <option>vqscale=3</option>, then you are not getting the highest | 405 use <option>vqscale=3</option>, then you are not getting the highest |
390 quality rip. Suppose you rip a DVD at <option>vqscale=3</option>, and | 406 quality rip. Suppose you rip a DVD at <option>vqscale=3</option>, and |
391 the result is 1800Kbit. If you do a two pass encode with | 407 the result is 1800Kbit. If you do a two pass encode with |
392 <option>vbitrate=1800</option>, the resulting video will have <emphasis | 408 <option>vbitrate=1800</option>, the resulting video will have |
393 role="bold">higher quality</emphasis> for the | 409 <emphasis role="bold">higher quality</emphasis> for the |
394 <emphasis role="bold">same bitrate</emphasis>. | 410 <emphasis role="bold">same bitrate</emphasis>. |
395 </para> | 411 </para> |
396 | 412 |
397 <para> | 413 <para> |
398 Since you are now convinced that two pass is the way to go, the real | 414 Since you are now convinced that two pass is the way to go, the real |
399 question now is what bitrate to use? The answer is that there is no | 415 question now is what bitrate to use? The answer is that there is no |
400 single answer. Ideally you want to choose a bitrate that yields the | 416 single answer. Ideally you want to choose a bitrate that yields the |
401 best balance between quality and file size. This is going to vary | 417 best balance between quality and file size. This is going to vary |
402 depending on the source video. | 418 depending on the source video. |
403 </para> | 419 </para> |
404 | 420 |
405 <para> | 421 <para> |
406 If size does not matter, a good starting point for a very high quality | 422 If size does not matter, a good starting point for a very high quality |
407 rip is about 2000Kbit plus or minus 200Kbit. | 423 rip is about 2000Kbit plus or minus 200Kbit. |
408 For fast action or high detail source video, or if you just have a very | 424 For fast action or high detail source video, or if you just have a very |
409 critical eye, you might decide on 2400 or 2600. | 425 critical eye, you might decide on 2400 or 2600. |
410 For some DVDs, you might not notice a difference at 1400Kbit. It is a | 426 For some DVDs, you might not notice a difference at 1400Kbit. It is a |
411 good idea to experiment with scenes at different bitrates to get a feel. | 427 good idea to experiment with scenes at different bitrates to get a feel. |
412 </para> | 428 </para> |
413 | 429 |
414 <para> | 430 <para> |
415 If you aim at a certain size, you will have to somehow calculate the bitrate. | 431 If you aim at a certain size, you will have to somehow calculate the bitrate. |
416 But before that, you need to know how much space you should reserve for the | 432 But before that, you need to know how much space you should reserve for the |
417 audio track(s), so you should <link linkend="menc-feat-dvd-mpeg4-audio">rip | 433 audio track(s), so you should |
418 those</link> first. | 434 <link linkend="menc-feat-dvd-mpeg4-audio">rip those</link> first. |
419 You can compute the bitrate with the following equation: | 435 You can compute the bitrate with the following equation: |
420 <systemitem>bitrate = (target_size_in_Mbytes - sound_size_in_Mbytes) * | 436 <systemitem>bitrate = (target_size_in_Mbytes - sound_size_in_Mbytes) * |
421 1024 * 1024 / length_in_secs * 8 / 1000</systemitem> | 437 1024 * 1024 / length_in_secs * 8 / 1000</systemitem> |
422 For instance, to squeeze a two-hour movie onto a 702MB CD, with 60MB | 438 For instance, to squeeze a two-hour movie onto a 702MB CD, with 60MB |
423 of audio track, the video bitrate will have to be: | 439 of audio track, the video bitrate will have to be: |
424 <systemitem>(702 - 60) * 1024 * 1024 / (120*60) * 8 / 1000 | 440 <systemitem>(702 - 60) * 1024 * 1024 / (120*60) * 8 / 1000 |
425 = 740kbps</systemitem> | 441 = 740kbps</systemitem> |
426 </para> | 442 </para> |
427 | |
428 </sect2> | 443 </sect2> |
429 | 444 |
445 <!-- ********** --> | |
430 | 446 |
431 <sect2 id="menc-feat-dvd-mpeg4-constraints"> | 447 <sect2 id="menc-feat-dvd-mpeg4-constraints"> |
432 <title>Constraints for efficient encoding</title> | 448 <title>Constraints for efficient encoding</title> |
433 | 449 |
434 <para> | 450 <para> |
435 Due to the nature of MPEG-type compression, there are various | 451 Due to the nature of MPEG-type compression, there are various |
436 constraints you should follow for maximal quality. | 452 constraints you should follow for maximal quality. |
437 MPEG splits the video up into 16x16 squares called macroblocks, | 453 MPEG splits the video up into 16x16 squares called macroblocks, |
438 each composed of 4 8x8 blocks of luma (intensity) information and two | 454 each composed of 4 8x8 blocks of luma (intensity) information and two |
439 half-resolution 8x8 chroma (color) blocks (one for red-cyan axis and | 455 half-resolution 8x8 chroma (color) blocks (one for red-cyan axis and |
440 the other for the blue-yellow axis). | 456 the other for the blue-yellow axis). |
441 Even if your movie width and height are not multiples of 16, the | 457 Even if your movie width and height are not multiples of 16, the |
442 encoder will use enough 16x16 macroblocks to cover the whole picture | 458 encoder will use enough 16x16 macroblocks to cover the whole picture |
443 area, and the extra space will go to waste. | 459 area, and the extra space will go to waste. |
444 So in the interests of maximizing quality at a fixed filesize, it is | 460 So in the interests of maximizing quality at a fixed filesize, it is |
445 a bad idea to use dimensions that are not multiples of 16. | 461 a bad idea to use dimensions that are not multiples of 16. |
446 </para> | 462 </para> |
447 | 463 |
448 <para> | 464 <para> |
449 Most DVDs also have some degree of black borders at the edges. Leaving | 465 Most DVDs also have some degree of black borders at the edges. Leaving |
450 these in place will hurt quality <emphasis role="bold">a lot</emphasis> | 466 these in place will hurt quality <emphasis role="bold">a lot</emphasis> |
451 in several ways. | 467 in several ways. |
452 </para> | 468 </para> |
453 | 469 |
454 <orderedlist> | 470 <orderedlist> |
455 <listitem> | 471 <listitem> |
456 <para> | 472 <para> |
457 MPEG-type compression is also highly dependent on frequency domain | 473 MPEG-type compression is also highly dependent on frequency domain |
458 transformations, in particular the Discrete Cosine Transform (DCT), | 474 transformations, in particular the Discrete Cosine Transform (DCT), |
459 which is similar to the Fourier transform. This sort of encoding is | 475 which is similar to the Fourier transform. This sort of encoding is |
460 efficient for representing patterns and smooth transitions, but it | 476 efficient for representing patterns and smooth transitions, but it |
461 has a hard time with sharp edges. In order to encode them it must | 477 has a hard time with sharp edges. In order to encode them it must |
462 use many more bits, or else an artifact known as ringing will | 478 use many more bits, or else an artifact known as ringing will |
463 appear. | 479 appear. |
464 </para> | 480 </para> |
465 | 481 |
466 <para> | 482 <para> |
467 The frequency transform (DCT) takes place separately on each | 483 The frequency transform (DCT) takes place separately on each |
468 macroblock (actually each block), so this problem only applies when | 484 macroblock (actually each block), so this problem only applies when |
469 the sharp edge is inside a block. If your black borders begin | 485 the sharp edge is inside a block. If your black borders begin |
470 exactly at multiple-of-16 pixel boundaries, this is not a problem. | 486 exactly at multiple-of-16 pixel boundaries, this is not a problem. |
471 However, the black borders on DVDs rarely come nicely aligned, so | 487 However, the black borders on DVDs rarely come nicely aligned, so |
472 in practice you will always need to crop to avoid this penalty. | 488 in practice you will always need to crop to avoid this penalty. |
473 </para> | 489 </para> |
474 </listitem> | 490 </listitem> |
475 </orderedlist> | 491 </orderedlist> |
476 | 492 |
477 <para> | 493 <para> |
478 In addition to frequency domain transforms, MPEG-type compression uses | 494 In addition to frequency domain transforms, MPEG-type compression uses |
479 motion vectors to represent the change from one frame to the next. | 495 motion vectors to represent the change from one frame to the next. |
480 Motion vectors naturally work much less efficiently for new content | 496 Motion vectors naturally work much less efficiently for new content |
481 coming in from the edges of the picture, because it is not present in | 497 coming in from the edges of the picture, because it is not present in |
482 the previous frame. As long as the picture extends all the way to the | 498 the previous frame. As long as the picture extends all the way to the |
483 edge of the encoded region, motion vectors have no problem with | 499 edge of the encoded region, motion vectors have no problem with |
484 content moving out the edges of the picture. However, in the presence | 500 content moving out the edges of the picture. However, in the presence |
485 of black borders, there can be trouble: | 501 of black borders, there can be trouble: |
486 </para> | 502 </para> |
487 | 503 |
488 <orderedlist continuation="continues"> | 504 <orderedlist continuation="continues"> |
489 <listitem> | 505 <listitem> |
490 <para> | 506 <para> |
491 For each macroblock, MPEG-type compression stores a vector | 507 For each macroblock, MPEG-type compression stores a vector |
492 identifying which part of the previous frame should be copied into | 508 identifying which part of the previous frame should be copied into |
493 this macroblock as a base for predicting the next frame. Only the | 509 this macroblock as a base for predicting the next frame. Only the |
494 remaining differences need to be encoded. If a macroblock spans the | 510 remaining differences need to be encoded. If a macroblock spans the |
495 edge of the picture and contains part of the black border, then | 511 edge of the picture and contains part of the black border, then |
497 black border. This means that lots of bits must be spent either | 513 black border. This means that lots of bits must be spent either |
498 re-blackening the border that was overwritten, or (more likely) a | 514 re-blackening the border that was overwritten, or (more likely) a |
499 motion vector will not be used at all and all the changes in this | 515 motion vector will not be used at all and all the changes in this |
500 macroblock will have to be coded explicitly. Either way, encoding | 516 macroblock will have to be coded explicitly. Either way, encoding |
501 efficiency is greatly reduced. | 517 efficiency is greatly reduced. |
502 </para> | 518 </para> |
503 | 519 |
504 <para> | 520 <para> |
505 Again, this problem only applies if black borders do not line up on | 521 Again, this problem only applies if black borders do not line up on |
506 multiple-of-16 boundaries. | 522 multiple-of-16 boundaries. |
507 </para> | 523 </para> |
508 </listitem> | 524 </listitem> |
509 | 525 |
510 <listitem> | 526 <listitem> |
511 <para> | 527 <para> |
512 Finally, suppose we have a macroblock in the interior of the | 528 Finally, suppose we have a macroblock in the interior of the |
513 picture, and an object is moving into this block from near the edge | 529 picture, and an object is moving into this block from near the edge |
514 of the image. MPEG-type coding cannot say "copy the part that is | 530 of the image. MPEG-type coding cannot say "copy the part that is |
515 inside the picture but not the black border." So the black border | 531 inside the picture but not the black border." So the black border |
516 will get copied inside too, and lots of bits will have to be spent | 532 will get copied inside too, and lots of bits will have to be spent |
517 encoding the part of the picture that is supposed to be there. | 533 encoding the part of the picture that is supposed to be there. |
518 </para> | 534 </para> |
519 | 535 |
520 <para> | 536 <para> |
521 If the picture runs all the way to the edge of the encoded area, | 537 If the picture runs all the way to the edge of the encoded area, |
522 MPEG has special optimizations to repeatedly copy the pixels at the | 538 MPEG has special optimizations to repeatedly copy the pixels at the |
523 edge of the picture when a motion vector comes from outside the | 539 edge of the picture when a motion vector comes from outside the |
524 encoded area. This feature becomes useless when the movie has black | 540 encoded area. This feature becomes useless when the movie has black |
525 borders. Unlike problems 1 and 2, aligning the borders at multiples | 541 borders. Unlike problems 1 and 2, aligning the borders at multiples |
526 of 16 does not help here. | 542 of 16 does not help here. |
527 </para> | 543 </para> |
528 </listitem> | 544 </listitem> |
529 | 545 |
530 <listitem> | 546 <listitem><para> |
531 <para> | |
532 Despite the borders being entirely black and never changing, there | 547 Despite the borders being entirely black and never changing, there |
533 is at least a minimal amount of overhead involved in having more | 548 is at least a minimal amount of overhead involved in having more |
534 macroblocks. | 549 macroblocks. |
535 </para> | 550 </para></listitem> |
536 </listitem> | |
537 </orderedlist> | 551 </orderedlist> |
538 | 552 |
539 <para> | 553 <para> |
540 For all of these reasons, it is recommended to fully crop black | 554 For all of these reasons, it is recommended to fully crop black |
541 borders. Further, if there is an area of noise/distortion at the edge | 555 borders. Further, if there is an area of noise/distortion at the edge |
542 of the picture, cropping this will improve encoding efficiency as | 556 of the picture, cropping this will improve encoding efficiency as |
543 well. Videophile purists who want to preserve the original as close as | 557 well. Videophile purists who want to preserve the original as close as |
544 possible may object to this cropping, but unless you plan to encode at | 558 possible may object to this cropping, but unless you plan to encode at |
545 constant quantizer, the quality you gain from cropping will | 559 constant quantizer, the quality you gain from cropping will |
546 considerably exceed the amount of information lost at the edges. | 560 considerably exceed the amount of information lost at the edges. |
547 </para> | 561 </para> |
548 </sect2> | 562 </sect2> |
549 | 563 |
564 <!-- ********** --> | |
550 | 565 |
551 <sect2 id="menc-feat-dvd-mpeg4-crop"> | 566 <sect2 id="menc-feat-dvd-mpeg4-crop"> |
552 <title>Cropping and Scaling</title> | 567 <title>Cropping and Scaling</title> |
553 | 568 |
554 <para> | 569 <para> |
555 Recall from the previous section that the final picture size you | 570 Recall from the previous section that the final picture size you |
556 encode should be a multiple of 16 (in both width and height). | 571 encode should be a multiple of 16 (in both width and height). |
557 This can be achieved by cropping, scaling, or a combination of both. | 572 This can be achieved by cropping, scaling, or a combination of both. |
558 </para> | 573 </para> |
559 | 574 |
560 <para> | 575 <para> |
561 When cropping, there are a few guidelines that must be followed to | 576 When cropping, there are a few guidelines that must be followed to |
562 avoid damaging your movie. | 577 avoid damaging your movie. |
563 The normal YUV format, 4:2:0, stores chroma (color) information | 578 The normal YUV format, 4:2:0, stores chroma (color) information |
564 subsampled, i.e. chroma is only sampled half as often in each | 579 subsampled, i.e. chroma is only sampled half as often in each |
565 direction as luma (intensity) information. | 580 direction as luma (intensity) information. |
566 Observe this diagram, where L indicates luma sampling points and C | 581 Observe this diagram, where L indicates luma sampling points and C |
567 chroma. | 582 chroma. |
568 </para> | 583 </para> |
569 | 584 |
570 <informaltable> | 585 <informaltable> |
571 <?dbhtml table-width="40%" ?> | 586 <?dbhtml table-width="40%" ?> |
572 <?dbfo table-width="40%" ?> | 587 <?dbfo table-width="40%" ?> |
639 </tbody> | 654 </tbody> |
640 </tgroup> | 655 </tgroup> |
641 </informaltable> | 656 </informaltable> |
642 | 657 |
643 <para> | 658 <para> |
644 As you can see, rows and columns of the image naturally come in pairs. | 659 As you can see, rows and columns of the image naturally come in pairs. |
645 Thus your crop offsets and dimensions <emphasis>must</emphasis> be | 660 Thus your crop offsets and dimensions <emphasis>must</emphasis> be |
646 even numbers. | 661 even numbers. |
647 If they are not, the chroma will no longer line up correctly with the | 662 If they are not, the chroma will no longer line up correctly with the |
648 luma. | 663 luma. |
649 In theory, it is possible to crop with odd offsets, but it requires | 664 In theory, it is possible to crop with odd offsets, but it requires |
650 resampling the chroma which is potentially a lossy operation and not | 665 resampling the chroma which is potentially a lossy operation and not |
651 supported by the crop filter. | 666 supported by the crop filter. |
652 </para> | 667 </para> |
653 | 668 |
654 <para> | 669 <para> |
655 Further, interlaced video is sampled as follows: | 670 Further, interlaced video is sampled as follows: |
656 </para> | 671 </para> |
657 | 672 |
658 <informaltable> | 673 <informaltable> |
659 <?dbhtml table-width="80%" ?> | 674 <?dbhtml table-width="80%" ?> |
660 <?dbfo table-width="80%" ?> | 675 <?dbfo table-width="80%" ?> |
891 </tbody> | 906 </tbody> |
892 </tgroup> | 907 </tgroup> |
893 </informaltable> | 908 </informaltable> |
894 | 909 |
895 <para> | 910 <para> |
896 As you can see, the pattern does not repeat until after 4 lines. | 911 As you can see, the pattern does not repeat until after 4 lines. |
897 So for interlaced video, your y-offset and height for cropping must | 912 So for interlaced video, your y-offset and height for cropping must |
898 be multiples of 4. | 913 be multiples of 4. |
899 </para> | 914 </para> |
900 | 915 |
901 <para> | 916 <para> |
902 Native DVD resolution is 720x480 for NTSC, and 720x576 for PAL, but | 917 Native DVD resolution is 720x480 for NTSC, and 720x576 for PAL, but |
903 there is an aspect flag that specifies whether it is full-screen (4:3) or | 918 there is an aspect flag that specifies whether it is full-screen (4:3) or |
904 wide-screen (16:9). Many (if not most) widescreen DVDs are not strictly | 919 wide-screen (16:9). Many (if not most) widescreen DVDs are not strictly |
905 16:9, and will be either 1.85:1 or 2.35:1 (cinescope). This means that | 920 16:9, and will be either 1.85:1 or 2.35:1 (cinescope). This means that |
906 there will be black bands in the video that will need to be cropped out. | 921 there will be black bands in the video that will need to be cropped out. |
907 </para> | 922 </para> |
908 | 923 |
909 <para> | 924 <para> |
910 <application>MPlayer</application> provides a crop detection filter that | 925 <application>MPlayer</application> provides a crop detection filter that |
911 will determine the crop rectangle (<option>-vf cropdetect</option>). | 926 will determine the crop rectangle (<option>-vf cropdetect</option>). |
912 Run <application>MPlayer</application> with | 927 Run <application>MPlayer</application> with |
913 <option>-vf cropdetect</option> and it will print out the crop | 928 <option>-vf cropdetect</option> and it will print out the crop |
914 settings to remove the borders. | 929 settings to remove the borders. |
915 You should let the movie run long enough that the whole picture | 930 You should let the movie run long enough that the whole picture |
916 area is used, in order to get accurate crop values. | 931 area is used, in order to get accurate crop values. |
917 </para> | 932 </para> |
918 | 933 |
919 <para> | 934 <para> |
920 Then, test the values you get with <application>MPlayer</application>, | 935 Then, test the values you get with <application>MPlayer</application>, |
921 using the command line which was printed by | 936 using the command line which was printed by |
922 <option>cropdetect</option>, and adjust the rectangle as needed. | 937 <option>cropdetect</option>, and adjust the rectangle as needed. |
923 The <option>rectangle</option> filter can help by allowing you to | 938 The <option>rectangle</option> filter can help by allowing you to |
924 interactively position the crop rectangle over your movie. | 939 interactively position the crop rectangle over your movie. |
925 Remember to follow the above divisibility guidelines so that you | 940 Remember to follow the above divisibility guidelines so that you |
926 do not misalign the chroma planes. | 941 do not misalign the chroma planes. |
927 </para> | 942 </para> |
928 | 943 |
929 <para> | 944 <para> |
930 In certain cases, scaling may be undesirable. | 945 In certain cases, scaling may be undesirable. |
931 Scaling in the vertical direction is difficult with interlaced | 946 Scaling in the vertical direction is difficult with interlaced |
932 video, and if you wish to preserve the interlacing, you should | 947 video, and if you wish to preserve the interlacing, you should |
933 usually refrain from scaling. | 948 usually refrain from scaling. |
934 If you will not be scaling but you still want to use multiple-of-16 | 949 If you will not be scaling but you still want to use multiple-of-16 |
935 dimensions, you will have to overcrop. | 950 dimensions, you will have to overcrop. |
936 Do not undercrop, since black borders are very bad for encoding! | 951 Do not undercrop, since black borders are very bad for encoding! |
937 </para> | 952 </para> |
938 | 953 |
939 <para> | 954 <para> |
940 Because MPEG-4 uses 16x16 macroblocks, you will want to make sure that each | 955 Because MPEG-4 uses 16x16 macroblocks, you will want to make sure that each |
941 dimension of the video you are encoding is a multiple of 16 or else you | 956 dimension of the video you are encoding is a multiple of 16 or else you |
942 will be degrading quality, especially at lower bitrates. You can do this | 957 will be degrading quality, especially at lower bitrates. You can do this |
943 by rounding the width and height of the crop rectangle down to the nearest | 958 by rounding the width and height of the crop rectangle down to the nearest |
944 multiple of 16. | 959 multiple of 16. |
945 As stated earlier, when cropping, you will want to increase the Y offset by | 960 As stated earlier, when cropping, you will want to increase the Y offset by |
946 half the difference of the old and the new height so that the resulting | 961 half the difference of the old and the new height so that the resulting |
947 video is taken from the center of the frame. And because of the way DVD | 962 video is taken from the center of the frame. And because of the way DVD |
948 video is sampled, make sure the offset is an even number. (In fact, as a | 963 video is sampled, make sure the offset is an even number. (In fact, as a |
949 rule, never use odd values for any parameter when you are cropping and | 964 rule, never use odd values for any parameter when you are cropping and |
950 scaling video.) If you are not comfortable throwing a few extra pixels | 965 scaling video.) If you are not comfortable throwing a few extra pixels |
951 away, you might prefer instead to scale the video instead. We will look | 966 away, you might prefer instead to scale the video instead. We will look |
952 at this in our example below. | 967 at this in our example below. |
953 You can actually let the <option>cropdetect</option> filter do all of the | 968 You can actually let the <option>cropdetect</option> filter do all of the |
954 above for you, as it has an optional <option>round</option> parameter that | 969 above for you, as it has an optional <option>round</option> parameter that |
955 is equal to 16 by default. | 970 is equal to 16 by default. |
956 </para> | 971 </para> |
957 | 972 |
958 <para> | 973 <para> |
959 Also, be careful about "half black" pixels at the edges. Make sure you | 974 Also, be careful about "half black" pixels at the edges. Make sure you |
960 crop these out too, or else you will be wasting bits there that | 975 crop these out too, or else you will be wasting bits there that |
961 are better spent elsewhere. | 976 are better spent elsewhere. |
962 </para> | 977 </para> |
963 | 978 |
964 <para> | 979 <para> |
965 After all is said and done, you will probably end up with video whose pixels | 980 After all is said and done, you will probably end up with video whose pixels |
966 are not quite 1.85:1 or 2.35:1, but rather something close to that. You | 981 are not quite 1.85:1 or 2.35:1, but rather something close to that. You |
967 could calculate the new aspect ratio manually, but | 982 could calculate the new aspect ratio manually, but |
968 <application>MEncoder</application> offers an option for <systemitem | 983 <application>MEncoder</application> offers an option for <systemitem |
969 class="library">libavcodec</systemitem> called <option>autoaspect</option> | 984 class="library">libavcodec</systemitem> called <option>autoaspect</option> |
970 that will do this for you. Absolutely do not scale this video up in order to | 985 that will do this for you. Absolutely do not scale this video up in order to |
971 square the pixels unless you like to waste your hard disk space. Scaling | 986 square the pixels unless you like to waste your hard disk space. Scaling |
972 should be done on playback, and the player will use the aspect stored in | 987 should be done on playback, and the player will use the aspect stored in |
973 the AVI to determine the correct resolution. | 988 the AVI to determine the correct resolution. |
974 Unfortunately, not all players enforce this auto-scaling information, | 989 Unfortunately, not all players enforce this auto-scaling information, |
975 therefore you may still want to rescale. | 990 therefore you may still want to rescale. |
976 </para> | 991 </para> |
977 </sect2> | 992 </sect2> |
978 | 993 |
994 <!-- ********** --> | |
979 | 995 |
980 <sect2 id="menc-feat-dvd-mpeg4-resolution-bitrate"> | 996 <sect2 id="menc-feat-dvd-mpeg4-resolution-bitrate"> |
981 <title>Choosing resolution and bitrate</title> | 997 <title>Choosing resolution and bitrate</title> |
982 | 998 |
983 <para> | 999 <para> |
984 If you will not be encoding in constant quantizer mode, you need to | 1000 If you will not be encoding in constant quantizer mode, you need to |
985 select a bitrate. | 1001 select a bitrate. |
986 The concept of bitrate is quite simple. | 1002 The concept of bitrate is quite simple. |
987 It is the (average) number of bits that will be consumed to store your | 1003 It is the (average) number of bits that will be consumed to store your |
988 movie, per second. | 1004 movie, per second. |
989 Normally bitrate is measured in kilobits (1000 bits) per second. | 1005 Normally bitrate is measured in kilobits (1000 bits) per second. |
990 The size of your movie on disk is the bitrate times the length of the | 1006 The size of your movie on disk is the bitrate times the length of the |
991 movie in time, plus a small amount of "overhead" (see the section on | 1007 movie in time, plus a small amount of "overhead" (see the section on |
992 <link linkend="menc-feat-dvd-mpeg4-muxing-avi-limitations">the AVI container</link> | 1008 <link linkend="menc-feat-dvd-mpeg4-muxing-avi-limitations">the AVI container</link> |
993 for instance). | 1009 for instance). |
994 Other parameters such as scaling, cropping, etc. will | 1010 Other parameters such as scaling, cropping, etc. will |
995 <emphasis role="bold">not</emphasis> alter the file size unless you | 1011 <emphasis role="bold">not</emphasis> alter the file size unless you |
996 change the bitrate as well!. | 1012 change the bitrate as well!. |
997 </para> | 1013 </para> |
998 <para> | 1014 |
999 Bitrate does <emphasis role="bold">not</emphasis> scale proportionally | 1015 <para> |
1000 to resolution. | 1016 Bitrate does <emphasis role="bold">not</emphasis> scale proportionally |
1001 That is to say, a 320x240 file at 200 kbit/sec will not be the same | 1017 to resolution. |
1002 quality as the same movie at 640x480 and 800 kbit/sec! | 1018 That is to say, a 320x240 file at 200 kbit/sec will not be the same |
1003 There are two reasons for this: | 1019 quality as the same movie at 640x480 and 800 kbit/sec! |
1020 There are two reasons for this: | |
1004 <orderedlist> | 1021 <orderedlist> |
1005 <listitem><para> | 1022 <listitem><para> |
1006 <emphasis role="bold">Perceptual</emphasis>: You notice MPEG | 1023 <emphasis role="bold">Perceptual</emphasis>: You notice MPEG |
1007 artifacts more if they are scaled up bigger! | 1024 artifacts more if they are scaled up bigger! |
1008 Artifacts appear on the scale of blocks (8x8). | 1025 Artifacts appear on the scale of blocks (8x8). |
1009 Your eye will not see errors in 4800 small blocks as easily as it | 1026 Your eye will not see errors in 4800 small blocks as easily as it |
1010 sees errors in 1200 large blocks (assuming you will be scaling both | 1027 sees errors in 1200 large blocks (assuming you will be scaling both |
1011 to fullscreen). | 1028 to fullscreen). |
1012 </para></listitem> | 1029 </para></listitem> |
1013 <listitem><para> | 1030 <listitem><para> |
1014 <emphasis role="bold">Theoretical</emphasis>: When you scale down | 1031 <emphasis role="bold">Theoretical</emphasis>: When you scale down |
1015 an image but still use the same size (8x8) blocks for the frequency | 1032 an image but still use the same size (8x8) blocks for the frequency |
1016 space transform, you move more data to the high frequency bands. | 1033 space transform, you move more data to the high frequency bands. |
1017 Roughly speaking, each pixel contains more of the detail than it | 1034 Roughly speaking, each pixel contains more of the detail than it |
1018 did before. | 1035 did before. |
1019 So even though your scaled-down picture contains 1/4 the information | 1036 So even though your scaled-down picture contains 1/4 the information |
1020 in the spacial directions, it could still contain a large portion | 1037 in the spacial directions, it could still contain a large portion |
1021 of the information in the frequency domain (assuming that the high | 1038 of the information in the frequency domain (assuming that the high |
1022 frequencies were underutilized in the original 640x480 image). | 1039 frequencies were underutilized in the original 640x480 image). |
1023 </para></listitem> | 1040 </para></listitem> |
1024 </orderedlist> | 1041 </orderedlist> |
1025 </para> | 1042 </para> |
1026 <para> | 1043 |
1027 Past guides have recommended choosing a bitrate and resolution based | 1044 <para> |
1028 on a "bits per pixel" approach, but this is usually not valid due to | 1045 Past guides have recommended choosing a bitrate and resolution based |
1029 the above reasons. | 1046 on a "bits per pixel" approach, but this is usually not valid due to |
1030 A better estimate seems to be that bitrates scale proportional to the | 1047 the above reasons. |
1031 square root of resolution, so that 320x240 and 400 kbit/sec would be | 1048 A better estimate seems to be that bitrates scale proportional to the |
1032 comparable to 640x480 at 800 kbit/sec. | 1049 square root of resolution, so that 320x240 and 400 kbit/sec would be |
1033 However this has not been verified with theoretical or empirical | 1050 comparable to 640x480 at 800 kbit/sec. |
1034 rigor. | 1051 However this has not been verified with theoretical or empirical |
1035 Further, given that movies vary greatly with regard to noise, detail, | 1052 rigor. |
1036 degree of motion, etc., it is futile to make general recommendations | 1053 Further, given that movies vary greatly with regard to noise, detail, |
1037 for bits per length-of-diagonal (the analog of bits per pixel, | 1054 degree of motion, etc., it is futile to make general recommendations |
1038 using the square root). | 1055 for bits per length-of-diagonal (the analog of bits per pixel, |
1039 </para> | 1056 using the square root). |
1040 <para> | 1057 </para> |
1041 So far we have discussed the difficulty of choosing a bitrate and | 1058 <para> |
1042 resolution. | 1059 So far we have discussed the difficulty of choosing a bitrate and |
1060 resolution. | |
1043 </para> | 1061 </para> |
1044 | 1062 |
1045 | 1063 |
1046 <sect3 id="menc-feat-dvd-mpeg4-resolution-bitrate-compute"> | 1064 <sect3 id="menc-feat-dvd-mpeg4-resolution-bitrate-compute"> |
1047 <title>Computing the resolution</title> | 1065 <title>Computing the resolution</title> |
1048 <para> | 1066 |
1049 The following steps will guide you in computing the resolution of your | 1067 <para> |
1050 encode without distorting the video too much, by taking into account several | 1068 The following steps will guide you in computing the resolution of your |
1051 types of information about the source video. | 1069 encode without distorting the video too much, by taking into account several |
1052 First, you should compute the encoded aspect ratio: | 1070 types of information about the source video. |
1053 <systemitem>ARc = (Wc x (ARa / PRdvd )) / Hc</systemitem> | 1071 First, you should compute the encoded aspect ratio: |
1072 <systemitem>ARc = (Wc x (ARa / PRdvd )) / Hc</systemitem> | |
1073 | |
1054 <itemizedlist> | 1074 <itemizedlist> |
1055 <title>where:</title> | 1075 <title>where:</title> |
1056 <listitem><para> | 1076 <listitem><para> |
1057 Wc and Hc are the width and height of the cropped video, | 1077 Wc and Hc are the width and height of the cropped video, |
1058 </para></listitem> | 1078 </para></listitem> |
1065 </para></listitem> | 1085 </para></listitem> |
1066 </itemizedlist> | 1086 </itemizedlist> |
1067 </para> | 1087 </para> |
1068 | 1088 |
1069 <para> | 1089 <para> |
1070 Then, you can compute the X and Y resolution, according to a certain | 1090 Then, you can compute the X and Y resolution, according to a certain |
1071 Compression Quality (CQ) factor: | 1091 Compression Quality (CQ) factor: |
1072 <systemitem>ResY = INT(SQRT( 1000*Bitrate/25/ARc/CQ )/16) * 16</systemitem> | 1092 <systemitem>ResY = INT(SQRT( 1000*Bitrate/25/ARc/CQ )/16) * 16</systemitem> |
1073 and | 1093 and |
1074 <systemitem>ResX = INT( ResY * ARc / 16) * 16</systemitem> | 1094 <systemitem>ResX = INT( ResY * ARc / 16) * 16</systemitem> |
1075 </para> | 1095 </para> |
1076 | 1096 |
1077 <para> | 1097 <para> |
1078 Okay, but what is the CQ? | 1098 Okay, but what is the CQ? |
1079 The CQ represents the number of bits per pixel and per frame of the encode. | 1099 The CQ represents the number of bits per pixel and per frame of the encode. |
1080 Roughly speaking, the greater the CQ, the less the likelihood to see | 1100 Roughly speaking, the greater the CQ, the less the likelihood to see |
1081 encoding artifacts. | 1101 encoding artifacts. |
1082 However, if you have a target size for your movie (1 or 2 CDs for instance), | 1102 However, if you have a target size for your movie (1 or 2 CDs for instance), |
1083 there is a limited total number of bits that you can spend; therefore it is | 1103 there is a limited total number of bits that you can spend; therefore it is |
1084 necessary to find a good tradeoff between compressibility and quality. | 1104 necessary to find a good tradeoff between compressibility and quality. |
1085 </para> | 1105 </para> |
1086 | 1106 |
1087 <para> | 1107 <para> |
1088 The CQ depends on the bitrate, the video codec efficiency and the | 1108 The CQ depends on the bitrate, the video codec efficiency and the |
1089 movie resolution. | 1109 movie resolution. |
1090 In order to raise the CQ, typically you would downscale the movie given that the | 1110 In order to raise the CQ, typically you would downscale the movie given that the |
1091 bitrate is computed in function of the target size and the length of the | 1111 bitrate is computed in function of the target size and the length of the |
1092 movie, which are constant. | 1112 movie, which are constant. |
1093 With MPEG-4 ASP codecs such as <systemitem class="library">Xvid</systemitem> | 1113 With MPEG-4 ASP codecs such as <systemitem class="library">Xvid</systemitem> |
1094 and <systemitem class="library">libavcodec</systemitem>, a CQ below 0.18 | 1114 and <systemitem class="library">libavcodec</systemitem>, a CQ below 0.18 |
1095 usually results in a pretty blocky picture, because there | 1115 usually results in a pretty blocky picture, because there |
1096 are not enough bits to code the information of each macroblock. (MPEG4, like | 1116 are not enough bits to code the information of each macroblock. (MPEG4, like |
1097 many other codecs, groups pixels by blocks of several pixels to compress the | 1117 many other codecs, groups pixels by blocks of several pixels to compress the |
1098 image; if there are not enough bits, the edges of those blocks are | 1118 image; if there are not enough bits, the edges of those blocks are |
1099 visible.) | 1119 visible.) |
1100 It is therefore wise to take a CQ ranging from 0.20 to 0.22 for a 1 CD rip, | 1120 It is therefore wise to take a CQ ranging from 0.20 to 0.22 for a 1 CD rip, |
1101 and 0.26-0.28 for 2 CDs rip with standard encoding options. | 1121 and 0.26-0.28 for 2 CDs rip with standard encoding options. |
1102 More advanced encoding options such as those listed here for | 1122 More advanced encoding options such as those listed here for |
1103 <link linkend="menc-feat-mpeg4-lavc-example-settings"><systemitem class="library">libavcodec</systemitem></link> | 1123 <link linkend="menc-feat-mpeg4-lavc-example-settings"><systemitem class="library">libavcodec</systemitem></link> |
1104 and | 1124 and |
1105 <link linkend="menc-feat-xvid-example-settings"><systemitem class="library">Xvid</systemitem></link> | 1125 <link linkend="menc-feat-xvid-example-settings"><systemitem class="library">Xvid</systemitem></link> |
1106 should make it possible to get the same quality with CQ ranging from | 1126 should make it possible to get the same quality with CQ ranging from |
1107 0.18 to 0.20 for a 1 CD rip, and 0.24 to 0.26 for a 2 CD rip. | 1127 0.18 to 0.20 for a 1 CD rip, and 0.24 to 0.26 for a 2 CD rip. |
1108 With MPEG-4 ASP codecs such as <systemitem class="library">x264</systemitem>, | 1128 With MPEG-4 ASP codecs such as <systemitem class="library">x264</systemitem>, |
1109 you can use a CQ ranging from 0.14 to 0.16 with standard encoding options, | 1129 you can use a CQ ranging from 0.14 to 0.16 with standard encoding options, |
1110 and should be able to go as low as 0.10 to 0.12 with | 1130 and should be able to go as low as 0.10 to 0.12 with |
1111 <link linkend="menc-feat-x264-example-settings"><systemitem class="library">x264</systemitem>'s advanced encoding settings</link>. | 1131 <link linkend="menc-feat-x264-example-settings"><systemitem class="library">x264</systemitem>'s advanced encoding settings</link>. |
1112 </para> | 1132 </para> |
1113 | 1133 |
1114 <para> | 1134 <para> |
1115 Please take note that the CQ is just an indicative figure, as depending on | 1135 Please take note that the CQ is just an indicative figure, as depending on |
1116 the encoded content, a CQ of 0.18 may look just fine for a Bergman, contrary | 1136 the encoded content, a CQ of 0.18 may look just fine for a Bergman, contrary |
1117 to a movie such as The Matrix, which contains many high-motion scenes. | 1137 to a movie such as The Matrix, which contains many high-motion scenes. |
1118 On the other hand, it is worthless to raise CQ higher than 0.30 as you would | 1138 On the other hand, it is worthless to raise CQ higher than 0.30 as you would |
1119 be wasting bits without any noticeable quality gain. | 1139 be wasting bits without any noticeable quality gain. |
1120 Also note that as mentioned earlier in this guide, low resolution videos | 1140 Also note that as mentioned earlier in this guide, low resolution videos |
1121 need a bigger CQ (compared to, for instance, DVD resolution) to look good. | 1141 need a bigger CQ (compared to, for instance, DVD resolution) to look good. |
1122 </para> | 1142 </para> |
1123 </sect3> | 1143 </sect3> |
1124 | |
1125 </sect2> | 1144 </sect2> |
1145 | |
1146 <!-- ********** --> | |
1126 | 1147 |
1127 <sect2 id="menc-feat-dvd-mpeg4-filtering"> | 1148 <sect2 id="menc-feat-dvd-mpeg4-filtering"> |
1128 <title>Filtering</title> | 1149 <title>Filtering</title> |
1129 | 1150 |
1130 <para> | 1151 <para> |
1131 Learning how to use <application>MEncoder</application>'s video filters | 1152 Learning how to use <application>MEncoder</application>'s video filters |
1132 is essential to producing good encodes. | 1153 is essential to producing good encodes. |
1133 All video processing is performed through the filters -- cropping, | 1154 All video processing is performed through the filters -- cropping, |
1134 scaling, color adjustment, noise removal, sharpening, deinterlacing, | 1155 scaling, color adjustment, noise removal, sharpening, deinterlacing, |
1135 telecine, inverse telecine, and deblocking, just to name a few. | 1156 telecine, inverse telecine, and deblocking, just to name a few. |
1136 Along with the vast number of supported input formats, the variety of | 1157 Along with the vast number of supported input formats, the variety of |
1137 filters available in <application>MEncoder</application> is one of its | 1158 filters available in <application>MEncoder</application> is one of its |
1138 main advantages over other similar programs. | 1159 main advantages over other similar programs. |
1139 </para> | 1160 </para> |
1140 | 1161 |
1141 <para> | 1162 <para> |
1142 Filters are loaded in a chain using the -vf option: | 1163 Filters are loaded in a chain using the -vf option: |
1143 | 1164 |
1144 <screen>-vf filter1=options,filter2=options,...</screen> | 1165 <screen>-vf filter1=options,filter2=options,...</screen> |
1145 | 1166 |
1146 Most filters take several numeric options separated by colons, but | 1167 Most filters take several numeric options separated by colons, but |
1147 the syntax for options varies from filter to filter, so read the man | 1168 the syntax for options varies from filter to filter, so read the man |
1148 page for details on the filters you wish to use. | 1169 page for details on the filters you wish to use. |
1149 </para> | 1170 </para> |
1150 | 1171 |
1151 <para> | 1172 <para> |
1152 Filters operate on the video in the order they are loaded. | 1173 Filters operate on the video in the order they are loaded. |
1153 For example, the following chain: | 1174 For example, the following chain: |
1154 | 1175 |
1155 <screen>-vf crop=688:464:12:4,scale=640:464</screen> | 1176 <screen>-vf crop=688:464:12:4,scale=640:464</screen> |
1156 | 1177 |
1157 will first crop the 688x464 region of the picture with upper-left | 1178 will first crop the 688x464 region of the picture with upper-left |
1158 corner at (12,4), and then scale the result down to 640x464. | 1179 corner at (12,4), and then scale the result down to 640x464. |
1159 </para> | 1180 </para> |
1160 | 1181 |
1161 <para> | 1182 <para> |
1162 Certain filters need to be loaded at or near the beginning of the | 1183 Certain filters need to be loaded at or near the beginning of the |
1163 filter chain, in order to take advantage of information from the | 1184 filter chain, in order to take advantage of information from the |
1164 video decoder that will be lost or invalidated by other filters. | 1185 video decoder that will be lost or invalidated by other filters. |
1165 The principal examples are <option>pp</option> (postprocessing, only | 1186 The principal examples are <option>pp</option> (postprocessing, only |
1166 when it is performing deblock or dering operations), | 1187 when it is performing deblock or dering operations), |
1167 <option>spp</option> (another postprocessor to remove MPEG artifacts), | 1188 <option>spp</option> (another postprocessor to remove MPEG artifacts), |
1168 <option>pullup</option> (inverse telecine), and | 1189 <option>pullup</option> (inverse telecine), and |
1169 <option>softpulldown</option> (for converting soft telecine to hard | 1190 <option>softpulldown</option> (for converting soft telecine to hard telecine). |
1170 telecine). | 1191 </para> |
1171 </para> | 1192 |
1172 | 1193 <para> |
1173 <para> | 1194 In general, you want to do as little filtering as possible to the movie |
1174 In general, you want to do as little filtering as possible to the movie | 1195 in order to remain close to the original DVD source. Cropping is often |
1175 in order to remain close to the original DVD source. Cropping is often | 1196 necessary (as described above), but avoid to scale the video. Although |
1176 necessary (as described above), but avoid to scale the video. Although | 1197 scaling down is sometimes preferred to using higher quantizers, we want |
1177 scaling down is sometimes preferred to using higher quantizers, we want | 1198 to avoid both these things: remember that we decided from the start to |
1178 to avoid both these things: remember that we decided from the start to | 1199 trade bits for quality. |
1179 trade bits for quality. | 1200 </para> |
1180 </para> | 1201 |
1181 | 1202 <para> |
1182 <para> | 1203 Also, do not adjust gamma, contrast, brightness, etc. What looks good |
1183 Also, do not adjust gamma, contrast, brightness, etc. What looks good | 1204 on your display may not look good on others. These adjustments should |
1184 on your display may not look good on others. These adjustments should | 1205 be done on playback only. |
1185 be done on playback only. | 1206 </para> |
1186 </para> | 1207 |
1187 | 1208 <para> |
1188 <para> | 1209 One thing you might want to do, however, is pass the video through a |
1189 One thing you might want to do, however, is pass the video through a | 1210 very light denoise filter, such as <option>-vf hqdn3d=2:1:2</option>. |
1190 very light denoise filter, such as <option>-vf hqdn3d=2:1:2</option>. | 1211 Again, it is a matter of putting those bits to better use: why waste them |
1191 Again, it is a matter of putting those bits to better use: why waste them | 1212 encoding noise when you can just add that noise back in during playback? |
1192 encoding noise when you can just add that noise back in during playback? | 1213 Increasing the parameters for <option>hqdn3d</option> will further |
1193 Increasing the parameters for <option>hqdn3d</option> will further | 1214 improve compressibility, but if you increase the values too much, you |
1194 improve compressibility, but if you increase the values too much, you | 1215 risk degrading the image visibily. The suggested values above |
1195 risk degrading the image visibily. The suggested values above | 1216 (<option>2:1:2</option>) are quite conservative; you should feel free to |
1196 (<option>2:1:2</option>) are quite conservative; you should feel free to | 1217 experiment with higher values and observe the results for yourself. |
1197 experiment with higher values and observe the results for yourself. | 1218 </para> |
1198 </para> | |
1199 | |
1200 </sect2> | 1219 </sect2> |
1201 | 1220 |
1221 <!-- ********** --> | |
1202 | 1222 |
1203 <sect2 id="menc-feat-dvd-mpeg4-interlacing"> | 1223 <sect2 id="menc-feat-dvd-mpeg4-interlacing"> |
1204 <title>Interlacing and Telecine</title> | 1224 <title>Interlacing and Telecine</title> |
1205 | 1225 |
1206 <para> | 1226 <para> |
1207 Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some | 1227 Almost all movies are shot at 24 fps. Because NTSC is 30000/1001 fps, some |
1208 processing must be done to this 24 fps video to make it run at the correct | 1228 processing must be done to this 24 fps video to make it run at the correct |
1209 NTSC framerate. The process is called 3:2 pulldown, commonly referred to | 1229 NTSC framerate. The process is called 3:2 pulldown, commonly referred to |
1210 as telecine (because pulldown is often applied during the telecine | 1230 as telecine (because pulldown is often applied during the telecine |
1211 process), and, naively described, it works by slowing the film down to | 1231 process), and, naively described, it works by slowing the film down to |
1212 24000/1001 fps, and repeating every fourth frame. | 1232 24000/1001 fps, and repeating every fourth frame. |
1213 </para> | 1233 </para> |
1214 | 1234 |
1215 <para> | 1235 <para> |
1216 No special processing, however, is done to the video for PAL DVDs, which | 1236 No special processing, however, is done to the video for PAL DVDs, which |
1217 run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown, | 1237 run at 25 fps. (Technically, PAL can be telecined, called 2:2 pulldown, |
1218 but this does not become an issue in practice.) The 24 fps film is simply | 1238 but this does not become an issue in practice.) The 24 fps film is simply |
1219 played back at 25 fps. The result is that the movie runs slightly faster, | 1239 played back at 25 fps. The result is that the movie runs slightly faster, |
1220 but unless you are an alien, you probably will not notice the difference. | 1240 but unless you are an alien, you probably will not notice the difference. |
1221 Most PAL DVDs have pitch-corrected audio, so when they are played back at | 1241 Most PAL DVDs have pitch-corrected audio, so when they are played back at |
1222 25 fps things will sound right, even though the audio track (and hence the | 1242 25 fps things will sound right, even though the audio track (and hence the |
1223 whole movie) has a running time that is 4% less than NTSC DVDs. | 1243 whole movie) has a running time that is 4% less than NTSC DVDs. |
1224 </para> | 1244 </para> |
1225 | 1245 |
1226 <para> | 1246 <para> |
1227 Because the video in a PAL DVD has not been altered, you need not worry | 1247 Because the video in a PAL DVD has not been altered, you need not worry |
1228 much about framerate. The source is 25 fps, and your rip will be 25 | 1248 much about framerate. The source is 25 fps, and your rip will be 25 |
1229 fps. However, if you are ripping an NTSC DVD movie, you may need to | 1249 fps. However, if you are ripping an NTSC DVD movie, you may need to |
1230 apply inverse telecine. | 1250 apply inverse telecine. |
1231 </para> | 1251 </para> |
1232 | 1252 |
1233 <para> | 1253 <para> |
1234 For movies shot at 24 fps, the video on the NTSC DVD is either telecined | 1254 For movies shot at 24 fps, the video on the NTSC DVD is either telecined |
1235 30000/1001, or else it is progressive 24000/1001 fps and intended to be telecined | 1255 30000/1001, or else it is progressive 24000/1001 fps and intended to be |
1236 on-the-fly by a DVD player. On the other hand, TV series are usually | 1256 telecined on-the-fly by a DVD player. On the other hand, TV series are usually |
1237 only interlaced, not telecined. This is not a hard rule: some TV series | 1257 only interlaced, not telecined. This is not a hard rule: some TV series |
1238 are interlaced (such as Buffy the Vampire Slayer) whereas some are a | 1258 are interlaced (such as Buffy the Vampire Slayer) whereas some are a |
1239 mixture of progressive and interlaced (such as Angel, or 24). | 1259 mixture of progressive and interlaced (such as Angel, or 24). |
1240 </para> | 1260 </para> |
1241 | 1261 |
1242 <para> | 1262 <para> |
1243 It is highly recommended that you read the section on | 1263 It is highly recommended that you read the section on |
1244 <link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link> | 1264 <link linkend="menc-feat-telecine">How to deal with telecine and interlacing in NTSC DVDs</link> |
1245 to learn how to handle the different possibilities. | 1265 to learn how to handle the different possibilities. |
1246 </para> | 1266 </para> |
1247 | 1267 |
1248 <para> | 1268 <para> |
1249 However, if you are mostly just ripping movies, likely you are either | 1269 However, if you are mostly just ripping movies, likely you are either |
1250 dealing with 24 fps progressive or telecined video, in which case you can | 1270 dealing with 24 fps progressive or telecined video, in which case you can |
1251 use the <option>pullup</option> filter <option>-vf | 1271 use the <option>pullup</option> filter <option>-vf |
1252 pullup,softskip</option>. | 1272 pullup,softskip</option>. |
1253 </para> | 1273 </para> |
1254 | |
1255 </sect2> | 1274 </sect2> |
1275 | |
1276 <!-- ********** --> | |
1256 | 1277 |
1257 <sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced"> | 1278 <sect2 id="menc-feat-dvd-mpeg4-encoding-interlaced"> |
1258 <title>Encoding interlaced video</title> | 1279 <title>Encoding interlaced video</title> |
1259 | 1280 |
1260 <para> | 1281 <para> |
1261 If the movie you want to encode is interlaced (NTSC video or | 1282 If the movie you want to encode is interlaced (NTSC video or |
1262 PAL video), you will need to choose whether you want to | 1283 PAL video), you will need to choose whether you want to |
1263 deinterlace or not. | 1284 deinterlace or not. |
1264 While deinterlacing will make your movie usable on progressive | 1285 While deinterlacing will make your movie usable on progressive |
1265 scan displays such a computer monitors and projectors, it comes | 1286 scan displays such a computer monitors and projectors, it comes |
1266 at a cost: The fieldrate of 50 or 60000/1001 fields per second | 1287 at a cost: The fieldrate of 50 or 60000/1001 fields per second |
1267 is halved to 25 or 30000/1001 frames per second, and roughly half of | 1288 is halved to 25 or 30000/1001 frames per second, and roughly half of |
1268 the information in your movie will be lost during scenes with | 1289 the information in your movie will be lost during scenes with |
1269 significant motion. | 1290 significant motion. |
1270 </para> | 1291 </para> |
1271 | 1292 |
1272 <para> | 1293 <para> |
1273 Therefore, if you are encoding for high quality archival purposes, | 1294 Therefore, if you are encoding for high quality archival purposes, |
1274 it is recommended not to deinterlace. | 1295 it is recommended not to deinterlace. |
1275 You can always deinterlace the movie at playback time when | 1296 You can always deinterlace the movie at playback time when |
1276 displaying it on progressive scan devices. | 1297 displaying it on progressive scan devices. |
1277 The power of currently available computers forces players to use a | 1298 The power of currently available computers forces players to use a |
1278 deinterlacing filter, which results in a slight degradation in | 1299 deinterlacing filter, which results in a slight degradation in |
1279 image quality. | 1300 image quality. |
1280 But future players will be able to mimic the interlaced display of | 1301 But future players will be able to mimic the interlaced display of |
1281 a TV, deinterlacing to full fieldrate and interpolating 50 or | 1302 a TV, deinterlacing to full fieldrate and interpolating 50 or |
1282 60000/1001 entire frames per second from the interlaced video. | 1303 60000/1001 entire frames per second from the interlaced video. |
1283 </para> | 1304 </para> |
1284 | 1305 |
1285 <para> | 1306 <para> |
1286 Special care must be taken when working with interlaced video: | 1307 Special care must be taken when working with interlaced video: |
1287 </para> | 1308 </para> |
1300 </para></listitem> | 1321 </para></listitem> |
1301 </orderedlist> | 1322 </orderedlist> |
1302 | 1323 |
1303 <para> | 1324 <para> |
1304 With these things in mind, here is our first example: | 1325 With these things in mind, here is our first example: |
1305 </para> | |
1306 <screen> | 1326 <screen> |
1307 mencoder <replaceable>capture.avi</replaceable> -mc 0 -oac lavc -ovc lavc -lavcopts \ | 1327 mencoder <replaceable>capture.avi</replaceable> -mc 0 -oac lavc -ovc lavc -lavcopts \ |
1308 vcodec=mpeg2video:vbitrate=6000:ilme:ildct:acodec=mp2:abitrate=224 | 1328 vcodec=mpeg2video:vbitrate=6000:ilme:ildct:acodec=mp2:abitrate=224 |
1309 </screen> | 1329 </screen> |
1310 <para> | |
1311 Note the <option>ilme</option> and <option>ildct</option> options. | 1330 Note the <option>ilme</option> and <option>ildct</option> options. |
1312 </para> | 1331 </para> |
1313 </sect2> | 1332 </sect2> |
1314 | 1333 |
1334 <!-- ********** --> | |
1315 | 1335 |
1316 <sect2 id="menc-feat-dvd-mpeg4-av-sync"> | 1336 <sect2 id="menc-feat-dvd-mpeg4-av-sync"> |
1317 <title>Notes on Audio/Video synchronization</title> | 1337 <title>Notes on Audio/Video synchronization</title> |
1338 | |
1318 <para> | 1339 <para> |
1319 <application>MEncoder</application>'s audio/video synchronization | 1340 <application>MEncoder</application>'s audio/video synchronization |
1320 algorithms were designed with the intention of recovering files with | 1341 algorithms were designed with the intention of recovering files with |
1321 broken sync. | 1342 broken sync. |
1322 However, in some cases they can cause unnecessary skipping and duplication of | 1343 However, in some cases they can cause unnecessary skipping and duplication of |
1327 the <option>-mc 0</option> option, or put this in your | 1348 the <option>-mc 0</option> option, or put this in your |
1328 <systemitem>~/.mplayer/mencoder</systemitem> config file, as long as | 1349 <systemitem>~/.mplayer/mencoder</systemitem> config file, as long as |
1329 you are only working with good sources (DVD, TV capture, high quality | 1350 you are only working with good sources (DVD, TV capture, high quality |
1330 MPEG-4 rips, etc) and not broken ASF/RM/MOV files. | 1351 MPEG-4 rips, etc) and not broken ASF/RM/MOV files. |
1331 </para> | 1352 </para> |
1353 | |
1332 <para> | 1354 <para> |
1333 If you want to further guard against strange frame skips and | 1355 If you want to further guard against strange frame skips and |
1334 duplication, you can use both <option>-mc 0</option> and | 1356 duplication, you can use both <option>-mc 0</option> and |
1335 <option>-noskip</option>. | 1357 <option>-noskip</option>. |
1336 This will prevent <emphasis>all</emphasis> A/V sync, and copy frames | 1358 This will prevent <emphasis>all</emphasis> A/V sync, and copy frames |
1337 one-to-one, so you cannot use it if you will be using any filters that | 1359 one-to-one, so you cannot use it if you will be using any filters that |
1338 unpredictably add or drop frames, or if your input file has variable | 1360 unpredictably add or drop frames, or if your input file has variable |
1339 framerate! | 1361 framerate! |
1340 Therefore, using <option>-noskip</option> is not in general recommended. | 1362 Therefore, using <option>-noskip</option> is not in general recommended. |
1341 </para> | 1363 </para> |
1342 <para> | 1364 |
1343 The so-called "three-pass" audio encoding which <application>MEncoder</application> | 1365 <para> |
1344 supports has been reported to cause A/V desync. | 1366 The so-called "three-pass" audio encoding which |
1367 <application>MEncoder</application> supports has been reported to cause A/V | |
1368 desync. | |
1345 This will definitely happen if it is used in conjunction with certain | 1369 This will definitely happen if it is used in conjunction with certain |
1346 filters, therefore, it is now recommended <emphasis>not</emphasis> to | 1370 filters, therefore, it is now recommended <emphasis>not</emphasis> to |
1347 use three-pass audio mode. | 1371 use three-pass audio mode. |
1348 This feature is only left for compatibility purposes and for expert | 1372 This feature is only left for compatibility purposes and for expert |
1349 users who understand when it is safe to use and when it is not. | 1373 users who understand when it is safe to use and when it is not. |
1350 If you have never heard of three-pass mode before, forget that we | 1374 If you have never heard of three-pass mode before, forget that we |
1351 even mentioned it! | 1375 even mentioned it! |
1352 </para> | 1376 </para> |
1377 | |
1353 <para> | 1378 <para> |
1354 There have also been reports of A/V desync when encoding from stdin | 1379 There have also been reports of A/V desync when encoding from stdin |
1355 with <application>MEncoder</application>. | 1380 with <application>MEncoder</application>. |
1356 Do not do this! Always use a file or CD/DVD/etc device as input. | 1381 Do not do this! Always use a file or CD/DVD/etc device as input. |
1357 </para> | 1382 </para> |
1358 </sect2> | 1383 </sect2> |
1359 | 1384 |
1385 <!-- ********** --> | |
1386 | |
1360 <sect2 id="menc-feat-dvd-mpeg4-codec"> | 1387 <sect2 id="menc-feat-dvd-mpeg4-codec"> |
1361 <title>Choosing the video codec</title> | 1388 <title>Choosing the video codec</title> |
1362 | 1389 |
1363 <para> | 1390 <para> |
1364 Which video codec is best to choose depends on several factors, | 1391 Which video codec is best to choose depends on several factors, |
1365 like size, quality, streamability, usability and popularity, some of | 1392 like size, quality, streamability, usability and popularity, some of |
1366 which widely depend on personal taste and technical constraints. | 1393 which widely depend on personal taste and technical constraints. |
1367 </para> | 1394 </para> |
1368 <itemizedlist> | 1395 <itemizedlist> |
1369 <listitem><para> | 1396 <listitem> |
1397 <para> | |
1370 <emphasis role="bold">Compression efficiency</emphasis>: | 1398 <emphasis role="bold">Compression efficiency</emphasis>: |
1371 It is quite easy to understand that most newer-generation codecs are | 1399 It is quite easy to understand that most newer-generation codecs are |
1372 made to increase quality and compression. | 1400 made to increase quality and compression. |
1373 Therefore, the authors of this guide and many other people suggest that | 1401 Therefore, the authors of this guide and many other people suggest that |
1374 you cannot go wrong | 1402 you cannot go wrong |
1375 <footnote id='fn-menc-feat-dvd-mpeg4-codec-cpu'> | 1403 <footnote id='fn-menc-feat-dvd-mpeg4-codec-cpu'><para> |
1376 <para>Be careful, however: Decoding DVD-resolution MPEG-4 AVC videos | 1404 Be careful, however: Decoding DVD-resolution MPEG-4 AVC videos |
1377 requires a fast machine (i.e. a Pentium 4 over 1.5GHz or a Pentium M | 1405 requires a fast machine (i.e. a Pentium 4 over 1.5GHz or a Pentium M |
1378 over 1GHz). | 1406 over 1GHz). |
1379 </para></footnote> | 1407 </para></footnote> |
1380 when choosing MPEG-4 AVC codecs like | 1408 when choosing MPEG-4 AVC codecs like |
1381 <systemitem class="library">x264</systemitem> instead of MPEG-4 ASP codecs | 1409 <systemitem class="library">x264</systemitem> instead of MPEG-4 ASP codecs |
1385 Niedermayer's opinion on | 1413 Niedermayer's opinion on |
1386 "<ulink url="http://guru.multimedia.cx/?p=10">why MPEG4-ASP sucks</ulink>".) | 1414 "<ulink url="http://guru.multimedia.cx/?p=10">why MPEG4-ASP sucks</ulink>".) |
1387 Likewise, you should get better quality using MPEG-4 ASP than you | 1415 Likewise, you should get better quality using MPEG-4 ASP than you |
1388 would with MPEG-2 codecs. | 1416 would with MPEG-2 codecs. |
1389 </para> | 1417 </para> |
1418 | |
1390 <para> | 1419 <para> |
1391 However, newer codecs which are in heavy development can suffer from | 1420 However, newer codecs which are in heavy development can suffer from |
1392 bugs which have not yet been noticed and which can ruin an encode. | 1421 bugs which have not yet been noticed and which can ruin an encode. |
1393 This is simply the tradeoff for using bleeding-edge technology. | 1422 This is simply the tradeoff for using bleeding-edge technology. |
1394 </para> | 1423 </para> |
1424 | |
1395 <para> | 1425 <para> |
1396 What is more, beginning to use a new codec requires that you spend some | 1426 What is more, beginning to use a new codec requires that you spend some |
1397 time becoming familiar with its options, so that you know what | 1427 time becoming familiar with its options, so that you know what |
1398 to adjust to achieve a desired picture quality. | 1428 to adjust to achieve a desired picture quality. |
1399 </para></listitem> | 1429 </para> |
1400 | 1430 </listitem> |
1401 <listitem><para> | 1431 |
1432 <listitem><para> | |
1402 <emphasis role="bold">Hardware compatibility</emphasis>: | 1433 <emphasis role="bold">Hardware compatibility</emphasis>: |
1403 It usually takes a long time for standalone video players to begin to | 1434 It usually takes a long time for standalone video players to begin to |
1404 include support for the latest video codecs. | 1435 include support for the latest video codecs. |
1405 As a result, most only support MPEG-1 (like VCD, XVCD and KVCD), MPEG-2 | 1436 As a result, most only support MPEG-1 (like VCD, XVCD and KVCD), MPEG-2 |
1406 (like DVD, SVCD and KVCD) and MPEG-4 ASP (like DivX, | 1437 (like DVD, SVCD and KVCD) and MPEG-4 ASP (like DivX, |
1407 <systemitem class="library">libavcodec</systemitem>'s LMP4 and | 1438 <systemitem class="library">libavcodec</systemitem>'s LMP4 and |
1408 <systemitem class="library">Xvid</systemitem>) | 1439 <systemitem class="library">Xvid</systemitem>) |
1409 (Beware: Usually, not all MPEG-4 ASP features are supported). | 1440 (Beware: Usually, not all MPEG-4 ASP features are supported). |
1410 Please refer to the technical specs of your player (if they are available), | 1441 Please refer to the technical specs of your player (if they are available), |
1411 or google around for more information. | 1442 or google around for more information. |
1412 </para></listitem> | 1443 </para></listitem> |
1413 | 1444 |
1414 <listitem><para> | 1445 <listitem> |
1446 <para> | |
1415 <emphasis role="bold">Best quality per encoding time</emphasis>: | 1447 <emphasis role="bold">Best quality per encoding time</emphasis>: |
1416 Codecs that have been around for some time (such as | 1448 Codecs that have been around for some time (such as |
1417 <systemitem class="library">libavcodec</systemitem> MPEG-4 and | 1449 <systemitem class="library">libavcodec</systemitem> MPEG-4 and |
1418 <systemitem class="library">Xvid</systemitem>) are usually heavily | 1450 <systemitem class="library">Xvid</systemitem>) are usually heavily |
1419 optimized with all kinds of smart algorithms and SIMD assembly code. | 1451 optimized with all kinds of smart algorithms and SIMD assembly code. |
1420 That is why they tend to yield the best quality per encoding time ratio. | 1452 That is why they tend to yield the best quality per encoding time ratio. |
1421 However, they may have some very advanced options that, if enabled, | 1453 However, they may have some very advanced options that, if enabled, |
1422 will make the encode really slow for marginal gains. | 1454 will make the encode really slow for marginal gains. |
1423 </para> | 1455 </para> |
1456 | |
1424 <para> | 1457 <para> |
1425 If you are after blazing speed you should stick around the default | 1458 If you are after blazing speed you should stick around the default |
1426 settings of the video codec (although you should still try the other | 1459 settings of the video codec (although you should still try the other |
1427 options which are mentioned in other sections of this guide). | 1460 options which are mentioned in other sections of this guide). |
1428 </para> | 1461 </para> |
1462 | |
1429 <para> | 1463 <para> |
1430 You may also consider choosing a codec which can do multi-threaded | 1464 You may also consider choosing a codec which can do multi-threaded |
1431 processing, though this is only useful for users of machines with | 1465 processing, though this is only useful for users of machines with |
1432 several CPUs. | 1466 several CPUs. |
1433 <systemitem class="library">libavcodec</systemitem> MPEG-4 does | 1467 <systemitem class="library">libavcodec</systemitem> MPEG-4 does |
1438 boost encoding speed — by about 40-60% in typical cases — | 1472 boost encoding speed — by about 40-60% in typical cases — |
1439 with little if any picture degradation. | 1473 with little if any picture degradation. |
1440 <systemitem class="library">x264</systemitem> also allows multi-threaded | 1474 <systemitem class="library">x264</systemitem> also allows multi-threaded |
1441 encoding, which currently speeds up encoding by 15-30% (depending on | 1475 encoding, which currently speeds up encoding by 15-30% (depending on |
1442 the encoding settings) while lowering PSNR by about 0.05dB. | 1476 the encoding settings) while lowering PSNR by about 0.05dB. |
1443 </para></listitem> | 1477 </para> |
1444 | 1478 </listitem> |
1445 <listitem><para> | 1479 |
1480 <listitem> | |
1481 <para> | |
1446 <emphasis role="bold">Personal taste</emphasis>: | 1482 <emphasis role="bold">Personal taste</emphasis>: |
1447 This is where it gets almost irrational: For the same reason that some | 1483 This is where it gets almost irrational: For the same reason that some |
1448 hung on to DivX 3 for years when newer codecs were already doing wonders, | 1484 hung on to DivX 3 for years when newer codecs were already doing wonders, |
1449 some folks will prefer <systemitem class="library">Xvid</systemitem> | 1485 some folks will prefer <systemitem class="library">Xvid</systemitem> |
1450 or <systemitem class="library">libavcodec</systemitem> MPEG-4 over | 1486 or <systemitem class="library">libavcodec</systemitem> MPEG-4 over |
1455 swear by one codec. | 1491 swear by one codec. |
1456 Take a few sample clips from raw sources and compare different | 1492 Take a few sample clips from raw sources and compare different |
1457 encoding options and codecs to find one that suits you best. | 1493 encoding options and codecs to find one that suits you best. |
1458 The best codec is the one you master, and the one that looks | 1494 The best codec is the one you master, and the one that looks |
1459 best to your eyes on your display | 1495 best to your eyes on your display |
1460 <footnote id='fn-menc-feat-dvd-mpeg4-codec-playback'> | 1496 <footnote id='fn-menc-feat-dvd-mpeg4-codec-playback'><para> |
1461 <para>The same encode may not look the same on someone else's monitor or | 1497 The same encode may not look the same on someone else's monitor or |
1462 when played back by a different decoder, so future-proof your encodes by | 1498 when played back by a different decoder, so future-proof your encodes by |
1463 playing them back on different setups.</para></footnote>! | 1499 playing them back on different setups. |
1464 </para></listitem> | 1500 </para></footnote>! |
1501 </para> | |
1502 </listitem> | |
1465 </itemizedlist> | 1503 </itemizedlist> |
1466 <para> | 1504 |
1467 Please refer to the section | 1505 <para> |
1468 <link linkend="menc-feat-selecting-codec">selecting codecs and container formats</link> | 1506 Please refer to the section |
1469 to get a list of supported codecs. | 1507 <link linkend="menc-feat-selecting-codec">selecting codecs and container formats</link> |
1508 to get a list of supported codecs. | |
1470 </para> | 1509 </para> |
1471 </sect2> | 1510 </sect2> |
1511 | |
1512 <!-- ********** --> | |
1472 | 1513 |
1473 <sect2 id="menc-feat-dvd-mpeg4-audio"> | 1514 <sect2 id="menc-feat-dvd-mpeg4-audio"> |
1474 <title>Audio</title> | 1515 <title>Audio</title> |
1475 | 1516 |
1476 <para> | 1517 <para> |
1477 Audio is a much simpler problem to solve: if you care about quality, just | 1518 Audio is a much simpler problem to solve: if you care about quality, just |
1478 leave it as is. | 1519 leave it as is. |
1479 Even AC3 5.1 streams are at most 448Kbit/s, and they are worth every bit. | 1520 Even AC3 5.1 streams are at most 448Kbit/s, and they are worth every bit. |
1480 You might be tempted to transcode the audio to high quality Vorbis, but | 1521 You might be tempted to transcode the audio to high quality Vorbis, but |
1481 just because you do not have an A/V receiver for AC3 pass-through today | 1522 just because you do not have an A/V receiver for AC3 pass-through today |
1482 does not mean you will not have one tomorrow. Future-proof your DVD rips by | 1523 does not mean you will not have one tomorrow. Future-proof your DVD rips by |
1483 preserving the AC3 stream. | 1524 preserving the AC3 stream. |
1484 You can keep the AC3 stream either by copying it directly into the video | 1525 You can keep the AC3 stream either by copying it directly into the video |
1485 stream <link linkend="menc-feat-mpeg4">during the encoding</link>. | 1526 stream <link linkend="menc-feat-mpeg4">during the encoding</link>. |
1486 You can also extract the AC3 stream in order to mux it into containers such | 1527 You can also extract the AC3 stream in order to mux it into containers such |
1487 as NUT or Matroska. | 1528 as NUT or Matroska. |
1488 <screen>mplayer <replaceable>source_file.vob</replaceable> -aid 129 -dumpaudio -dumpfile <replaceable>sound.ac3</replaceable></screen> | 1529 <screen> |
1489 will dump into the file <replaceable>sound.ac3</replaceable> the | 1530 mplayer <replaceable>source_file.vob</replaceable> -aid 129 -dumpaudio -dumpfile <replaceable>sound.ac3</replaceable> |
1490 audio track number 129 from the file | 1531 </screen> |
1491 <replaceable>source_file.vob</replaceable> (NB: DVD VOB files | 1532 will dump into the file <replaceable>sound.ac3</replaceable> the |
1492 usually use a different audio numbering, | 1533 audio track number 129 from the file |
1493 which means that the VOB audio track 129 is the 2nd audio track of the file). | 1534 <replaceable>source_file.vob</replaceable> (NB: DVD VOB files |
1494 </para> | 1535 usually use a different audio numbering, |
1495 | 1536 which means that the VOB audio track 129 is the 2nd audio track of the file). |
1496 <para> | 1537 </para> |
1497 But sometimes you truly have no choice but to further compress the | 1538 |
1498 sound so that more bits can be spent on the video. | 1539 <para> |
1499 Most people choose to compress audio with either MP3 or Vorbis audio | 1540 But sometimes you truly have no choice but to further compress the |
1500 codecs. | 1541 sound so that more bits can be spent on the video. |
1501 While the latter is a very space-efficient codec, MP3 is better supported | 1542 Most people choose to compress audio with either MP3 or Vorbis audio codecs. |
1502 by hardware players, although this trend is changing. | 1543 While the latter is a very space-efficient codec, MP3 is better supported |
1503 </para> | 1544 by hardware players, although this trend is changing. |
1504 | 1545 </para> |
1505 <para> | 1546 |
1506 Do <emphasis>not</emphasis> use <option>-nosound</option> when encoding | 1547 <para> |
1507 a file with audio, even if you will be encoding and muxing audio | 1548 Do <emphasis>not</emphasis> use <option>-nosound</option> when encoding |
1508 separately later. | 1549 a file with audio, even if you will be encoding and muxing audio |
1509 Though it may work in ideal cases, using <option>-nosound</option> is | 1550 separately later. |
1510 likely to hide some problems in your encoding command line setting. | 1551 Though it may work in ideal cases, using <option>-nosound</option> is |
1511 In other words, having a soundtrack during your encode assures you that, | 1552 likely to hide some problems in your encoding command line setting. |
1512 provided you do not see messages such as | 1553 In other words, having a soundtrack during your encode assures you that, |
1513 <quote>Too many audio packets in the buffer</quote>, you will be able | 1554 provided you do not see messages such as |
1514 to get proper sync. | 1555 <quote>Too many audio packets in the buffer</quote>, you will be able |
1515 </para> | 1556 to get proper sync. |
1516 | 1557 </para> |
1517 <para> | 1558 |
1518 You need to have <application>MEncoder</application> process the sound. | 1559 <para> |
1519 You can for example copy the orignal soundtrack during the encode with | 1560 You need to have <application>MEncoder</application> process the sound. |
1520 <option>-oac copy</option> or convert it to a "light" 4 kHz mono WAV | 1561 You can for example copy the orignal soundtrack during the encode with |
1521 PCM with <option>-oac pcm -channels 1 -srate 4000</option>. | 1562 <option>-oac copy</option> or convert it to a "light" 4 kHz mono WAV |
1522 Otherwise, in some cases, it will generate a video file that will not sync | 1563 PCM with <option>-oac pcm -channels 1 -srate 4000</option>. |
1523 with the audio. | 1564 Otherwise, in some cases, it will generate a video file that will not sync |
1524 Such cases are when the number of video frames in the source file does | 1565 with the audio. |
1525 not match up to the total length of audio frames or whenever there | 1566 Such cases are when the number of video frames in the source file does |
1526 are discontinuities/splices where there are missing or extra audio frames. | 1567 not match up to the total length of audio frames or whenever there |
1527 The correct way to handle this kind of problem is to insert silence or | 1568 are discontinuities/splices where there are missing or extra audio frames. |
1528 cut audio at these points. | 1569 The correct way to handle this kind of problem is to insert silence or |
1529 However <application>MPlayer</application> cannot do that, so if you | 1570 cut audio at these points. |
1530 demux the AC3 audio and encode it with a separate app (or dump it to PCM with | 1571 However <application>MPlayer</application> cannot do that, so if you |
1531 <application>MPlayer</application>), the splices will be left incorrect | 1572 demux the AC3 audio and encode it with a separate app (or dump it to PCM with |
1532 and the only way to correct them is to drop/dup video frames at the | 1573 <application>MPlayer</application>), the splices will be left incorrect |
1533 splice. | 1574 and the only way to correct them is to drop/dup video frames at the |
1534 As long as <application>MEncoder</application> sees the audio when it is | 1575 splice. |
1535 encoding the video, it can do this dropping/duping (which is usually OK | 1576 As long as <application>MEncoder</application> sees the audio when it is |
1536 since it takes place at full black/scenechange), but if | 1577 encoding the video, it can do this dropping/duping (which is usually OK |
1537 <application>MEncoder</application> cannot see the audio, it will just | 1578 since it takes place at full black/scenechange), but if |
1538 process all frames as-is and they will not fit the final audio stream when | 1579 <application>MEncoder</application> cannot see the audio, it will just |
1539 you for example merge your audio and video track into a Matroska file. | 1580 process all frames as-is and they will not fit the final audio stream when |
1540 </para> | 1581 you for example merge your audio and video track into a Matroska file. |
1541 | 1582 </para> |
1542 <para> | 1583 |
1543 First of all, you will have to convert the DVD sound into a WAV file that the | 1584 <para> |
1544 audio codec can use as input. | 1585 First of all, you will have to convert the DVD sound into a WAV file that the |
1545 For example: | 1586 audio codec can use as input. |
1546 <screen>mplayer <replaceable>source_file.vob</replaceable> -ao pcm:file=<replaceable>destination_sound.wav</replaceable> -vc dummy -aid 1 -vo null</screen> | 1587 For example: |
1547 will dump the second audio track from the file | 1588 <screen> |
1548 <replaceable>source_file.vob</replaceable> into the file | 1589 mplayer <replaceable>source_file.vob</replaceable> -ao pcm:file=<replaceable>destination_sound.wav</replaceable> \ |
1549 <replaceable>destination_sound.wav</replaceable>. | 1590 -vc dummy -aid 1 -vo null |
1550 You may want to normalize the sound before encoding, as DVD audio tracks | 1591 </screen> |
1551 are commonly recorded at low volumes. | 1592 will dump the second audio track from the file |
1552 You can use the tool <application>normalize</application> for instance, | 1593 <replaceable>source_file.vob</replaceable> into the file |
1553 which is available in most distributions. | 1594 <replaceable>destination_sound.wav</replaceable>. |
1554 If you are using Windows, a tool such as <application>BeSweet</application> | 1595 You may want to normalize the sound before encoding, as DVD audio tracks |
1555 can do the same job. | 1596 are commonly recorded at low volumes. |
1556 You will compress in either Vorbis or MP3. | 1597 You can use the tool <application>normalize</application> for instance, |
1557 For example: | 1598 which is available in most distributions. |
1558 <screen>oggenc -q1 <replaceable>destination_sound.wav</replaceable></screen> | 1599 If you are using Windows, a tool such as <application>BeSweet</application> |
1559 will encode <replaceable>destination_sound.wav</replaceable> with | 1600 can do the same job. |
1560 the encoding quality 1, which is roughly equivalent to 80Kb/s, and | 1601 You will compress in either Vorbis or MP3. |
1561 is the minimum quality at which you should encode if you care about | 1602 For example: |
1562 quality. | 1603 <screen>oggenc -q1 <replaceable>destination_sound.wav</replaceable></screen> |
1563 Please note that <application>MEncoder</application> currently cannot | 1604 will encode <replaceable>destination_sound.wav</replaceable> with |
1564 mux Vorbis audio tracks | 1605 the encoding quality 1, which is roughly equivalent to 80Kb/s, and |
1565 into the output file because it only supports AVI and MPEG | 1606 is the minimum quality at which you should encode if you care about |
1566 containers as an output, each of which may lead to audio/video | 1607 quality. |
1567 playback synchronization problems with some players when the AVI file | 1608 Please note that <application>MEncoder</application> currently cannot |
1568 contain VBR audio streams such as Vorbis. | 1609 mux Vorbis audio tracks |
1569 Do not worry, this document will show you how you can do that with third | 1610 into the output file because it only supports AVI and MPEG |
1570 party programs. | 1611 containers as an output, each of which may lead to audio/video |
1571 </para> | 1612 playback synchronization problems with some players when the AVI file |
1572 | 1613 contain VBR audio streams such as Vorbis. |
1614 Do not worry, this document will show you how you can do that with third | |
1615 party programs. | |
1616 </para> | |
1573 </sect2> | 1617 </sect2> |
1574 | 1618 |
1619 <!-- ********** --> | |
1575 | 1620 |
1576 <sect2 id="menc-feat-dvd-mpeg4-muxing"> | 1621 <sect2 id="menc-feat-dvd-mpeg4-muxing"> |
1577 <title>Muxing</title> | 1622 <title>Muxing</title> |
1578 <para> | 1623 |
1579 Now that you have encoded your video, you will most likely want | 1624 <para> |
1580 to mux it with one or more audio tracks into a movie container, such | 1625 Now that you have encoded your video, you will most likely want |
1581 as AVI, MPEG, Matroska or NUT. | 1626 to mux it with one or more audio tracks into a movie container, such |
1582 <application>MEncoder</application> is currently only able to natively output | 1627 as AVI, MPEG, Matroska or NUT. |
1583 audio and video into MPEG and AVI container formats. | 1628 <application>MEncoder</application> is currently only able to natively output |
1584 for example: | 1629 audio and video into MPEG and AVI container formats. |
1585 <screen>mencoder -oac copy -ovc copy -o <replaceable>output_movie.avi</replaceable> -audiofile <replaceable>input_audio.mp2</replaceable> <replaceable>input_video.avi</replaceable></screen> | 1630 for example: |
1586 This would merge the video file <replaceable>input_video.avi</replaceable> | 1631 <screen> |
1587 and the audio file <replaceable>input_audio.mp2</replaceable> | 1632 mencoder -oac copy -ovc copy -o <replaceable>output_movie.avi</replaceable> \ |
1588 into the AVI file <replaceable>output_movie.avi</replaceable>. | 1633 -audiofile <replaceable>input_audio.mp2</replaceable> <replaceable>input_video.avi</replaceable> |
1589 This command works with MPEG-1 layer I, II and III (more commonly known | 1634 </screen> |
1590 as MP3) audio, WAV and a few other audio formats too. | 1635 This would merge the video file <replaceable>input_video.avi</replaceable> |
1591 </para> | 1636 and the audio file <replaceable>input_audio.mp2</replaceable> |
1592 | 1637 into the AVI file <replaceable>output_movie.avi</replaceable>. |
1593 <para> | 1638 This command works with MPEG-1 layer I, II and III (more commonly known |
1594 <application>MEncoder</application> features experimental support for | 1639 as MP3) audio, WAV and a few other audio formats too. |
1595 <systemitem class="library">libavformat</systemitem>, which is a | 1640 </para> |
1596 library from the FFmpeg project that supports muxing and demuxing | 1641 |
1597 a variety of containers. | 1642 <para> |
1598 For example: | 1643 <application>MEncoder</application> features experimental support for |
1599 <screen>mencoder -oac copy -ovc copy -o <replaceable>output_movie.asf</replaceable> -audiofile <replaceable>input_audio.mp2</replaceable> <replaceable>input_video.avi</replaceable> -of lavf -lavfopts format=asf</screen> | 1644 <systemitem class="library">libavformat</systemitem>, which is a |
1600 This will do the same thing as the previous example, except that | 1645 library from the FFmpeg project that supports muxing and demuxing |
1601 the output container will be ASF. | 1646 a variety of containers. |
1602 Please note that this support is highly experimental (but getting | 1647 For example: |
1603 better every day), and will only work if you compiled | 1648 <screen> |
1604 <application>MPlayer</application> with the support for | 1649 mencoder -oac copy -ovc copy -o <replaceable>output_movie.asf</replaceable> -audiofile <replaceable>input_audio.mp2</replaceable> \ |
1605 <systemitem class="library">libavformat</systemitem> enabled (which | 1650 <replaceable>input_video.avi</replaceable> -of lavf -lavfopts format=asf |
1606 means that a pre-packaged binary version will not work in most cases). | 1651 </screen> |
1652 This will do the same thing as the previous example, except that | |
1653 the output container will be ASF. | |
1654 Please note that this support is highly experimental (but getting | |
1655 better every day), and will only work if you compiled | |
1656 <application>MPlayer</application> with the support for | |
1657 <systemitem class="library">libavformat</systemitem> enabled (which | |
1658 means that a pre-packaged binary version will not work in most cases). | |
1607 </para> | 1659 </para> |
1608 | 1660 |
1609 | 1661 |
1610 <sect3 id="menc-feat-dvd-mpeg4-muxing-filter-issues"> | 1662 <sect3 id="menc-feat-dvd-mpeg4-muxing-filter-issues"> |
1611 <title>Improving muxing and A/V sync reliability</title> | 1663 <title>Improving muxing and A/V sync reliability</title> |
1612 <para> | 1664 |
1613 You may experience some serious A/V sync problems while trying to mux | 1665 <para> |
1614 your video and some audio tracks, where no matter how you adjust the | 1666 You may experience some serious A/V sync problems while trying to mux |
1615 audio delay, you will never get proper sync. | 1667 your video and some audio tracks, where no matter how you adjust the |
1616 That may happen when you use some video filters that will drop or | 1668 audio delay, you will never get proper sync. |
1617 duplicate some frames, like the inverse telecine filters. | 1669 That may happen when you use some video filters that will drop or |
1618 It is strongly encouraged to append the <option>harddup</option> video | 1670 duplicate some frames, like the inverse telecine filters. |
1619 filter at the end of the filter chain to avoid this kind of problem. | 1671 It is strongly encouraged to append the <option>harddup</option> video |
1620 </para> | 1672 filter at the end of the filter chain to avoid this kind of problem. |
1621 | 1673 </para> |
1622 <para> | 1674 |
1623 Without <option>harddup</option>, if <application>MEncoder</application> | 1675 <para> |
1624 wants to duplicate a frame, it relies on the muxer to put a mark on the | 1676 Without <option>harddup</option>, if <application>MEncoder</application> |
1625 container so that the last frame will be displayed again to maintain | 1677 wants to duplicate a frame, it relies on the muxer to put a mark on the |
1626 sync while writing no actual frame. | 1678 container so that the last frame will be displayed again to maintain |
1627 With <option>harddup</option>, <application>MEncoder</application> | 1679 sync while writing no actual frame. |
1628 will instead just push the last frame displayed again into the filter | 1680 With <option>harddup</option>, <application>MEncoder</application> |
1629 chain. | 1681 will instead just push the last frame displayed again into the filter |
1630 This means that the encoder receives the <emphasis>exact</emphasis> | 1682 chain. |
1631 same frame twice, and compresses it. | 1683 This means that the encoder receives the <emphasis>exact</emphasis> |
1632 This will result in a slightly bigger file, but will not cause problems | 1684 same frame twice, and compresses it. |
1633 when demuxing or remuxing into other container formats. | 1685 This will result in a slightly bigger file, but will not cause problems |
1634 </para> | 1686 when demuxing or remuxing into other container formats. |
1635 | 1687 </para> |
1636 <para> | 1688 |
1637 You may also have no choice but to use <option>harddup</option> with | 1689 <para> |
1638 container formats that are not too tightly linked with | 1690 You may also have no choice but to use <option>harddup</option> with |
1639 <application>MEncoder</application> such as the ones supported through | 1691 container formats that are not too tightly linked with |
1640 <systemitem class="library">libavformat</systemitem>, which may not | 1692 <application>MEncoder</application> such as the ones supported through |
1641 support frame duplication at the container level. | 1693 <systemitem class="library">libavformat</systemitem>, which may not |
1694 support frame duplication at the container level. | |
1642 </para> | 1695 </para> |
1643 </sect3> | 1696 </sect3> |
1644 | 1697 |
1645 | 1698 |
1646 <sect3 id="menc-feat-dvd-mpeg4-muxing-avi-limitations"> | 1699 <sect3 id="menc-feat-dvd-mpeg4-muxing-avi-limitations"> |
1647 <title>Limitations of the AVI container</title> | 1700 <title>Limitations of the AVI container</title> |
1648 <para> | 1701 |
1649 Although it is the most widely-supported container format after MPEG-1, | 1702 <para> |
1650 AVI also has some major drawbacks. | 1703 Although it is the most widely-supported container format after MPEG-1, |
1651 Perhaps the most obvious is the overhead. | 1704 AVI also has some major drawbacks. |
1652 For each chunk of the AVI file, 24 bytes are wasted on headers and | 1705 Perhaps the most obvious is the overhead. |
1653 index. | 1706 For each chunk of the AVI file, 24 bytes are wasted on headers and index. |
1654 This translates into a little over 5 MB per hour, or 1-2.5% | 1707 This translates into a little over 5 MB per hour, or 1-2.5% |
1655 overhead for a 700 MB movie. This may not seem like much, but it could | 1708 overhead for a 700 MB movie. This may not seem like much, but it could |
1656 mean the difference between being able to use 700 kbit/sec video or | 1709 mean the difference between being able to use 700 kbit/sec video or |
1657 714 kbit/sec, and every bit of quality counts. | 1710 714 kbit/sec, and every bit of quality counts. |
1658 </para> | 1711 </para> |
1659 | 1712 |
1660 <para> | 1713 <para> |
1661 In addition this gross inefficiency, AVI also has the following major | 1714 In addition this gross inefficiency, AVI also has the following major |
1662 limitations: | 1715 limitations: |
1663 </para> | 1716 </para> |
1664 | 1717 |
1665 <orderedlist> | 1718 <orderedlist> |
1666 <listitem> | 1719 <listitem><para> |
1667 <para> | |
1668 Only fixed-fps content can be stored. This is particularly limiting | 1720 Only fixed-fps content can be stored. This is particularly limiting |
1669 if the original material you want to encode is mixed content, for | 1721 if the original material you want to encode is mixed content, for |
1670 example a mix of NTSC video and film material. | 1722 example a mix of NTSC video and film material. |
1671 Actually there are hacks that can be used to store mixed-framerate | 1723 Actually there are hacks that can be used to store mixed-framerate |
1672 content in AVI, but they increase the (already huge) overhead | 1724 content in AVI, but they increase the (already huge) overhead |
1673 fivefold or more and so are not practical. | 1725 fivefold or more and so are not practical. |
1674 </para> | 1726 </para></listitem> |
1675 </listitem> | 1727 <listitem><para> |
1676 <listitem> | |
1677 <para> | |
1678 Audio in AVI files must be either constant-bitrate (CBR) or | 1728 Audio in AVI files must be either constant-bitrate (CBR) or |
1679 constant-framesize (i.e. all frames decode to the same number of | 1729 constant-framesize (i.e. all frames decode to the same number of |
1680 samples). | 1730 samples). |
1681 Unfortunately, the most efficient codec, Vorbis, does not meet | 1731 Unfortunately, the most efficient codec, Vorbis, does not meet |
1682 either of these requirements. | 1732 either of these requirements. |
1683 Therefore, if you plan to store your movie in AVI, you will have to | 1733 Therefore, if you plan to store your movie in AVI, you will have to |
1684 use a less efficient codec such as MP3 or AC3. | 1734 use a less efficient codec such as MP3 or AC3. |
1685 </para> | 1735 </para></listitem> |
1686 </listitem> | |
1687 </orderedlist> | 1736 </orderedlist> |
1688 | 1737 |
1689 <para> | 1738 <para> |
1690 Having said all that, <application>MEncoder</application> does not | 1739 Having said all that, <application>MEncoder</application> does not |
1691 currently support variable-fps output or Vorbis encoding. | 1740 currently support variable-fps output or Vorbis encoding. |
1692 Therefore, you may not see these as limitations if | 1741 Therefore, you may not see these as limitations if |
1693 <application>MEncoder</application> is the | 1742 <application>MEncoder</application> is the |
1694 only tool you will be using to produce your encodes. | 1743 only tool you will be using to produce your encodes. |
1695 However, it is possible to use <application>MEncoder</application> | 1744 However, it is possible to use <application>MEncoder</application> |
1696 only for video encoding, and then use external tools to encode | 1745 only for video encoding, and then use external tools to encode |
1697 audio and mux it into another container format. | 1746 audio and mux it into another container format. |
1698 </para> | 1747 </para> |
1699 </sect3> | 1748 </sect3> |
1749 | |
1700 | 1750 |
1701 <sect3 id="menc-feat-dvd-mpeg4-muxing-matroska"> | 1751 <sect3 id="menc-feat-dvd-mpeg4-muxing-matroska"> |
1702 <title>Muxing into the Matroska container</title> | 1752 <title>Muxing into the Matroska container</title> |
1703 <para> | 1753 |
1704 Matroska is a free, open standard container format, aiming | 1754 <para> |
1705 to offer a lot of advanced features, which older containers | 1755 Matroska is a free, open standard container format, aiming |
1706 like AVI cannot handle. | 1756 to offer a lot of advanced features, which older containers |
1707 For example, Matroska supports variable bitrate audio content | 1757 like AVI cannot handle. |
1708 (VBR), variable framerates (VFR), chapters, file attachments, | 1758 For example, Matroska supports variable bitrate audio content |
1709 error detection code (EDC) and modern A/V Codecs like "Advanced Audio | 1759 (VBR), variable framerates (VFR), chapters, file attachments, |
1710 Coding" (AAC), "Vorbis" or "MPEG-4 AVC" (H.264), next to nothing | 1760 error detection code (EDC) and modern A/V Codecs like "Advanced Audio |
1711 handled by AVI. | 1761 Coding" (AAC), "Vorbis" or "MPEG-4 AVC" (H.264), next to nothing |
1712 </para> | 1762 handled by AVI. |
1713 | 1763 </para> |
1714 <para> | 1764 |
1715 The tools required to create Matroska files are collectively called | 1765 <para> |
1716 <application>mkvtoolnix</application>, and are available for most | 1766 The tools required to create Matroska files are collectively called |
1717 Unix platforms as well as <application>Windows</application>. | 1767 <application>mkvtoolnix</application>, and are available for most |
1718 Because Matroska is an open standard you may find other | 1768 Unix platforms as well as <application>Windows</application>. |
1719 tools that suit you better, but since mkvtoolnix is the most | 1769 Because Matroska is an open standard you may find other |
1720 common, and is supported by the Matroska team itself, we will | 1770 tools that suit you better, but since mkvtoolnix is the most |
1721 only cover its usage. | 1771 common, and is supported by the Matroska team itself, we will |
1722 </para> | 1772 only cover its usage. |
1723 | 1773 </para> |
1724 <para> | 1774 |
1725 Probably the easiest way to get started with Matroska is to use | 1775 <para> |
1726 <application>MMG</application>, the graphical frontend shipped with | 1776 Probably the easiest way to get started with Matroska is to use |
1727 <application>mkvtoolnix</application>, and follow the | 1777 <application>MMG</application>, the graphical frontend shipped with |
1728 <ulink url="http://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge-gui.html">guide to mkvmerge GUI (mmg)</ulink> | 1778 <application>mkvtoolnix</application>, and follow the |
1729 </para> | 1779 <ulink url="http://www.bunkus.org/videotools/mkvtoolnix/doc/mkvmerge-gui.html">guide to mkvmerge GUI (mmg)</ulink> |
1730 | 1780 </para> |
1731 <para> | 1781 |
1732 You may also mux audio and video files using the command line: | 1782 <para> |
1733 <screen>mkvmerge -o <replaceable>output.mkv</replaceable> <replaceable>input_video.avi</replaceable> <replaceable>input_audio1.mp3</replaceable> <replaceable>input_audio2.ac3</replaceable></screen> | 1783 You may also mux audio and video files using the command line: |
1734 This would merge the video file <replaceable>input_video.avi</replaceable> | 1784 <screen> |
1735 and the two audio files <replaceable>input_audio1.mp3</replaceable> | 1785 mkvmerge -o <replaceable>output.mkv</replaceable> <replaceable>input_video.avi</replaceable> <replaceable>input_audio1.mp3</replaceable> <replaceable>input_audio2.ac3</replaceable> |
1736 and <replaceable>input_audio2.ac3</replaceable> into the Matroska | 1786 </screen> |
1737 file <replaceable>output.mkv</replaceable>. | 1787 This would merge the video file <replaceable>input_video.avi</replaceable> |
1738 Matroska, as mentioned earlier, is able to do much more than that, like | 1788 and the two audio files <replaceable>input_audio1.mp3</replaceable> |
1739 multiple audio tracks (including fine-tuning of audio/video | 1789 and <replaceable>input_audio2.ac3</replaceable> into the Matroska |
1740 synchronization), chapters, subtitles, splitting, etc... | 1790 file <replaceable>output.mkv</replaceable>. |
1741 Please refer to the documentation of those applications for | 1791 Matroska, as mentioned earlier, is able to do much more than that, like |
1742 more details. | 1792 multiple audio tracks (including fine-tuning of audio/video |
1743 </para> | 1793 synchronization), chapters, subtitles, splitting, etc... |
1744 | 1794 Please refer to the documentation of those applications for |
1795 more details. | |
1796 </para> | |
1745 </sect3> | 1797 </sect3> |
1746 | |
1747 </sect2> | 1798 </sect2> |
1748 | |
1749 </sect1> | 1799 </sect1> |
1800 | |
1801 | |
1802 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
1803 | |
1750 | 1804 |
1751 <sect1 id="menc-feat-telecine"> | 1805 <sect1 id="menc-feat-telecine"> |
1752 <title>How to deal with telecine and interlacing within NTSC DVDs</title> | 1806 <title>How to deal with telecine and interlacing within NTSC DVDs</title> |
1753 | 1807 |
1754 <sect2 id="menc-feat-telecine-intro"> | 1808 <sect2 id="menc-feat-telecine-intro"> |
1755 <title>Introduction</title> | 1809 <title>Introduction</title> |
1810 | |
1756 <formalpara> | 1811 <formalpara> |
1757 <title>What is telecine?</title> | 1812 <title>What is telecine?</title> |
1758 <para> | 1813 <para> |
1759 If you do not understand much of what is written in this document, | 1814 If you do not understand much of what is written in this document, read the |
1760 read the | 1815 <ulink url="http://en.wikipedia.org/wiki/Telecine">Wikipedia entry on telecine</ulink>. |
1761 <ulink url="http://en.wikipedia.org/wiki/Telecine">Wikipedia entry on telecine</ulink>. | 1816 It is an understandable and reasonably comprehensive |
1762 It is an understandable and reasonably comprehensive | 1817 description of what telecine is. |
1763 description of what telecine is. | |
1764 </para></formalpara> | 1818 </para></formalpara> |
1765 | 1819 |
1766 <formalpara> | 1820 <formalpara> |
1767 <title>A note about the numbers.</title> | 1821 <title>A note about the numbers.</title> |
1768 <para> | 1822 <para> |
1769 Many documents, including the guide linked above, refer to the fields | 1823 Many documents, including the guide linked above, refer to the fields |
1770 per second value of NTSC video as 59.94 and the corresponding frames | 1824 per second value of NTSC video as 59.94 and the corresponding frames |
1771 per second values as 29.97 (for telecined and interlaced) and 23.976 | 1825 per second values as 29.97 (for telecined and interlaced) and 23.976 |
1772 (for progressive). For simplicity, some documents even round these | 1826 (for progressive). For simplicity, some documents even round these |
1773 numbers to 60, 30, and 24. | 1827 numbers to 60, 30, and 24. |
1774 </para></formalpara> | 1828 </para></formalpara> |
1775 | 1829 |
1776 <para> | 1830 <para> |
1777 Strictly speaking, all those numbers are approximations. Black and | 1831 Strictly speaking, all those numbers are approximations. Black and |
1778 white NTSC video was exactly 60 fields per second, but 60000/1001 | 1832 white NTSC video was exactly 60 fields per second, but 60000/1001 |
1779 was later chosen to accomodate color data while remaining compatible | 1833 was later chosen to accomodate color data while remaining compatible |
1780 with contemporary black and white televisions. Digital NTSC video | 1834 with contemporary black and white televisions. Digital NTSC video |
1781 (such as on a DVD) is also 60000/1001 fields per second. From this, | 1835 (such as on a DVD) is also 60000/1001 fields per second. From this, |
1782 interlaced and telecined video are derived to be 30000/1001 frames | 1836 interlaced and telecined video are derived to be 30000/1001 frames |
1783 per second; progressive video is 24000/1001 frames per second. | 1837 per second; progressive video is 24000/1001 frames per second. |
1784 </para> | 1838 </para> |
1785 | 1839 |
1786 <para> | 1840 <para> |
1787 Older versions of the <application>MEncoder</application> documentation | 1841 Older versions of the <application>MEncoder</application> documentation |
1788 and many archived mailing list posts refer to 59.94, 29.97, and 23.976. | 1842 and many archived mailing list posts refer to 59.94, 29.97, and 23.976. |
1789 All <application>MEncoder</application> documentation has been updated | 1843 All <application>MEncoder</application> documentation has been updated |
1790 to use the fractional values, and you should use them too. | 1844 to use the fractional values, and you should use them too. |
1791 </para> | 1845 </para> |
1792 | 1846 |
1793 <para> | 1847 <para> |
1794 <option>-ofps 23.976</option> is incorrect. | 1848 <option>-ofps 23.976</option> is incorrect. |
1795 <option>-ofps 24000/1001</option> should be used instead. | 1849 <option>-ofps 24000/1001</option> should be used instead. |
1796 </para> | 1850 </para> |
1797 | 1851 |
1798 <formalpara> | 1852 <formalpara> |
1799 <title>How telecine is used.</title> | 1853 <title>How telecine is used.</title> |
1800 <para> | 1854 <para> |
1801 All video intended to be displayed on an NTSC | 1855 All video intended to be displayed on an NTSC |
1802 television set must be 60000/1001 fields per second. Made-for-TV movies | 1856 television set must be 60000/1001 fields per second. Made-for-TV movies |
1803 4 and shows are often filmed directly at 60000/1001 fields per second, but | 1857 and shows are often filmed directly at 60000/1001 fields per second, but |
1804 the majority of cinema is filmed at 24 or 24000/1001 frames per | 1858 the majority of cinema is filmed at 24 or 24000/1001 frames per |
1805 second. When cinematic movie DVDs are mastered, the video is then | 1859 second. When cinematic movie DVDs are mastered, the video is then |
1806 converted for television using a process called telecine. | 1860 converted for television using a process called telecine. |
1807 </para></formalpara> | 1861 </para></formalpara> |
1808 | 1862 |
1809 <para> | 1863 <para> |
1810 On a DVD, the video is never actually stored as 60000/1001 fields per | 1864 On a DVD, the video is never actually stored as 60000/1001 fields per |
1811 second. For video that was originally 60000/1001, each pair of fields is | 1865 second. For video that was originally 60000/1001, each pair of fields is |
1812 combined to form a frame, resulting in 30000/1001 frames per | 1866 combined to form a frame, resulting in 30000/1001 frames per |
1813 second. Hardware DVD players then read a flag embedded in the video | 1867 second. Hardware DVD players then read a flag embedded in the video |
1814 stream to determine whether the odd- or even-numbered lines should | 1868 stream to determine whether the odd- or even-numbered lines should |
1815 form the first field. | 1869 form the first field. |
1816 </para> | 1870 </para> |
1817 | 1871 |
1818 <para> | 1872 <para> |
1819 Usually, 24000/1001 frames per second content stays as it is when | 1873 Usually, 24000/1001 frames per second content stays as it is when |
1820 encoded for a DVD, and the DVD player must perform telecining | 1874 encoded for a DVD, and the DVD player must perform telecining |
1821 on-the-fly. Sometimes, however, the video is telecined | 1875 on-the-fly. Sometimes, however, the video is telecined |
1822 <emphasis>before</emphasis> being stored on the DVD; even though it | 1876 <emphasis>before</emphasis> being stored on the DVD; even though it |
1823 was originally 24000/1001 frames per second, it becomes 60000/1001 fields per | 1877 was originally 24000/1001 frames per second, it becomes 60000/1001 fields per |
1824 second. When it is stored on the DVD, pairs of fields are combined to form | 1878 second. When it is stored on the DVD, pairs of fields are combined to form |
1825 30000/1001 frames per second. | 1879 30000/1001 frames per second. |
1826 </para> | 1880 </para> |
1827 | 1881 |
1828 <para> | 1882 <para> |
1829 When looking at individual frames formed from 60000/1001 fields per | 1883 When looking at individual frames formed from 60000/1001 fields per |
1830 second video, telecined or otherwise, interlacing is clearly visible | 1884 second video, telecined or otherwise, interlacing is clearly visible |
1831 wherever there is any motion, because one field (say, the | 1885 wherever there is any motion, because one field (say, the |
1832 even-numbered lines) represents a moment in time 1/(60000/1001) | 1886 even-numbered lines) represents a moment in time 1/(60000/1001) |
1833 seconds later than the other. Playing interlaced video on a computer | 1887 seconds later than the other. Playing interlaced video on a computer |
1834 looks ugly both because the monitor is higher resolution and because | 1888 looks ugly both because the monitor is higher resolution and because |
1835 the video is shown frame-after-frame instead of field-after-field. | 1889 the video is shown frame-after-frame instead of field-after-field. |
1836 </para> | 1890 </para> |
1837 | 1891 |
1838 <itemizedlist> | 1892 <itemizedlist> |
1839 <title>Notes:</title> | 1893 <title>Notes:</title> |
1840 <listitem><para> | 1894 <listitem><para> |
1841 This section only applies to NTSC DVDs, and not PAL. | 1895 This section only applies to NTSC DVDs, and not PAL. |
1842 </para></listitem> | 1896 </para></listitem> |
1843 <listitem><para> | 1897 <listitem><para> |
1844 The example <application>MEncoder</application> lines throughout the | 1898 The example <application>MEncoder</application> lines throughout the |
1845 document are <emphasis role="bold">not</emphasis> intended for | 1899 document are <emphasis role="bold">not</emphasis> intended for |
1846 actual use. They are simply the bare minimum required to encode the | 1900 actual use. They are simply the bare minimum required to encode the |
1847 pertaining video category. How to make good DVD rips or fine-tune | 1901 pertaining video category. How to make good DVD rips or fine-tune |
1848 <systemitem class="library">libavcodec</systemitem> for maximal | 1902 <systemitem class="library">libavcodec</systemitem> for maximal |
1849 quality is not within the scope of this document. | 1903 quality is not within the scope of this document. |
1850 </para></listitem> | 1904 </para></listitem> |
1851 <listitem><para> | 1905 <listitem><para> |
1852 There are a couple footnotes specific to this guide, linked like this: | 1906 There are a couple footnotes specific to this guide, linked like this: |
1853 <link linkend="menc-feat-telecine-footnotes">[1]</link> | 1907 <link linkend="menc-feat-telecine-footnotes">[1]</link> |
1854 </para></listitem> | 1908 </para></listitem> |
1855 </itemizedlist> | 1909 </itemizedlist> |
1856 </sect2> | 1910 </sect2> |
1857 | 1911 |
1912 <!-- ********** --> | |
1913 | |
1858 <sect2 id="menc-feat-telecine-ident"> | 1914 <sect2 id="menc-feat-telecine-ident"> |
1859 <title>How to tell what type of video you have</title> | 1915 <title>How to tell what type of video you have</title> |
1860 | 1916 |
1861 <sect3 id="menc-feat-telecine-ident-progressive"> | 1917 <sect3 id="menc-feat-telecine-ident-progressive"> |
1862 <title>Progressive</title> | 1918 <title>Progressive</title> |
1863 <para> | 1919 |
1864 Progressive video was originally filmed at 24000/1001 fps, and stored | 1920 <para> |
1865 on the DVD without alteration. | 1921 Progressive video was originally filmed at 24000/1001 fps, and stored |
1866 </para> | 1922 on the DVD without alteration. |
1867 | 1923 </para> |
1868 <para> | 1924 |
1869 When you play a progressive DVD in <application>MPlayer</application>, | 1925 <para> |
1870 <application>MPlayer</application> will print the following line as | 1926 When you play a progressive DVD in <application>MPlayer</application>, |
1871 soon as the movie begins to play: | 1927 <application>MPlayer</application> will print the following line as |
1872 | 1928 soon as the movie begins to play: |
1873 <screen> demux_mpg: 24000/1001 fps progressive NTSC content detected, switching framerate.</screen> | 1929 <screen> |
1874 | 1930 demux_mpg: 24000/1001 fps progressive NTSC content detected, switching framerate. |
1875 From this point forward, demux_mpg should never say it finds | 1931 </screen> |
1876 "30000/1001 fps NTSC content." | 1932 From this point forward, demux_mpg should never say it finds |
1877 </para> | 1933 "30000/1001 fps NTSC content." |
1878 | 1934 </para> |
1879 <para> | 1935 |
1880 When you watch progressive video, you should never see any | 1936 <para> |
1881 interlacing. Beware, however, because sometimes there is a tiny bit | 1937 When you watch progressive video, you should never see any |
1882 of telecine mixed in where you would not expect. I have encountered TV | 1938 interlacing. Beware, however, because sometimes there is a tiny bit |
1883 show DVDs that have one second of telecine at every scene change, or | 1939 of telecine mixed in where you would not expect. I have encountered TV |
1884 at seemingly random places. I once watched a DVD that had a | 1940 show DVDs that have one second of telecine at every scene change, or |
1885 progressive first half, and the second half was telecined. If you | 1941 at seemingly random places. I once watched a DVD that had a |
1886 want to be <emphasis>really</emphasis> thorough, you can scan the | 1942 progressive first half, and the second half was telecined. If you |
1887 entire movie: | 1943 want to be <emphasis>really</emphasis> thorough, you can scan the |
1888 | 1944 entire movie: |
1889 <screen>mplayer dvd://1 -nosound -vo null -benchmark</screen> | 1945 <screen>mplayer dvd://1 -nosound -vo null -benchmark</screen> |
1890 | 1946 Using <option>-benchmark</option> makes |
1891 Using <option>-benchmark</option> makes | 1947 <application>MPlayer</application> play the movie as quickly as it |
1892 <application>MPlayer</application> play the movie as quickly as it | 1948 possibly can; still, depending on your hardware, it can take a |
1893 possibly can; still, depending on your hardware, it can take a | 1949 while. Every time demux_mpg reports a framerate change, the line |
1894 while. Every time demux_mpg reports a framerate change, the line | 1950 immediately above will show you the time at which the change |
1895 immediately above will show you the time at which the change | 1951 occurred. |
1896 occurred. | 1952 </para> |
1897 </para> | 1953 |
1898 | 1954 <para> |
1899 <para> | 1955 Sometimes progressive video on DVDs is referred to as |
1900 Sometimes progressive video on DVDs is referred to as | 1956 "soft-telecine" because it is intended to |
1901 "soft-telecine" because it is intended to | 1957 be telecined by the DVD player. |
1902 be telecined by the DVD player. | |
1903 </para> | 1958 </para> |
1904 </sect3> | 1959 </sect3> |
1960 | |
1905 | 1961 |
1906 <sect3 id="menc-feat-telecine-ident-telecined"> | 1962 <sect3 id="menc-feat-telecine-ident-telecined"> |
1907 <title>Telecined</title> | 1963 <title>Telecined</title> |
1908 <para> | 1964 |
1909 Telecined video was originally filmed at 24000/1001, but was telecined | 1965 <para> |
1910 <emphasis>before</emphasis> it was written to the DVD. | 1966 Telecined video was originally filmed at 24000/1001, but was telecined |
1911 </para> | 1967 <emphasis>before</emphasis> it was written to the DVD. |
1912 | 1968 </para> |
1913 <para> | 1969 |
1914 <application>MPlayer</application> does not (ever) report any | 1970 <para> |
1915 framerate changes when it plays telecined video. | 1971 <application>MPlayer</application> does not (ever) report any |
1916 </para> | 1972 framerate changes when it plays telecined video. |
1917 | 1973 </para> |
1918 <para> | 1974 |
1919 Watching a telecined video, you will see interlacing artifacts that | 1975 <para> |
1920 seem to "blink": they repeatedly appear and disappear. | 1976 Watching a telecined video, you will see interlacing artifacts that |
1921 You can look closely at this by | 1977 seem to "blink": they repeatedly appear and disappear. |
1922 <orderedlist> | 1978 You can look closely at this by |
1923 <listitem> | 1979 <orderedlist> |
1924 <screen>mplayer dvd://1</screen> | 1980 <listitem><screen>mplayer dvd://1</screen></listitem> |
1925 </listitem> | 1981 <listitem><para> |
1926 <listitem><para> | 1982 Seek to a part with motion. |
1927 Seek to a part with motion. | 1983 </para></listitem> |
1928 </para></listitem> | 1984 <listitem><para> |
1929 <listitem><para> | 1985 Use the <keycap>.</keycap> key to step forward one frame at a time. |
1930 Use the <keycap>.</keycap> key to step forward one frame at a time. | 1986 </para></listitem> |
1931 </para></listitem> | 1987 <listitem><para> |
1932 <listitem><para> | 1988 Look at the pattern of interlaced-looking and progressive-looking |
1933 Look at the pattern of interlaced-looking and progressive-looking | 1989 frames. If the pattern you see is PPPII,PPPII,PPPII,... then the |
1934 frames. If the pattern you see is PPPII,PPPII,PPPII,... then the | 1990 video is telecined. If you see some other pattern, then the video |
1935 video is telecined. If you see some other pattern, then the video | 1991 may have been telecined using some non-standard method; |
1936 may have been telecined using some non-standard method; | 1992 <application>MEncoder</application> cannot losslessly convert |
1937 <application>MEncoder</application> cannot losslessly convert | 1993 non-standard telecine to progressive. If you do not see any |
1938 non-standard telecine to progressive. If you do not see any | 1994 pattern at all, then it is most likely interlaced. |
1939 pattern at all, then it is most likely interlaced. | 1995 </para></listitem> |
1940 </para></listitem> | 1996 </orderedlist> |
1941 </orderedlist> | 1997 </para> |
1942 </para> | 1998 |
1943 | 1999 <para> |
1944 <para> | 2000 Sometimes telecined video on DVDs is referred to as |
1945 Sometimes telecined video on DVDs is referred to as | 2001 "hard-telecine". Since hard-telecine is already 60000/1001 fields |
1946 "hard-telecine". Since hard-telecine is already 60000/1001 fields | 2002 per second, the DVD player plays the video without any manipulation. |
1947 per second, the DVD player plays the video without any manipulation. | 2003 </para> |
1948 </para> | 2004 |
1949 | 2005 <para> |
1950 <para> | 2006 Another way to tell if your source is telecined or not is to play |
1951 Another way to tell if your source is telecined or not is to play | 2007 the source with the <option>-vf pullup</option> and <option>-v</option> |
1952 the source with the <option>-vf pullup</option> and <option>-v</option> | 2008 command line options to see how <option>pullup</option> matches frames. |
1953 command line options to see how <option>pullup</option> matches frames. | 2009 If the source is telecined, you should see on the console a 3:2 pattern |
1954 If the source is telecined, you should see on the console a 3:2 pattern | 2010 with <systemitem>0+.1.+2</systemitem> and <systemitem>0++1</systemitem> |
1955 with <systemitem>0+.1.+2</systemitem> and <systemitem>0++1</systemitem> | 2011 alternating. |
1956 alternating. | 2012 This technique has the advantage that you do not need to watch the |
1957 This technique has the advantage that you do not need to watch the | 2013 source to identify it, which could be useful if you wish to automate |
1958 source to identify it, which could be useful if you wish to automate | 2014 the encoding procedure, or to carry out said procedure remotely via |
1959 the encoding procedure, or to carry out said procedure remotely via | 2015 a slow connection. |
1960 a slow connection. | 2016 </para> |
1961 </para> | |
1962 | |
1963 </sect3> | 2017 </sect3> |
2018 | |
1964 | 2019 |
1965 <sect3 id="menc-feat-telecine-ident-interlaced"> | 2020 <sect3 id="menc-feat-telecine-ident-interlaced"> |
1966 <title>Interlaced</title> | 2021 <title>Interlaced</title> |
1967 <para> | 2022 |
1968 Interlaced video was originally filmed at 60000/1001 fields per second, | 2023 <para> |
1969 and stored on the DVD as 30000/1001 frames per second. The interlacing effect | 2024 Interlaced video was originally filmed at 60000/1001 fields per second, |
1970 (often called "combing") is a result of combining pairs of | 2025 and stored on the DVD as 30000/1001 frames per second. The interlacing effect |
1971 fields into frames. Each field is supposed to be 1/(60000/1001) seconds apart, | 2026 (often called "combing") is a result of combining pairs of |
1972 and when they are displayed simultaneously the difference is apparent. | 2027 fields into frames. Each field is supposed to be 1/(60000/1001) seconds apart, |
1973 </para> | 2028 and when they are displayed simultaneously the difference is apparent. |
1974 | 2029 </para> |
1975 <para> | 2030 |
1976 As with telecined video, <application>MPlayer</application> should | 2031 <para> |
1977 not ever report any framerate changes when playing interlaced content. | 2032 As with telecined video, <application>MPlayer</application> should |
1978 </para> | 2033 not ever report any framerate changes when playing interlaced content. |
1979 | 2034 </para> |
1980 <para> | 2035 |
1981 When you view an interlaced video closely by frame-stepping with the | 2036 <para> |
1982 <keycap>.</keycap> key, you will see that every single frame is interlaced. | 2037 When you view an interlaced video closely by frame-stepping with the |
2038 <keycap>.</keycap> key, you will see that every single frame is interlaced. | |
1983 </para> | 2039 </para> |
1984 </sect3> | 2040 </sect3> |
2041 | |
1985 | 2042 |
1986 <sect3 id="menc-feat-telecine-ident-mixedpt"> | 2043 <sect3 id="menc-feat-telecine-ident-mixedpt"> |
1987 <title>Mixed progressive and telecine</title> | 2044 <title>Mixed progressive and telecine</title> |
1988 <para> | 2045 |
1989 All of a "mixed progressive and telecine" video was originally | 2046 <para> |
1990 24000/1001 frames per second, but some parts of it ended up being telecined. | 2047 All of a "mixed progressive and telecine" video was originally |
1991 </para> | 2048 24000/1001 frames per second, but some parts of it ended up being telecined. |
1992 | 2049 </para> |
1993 <para> | 2050 |
1994 When <application>MPlayer</application> plays this category, it will | 2051 <para> |
1995 (often repeatedly) switch back and forth between "30000/1001 fps NTSC" | 2052 When <application>MPlayer</application> plays this category, it will |
1996 and "24000/1001 fps progressive NTSC". Watch the bottom of | 2053 (often repeatedly) switch back and forth between "30000/1001 fps NTSC" |
1997 <application>MPlayer</application>'s output to see these messages. | 2054 and "24000/1001 fps progressive NTSC". Watch the bottom of |
1998 </para> | 2055 <application>MPlayer</application>'s output to see these messages. |
1999 | 2056 </para> |
2000 <para> | 2057 |
2001 You should check the "30000/1001 fps NTSC" sections to make sure | 2058 <para> |
2002 they are actually telecine, and not just interlaced. | 2059 You should check the "30000/1001 fps NTSC" sections to make sure |
2060 they are actually telecine, and not just interlaced. | |
2003 </para> | 2061 </para> |
2004 </sect3> | 2062 </sect3> |
2063 | |
2005 | 2064 |
2006 <sect3 id="menc-feat-telecine-ident-mixedpi"> | 2065 <sect3 id="menc-feat-telecine-ident-mixedpi"> |
2007 <title>Mixed progressive and interlaced</title> | 2066 <title>Mixed progressive and interlaced</title> |
2008 <para> | 2067 |
2009 In "mixed progressive and interlaced" content, progressive | 2068 <para> |
2010 and interlaced video have been spliced together. | 2069 In "mixed progressive and interlaced" content, progressive |
2011 </para> | 2070 and interlaced video have been spliced together. |
2012 | 2071 </para> |
2013 <para> | 2072 |
2014 This category looks just like "mixed progressive and telecine", | 2073 <para> |
2015 until you examine the 30000/1001 fps sections and see that they do not have the | 2074 This category looks just like "mixed progressive and telecine", |
2016 telecine pattern. | 2075 until you examine the 30000/1001 fps sections and see that they do not have the |
2076 telecine pattern. | |
2017 </para> | 2077 </para> |
2018 </sect3> | 2078 </sect3> |
2019 | |
2020 </sect2> | 2079 </sect2> |
2080 | |
2081 <!-- ********** --> | |
2021 | 2082 |
2022 <sect2 id="menc-feat-telecine-encode"> | 2083 <sect2 id="menc-feat-telecine-encode"> |
2023 <title>How to encode each category</title> | 2084 <title>How to encode each category</title> |
2024 <para> | 2085 <para> |
2025 As I mentioned in the beginning, example <application>MEncoder</application> | 2086 As I mentioned in the beginning, example <application>MEncoder</application> |
2026 lines below are <emphasis role="bold">not</emphasis> meant to actually be used; | 2087 lines below are <emphasis role="bold">not</emphasis> meant to actually be used; |
2027 they only demonstrate the minimum parameters to properly encode each category. | 2088 they only demonstrate the minimum parameters to properly encode each category. |
2028 </para> | 2089 </para> |
2090 | |
2029 | 2091 |
2030 <sect3 id="menc-feat-telecine-encode-progressive"> | 2092 <sect3 id="menc-feat-telecine-encode-progressive"> |
2031 <title>Progressive</title> | 2093 <title>Progressive</title> |
2032 <para> | 2094 <para> |
2033 Progressive video requires no special filtering to encode. The only | 2095 Progressive video requires no special filtering to encode. The only |
2034 parameter you need to be sure to use is | 2096 parameter you need to be sure to use is <option>-ofps 24000/1001</option>. |
2035 <option>-ofps 24000/1001</option>. Otherwise, <application>MEncoder</application> | 2097 Otherwise, <application>MEncoder</application> |
2036 will try to encode at 30000/1001 fps and will duplicate frames. | 2098 will try to encode at 30000/1001 fps and will duplicate frames. |
2037 </para> | 2099 </para> |
2038 | 2100 |
2039 <para> | 2101 <para> |
2040 <screen>mencoder dvd://1 -oac copy -ovc lavc -ofps 24000/1001</screen> | 2102 <screen>mencoder dvd://1 -oac copy -ovc lavc -ofps 24000/1001</screen> |
2041 </para> | 2103 </para> |
2042 | 2104 |
2043 <para> | 2105 <para> |
2044 It is often the case, however, that a video that looks progressive | 2106 It is often the case, however, that a video that looks progressive |
2045 actually has very short parts of telecine mixed in. Unless you are | 2107 actually has very short parts of telecine mixed in. Unless you are |
2046 sure, it is safest to treat the video as | 2108 sure, it is safest to treat the video as |
2047 <link linkend="menc-feat-telecine-encode-mixedpt">mixed progressive and telecine</link>. | 2109 <link linkend="menc-feat-telecine-encode-mixedpt">mixed progressive and telecine</link>. |
2048 The performance loss is small | 2110 The performance loss is small |
2049 <link linkend="menc-feat-telecine-footnotes">[3]</link>. | 2111 <link linkend="menc-feat-telecine-footnotes">[3]</link>. |
2050 </para> | 2112 </para> |
2051 </sect3> | 2113 </sect3> |
2114 | |
2052 | 2115 |
2053 <sect3 id="menc-feat-telecine-encode-telecined"> | 2116 <sect3 id="menc-feat-telecine-encode-telecined"> |
2054 <title>Telecined</title> | 2117 <title>Telecined</title> |
2055 <para> | 2118 |
2056 Telecine can be reversed to retrieve the original 24000/1001 content, | 2119 <para> |
2057 using a process called inverse-telecine. | 2120 Telecine can be reversed to retrieve the original 24000/1001 content, |
2058 <application>MPlayer</application> contains several filters to | 2121 using a process called inverse-telecine. |
2059 accomplish this; the best filter, <option>pullup</option>, is described | 2122 <application>MPlayer</application> contains several filters to |
2060 in the <link linkend="menc-feat-telecine-encode-mixedpt">mixed | 2123 accomplish this; the best filter, <option>pullup</option>, is described |
2061 progressive and telecine</link> section. | 2124 in the <link linkend="menc-feat-telecine-encode-mixedpt">mixed |
2125 progressive and telecine</link> section. | |
2062 </para> | 2126 </para> |
2063 </sect3> | 2127 </sect3> |
2128 | |
2064 | 2129 |
2065 <sect3 id="menc-feat-telecine-encode-interlaced"> | 2130 <sect3 id="menc-feat-telecine-encode-interlaced"> |
2066 <title>Interlaced</title> | 2131 <title>Interlaced</title> |
2067 <para> | 2132 |
2068 For most practical cases it is not possible to retrieve a complete | 2133 <para> |
2069 progressive video from interlaced content. The only way to do so | 2134 For most practical cases it is not possible to retrieve a complete |
2070 without losing half of the vertical resolution is to double the | 2135 progressive video from interlaced content. The only way to do so |
2071 framerate and try to "guess" what ought to make up the | 2136 without losing half of the vertical resolution is to double the |
2072 corresponding lines for each field (this has drawbacks - see method | 2137 framerate and try to "guess" what ought to make up the |
2073 3). | 2138 corresponding lines for each field (this has drawbacks - see method 3). |
2074 </para> | 2139 </para> |
2075 | 2140 |
2076 <orderedlist> | 2141 <orderedlist> |
2077 <listitem><para> | 2142 <listitem><para> |
2078 | |
2079 Encode the video in interlaced form. Normally, interlacing wreaks | 2143 Encode the video in interlaced form. Normally, interlacing wreaks |
2080 havoc with the encoder's ability to compress well, but | 2144 havoc with the encoder's ability to compress well, but |
2081 <systemitem class="library">libavcodec</systemitem> has two | 2145 <systemitem class="library">libavcodec</systemitem> has two |
2082 parameters specifically for dealing with storing interlaced video a | 2146 parameters specifically for dealing with storing interlaced video a |
2083 bit better: <option> ildct</option> and <option>ilme</option>. Also, | 2147 bit better: <option> ildct</option> and <option>ilme</option>. Also, |
2084 using <option>mbd=2</option> is strongly recommended | 2148 using <option>mbd=2</option> is strongly recommended |
2085 <link linkend="menc-feat-telecine-footnotes">[2] </link> because it | 2149 <link linkend="menc-feat-telecine-footnotes">[2] </link> because it |
2086 will encode macroblocks as non-interlaced in places where there is | 2150 will encode macroblocks as non-interlaced in places where there is |
2087 no motion. Note that <option>-ofps</option> is NOT needed here. | 2151 no motion. Note that <option>-ofps</option> is NOT needed here. |
2088 | |
2089 <screen>mencoder dvd://1 -oac copy -ovc lavc -lavcopts ildct:ilme:mbd=2</screen> | 2152 <screen>mencoder dvd://1 -oac copy -ovc lavc -lavcopts ildct:ilme:mbd=2</screen> |
2090 </para></listitem> | 2153 </para></listitem> |
2091 <listitem><para> | 2154 <listitem><para> |
2092 Use a deinterlacing filter before encoding. There are several of | 2155 Use a deinterlacing filter before encoding. There are several of |
2093 these filters available to choose from, each with its own advantages | 2156 these filters available to choose from, each with its own advantages |
2094 and disadvantages. Consult <option>mplayer -pphelp</option> and | 2157 and disadvantages. Consult <option>mplayer -pphelp</option> and |
2095 <option>mplayer -vf help</option> to see what is available | 2158 <option>mplayer -vf help</option> to see what is available |
2101 various filters. | 2164 various filters. |
2102 Again, the framerate is not changing, so no | 2165 Again, the framerate is not changing, so no |
2103 <option>-ofps</option>. Also, deinterlacing should be done after | 2166 <option>-ofps</option>. Also, deinterlacing should be done after |
2104 cropping <link linkend="menc-feat-telecine-footnotes">[1]</link> and | 2167 cropping <link linkend="menc-feat-telecine-footnotes">[1]</link> and |
2105 before scaling. | 2168 before scaling. |
2106 | |
2107 <screen>mencoder dvd://1 -oac copy -vf yadif -ovc lavc</screen> | 2169 <screen>mencoder dvd://1 -oac copy -vf yadif -ovc lavc</screen> |
2108 </para></listitem> | 2170 </para></listitem> |
2109 <listitem><para> | 2171 <listitem><para> |
2110 Unfortunately, this option is buggy with | 2172 Unfortunately, this option is buggy with |
2111 <application>MEncoder</application>; it ought to work well with | 2173 <application>MEncoder</application>; it ought to work well with |
2112 <application>MEncoder G2</application>, but that is not here yet. You | 2174 <application>MEncoder G2</application>, but that is not here yet. You |
2113 might experience crahes. Anyway, the purpose of <option> -vf | 2175 might experience crahes. Anyway, the purpose of <option> -vf |
2126 option looks best for your material. Note that when using | 2188 option looks best for your material. Note that when using |
2127 <option>tfields</option> you | 2189 <option>tfields</option> you |
2128 <emphasis role="bold">have to</emphasis> specify both | 2190 <emphasis role="bold">have to</emphasis> specify both |
2129 <option>-fps</option> and <option>-ofps</option> to be twice the | 2191 <option>-fps</option> and <option>-ofps</option> to be twice the |
2130 framerate of your original source. | 2192 framerate of your original source. |
2131 | 2193 <screen> |
2132 <screen>mencoder dvd://1 -oac copy -vf tfields=2 -ovc lavc -fps 60000/1001 -ofps 60000/1001</screen> | 2194 mencoder dvd://1 -oac copy -vf tfields=2 -ovc lavc \ |
2133 </para></listitem> | 2195 -fps 60000/1001 -ofps 60000/1001<!-- |
2196 --></screen> | |
2197 </para></listitem> | |
2134 <listitem><para> | 2198 <listitem><para> |
2135 If you plan on downscaling dramatically, you can extract and encode | 2199 If you plan on downscaling dramatically, you can extract and encode |
2136 only one of the two fields. Of course, you will lose half the vertical | 2200 only one of the two fields. Of course, you will lose half the vertical |
2137 resolution, but if you plan on downscaling to at most 1/2 of the | 2201 resolution, but if you plan on downscaling to at most 1/2 of the |
2138 original, the loss will not matter much. The result will be a | 2202 original, the loss will not matter much. The result will be a |
2140 <option>-vf field</option>, then crop | 2204 <option>-vf field</option>, then crop |
2141 <link linkend="menc-feat-telecine-footnotes">[1]</link> and scale | 2205 <link linkend="menc-feat-telecine-footnotes">[1]</link> and scale |
2142 appropriately. Remember that you will have to adjust the scale to | 2206 appropriately. Remember that you will have to adjust the scale to |
2143 compensate for the vertical resolution being halved. | 2207 compensate for the vertical resolution being halved. |
2144 <screen>mencoder dvd://1 -oac copy -vf field=0 -ovc lavc</screen> | 2208 <screen>mencoder dvd://1 -oac copy -vf field=0 -ovc lavc</screen> |
2145 </para></listitem> | 2209 </para></listitem> |
2146 </orderedlist> | 2210 </orderedlist> |
2147 </sect3> | 2211 </sect3> |
2148 | 2212 |
2213 | |
2149 <sect3 id="menc-feat-telecine-encode-mixedpt"> | 2214 <sect3 id="menc-feat-telecine-encode-mixedpt"> |
2150 <title>Mixed progressive and telecine</title> | 2215 <title>Mixed progressive and telecine</title> |
2151 <para> | 2216 |
2152 In order to turn mixed progressive and telecine video into entirely | 2217 <para> |
2153 progressive video, the telecined parts have to be | 2218 In order to turn mixed progressive and telecine video into entirely |
2154 inverse-telecined. There are three ways to accomplish this, | 2219 progressive video, the telecined parts have to be |
2155 described below. Note that you should | 2220 inverse-telecined. There are three ways to accomplish this, |
2156 <emphasis role="bold">always</emphasis> inverse-telecine before any | 2221 described below. Note that you should |
2157 rescaling; unless you really know what you are doing, | 2222 <emphasis role="bold">always</emphasis> inverse-telecine before any |
2158 inverse-telecine before cropping, too | 2223 rescaling; unless you really know what you are doing, |
2159 <link linkend="menc-feat-telecine-footnotes">[1]</link>. | 2224 inverse-telecine before cropping, too |
2160 <option>-ofps 24000/1001</option> is needed here because the output video | 2225 <link linkend="menc-feat-telecine-footnotes">[1]</link>. |
2161 will be 24000/1001 frames per second. | 2226 <option>-ofps 24000/1001</option> is needed here because the output video |
2227 will be 24000/1001 frames per second. | |
2162 </para> | 2228 </para> |
2163 | 2229 |
2164 <itemizedlist> | 2230 <itemizedlist> |
2165 <listitem><para> | 2231 <listitem><para> |
2166 <option>-vf pullup</option> is designed to inverse-telecine | 2232 <option>-vf pullup</option> is designed to inverse-telecine |
2169 be followed by the <option>softskip</option> filter or | 2235 be followed by the <option>softskip</option> filter or |
2170 else <application>MEncoder</application> will crash. | 2236 else <application>MEncoder</application> will crash. |
2171 <option>pullup</option> is, however, the cleanest and most | 2237 <option>pullup</option> is, however, the cleanest and most |
2172 accurate method available for encoding both telecine and | 2238 accurate method available for encoding both telecine and |
2173 "mixed progressive and telecine". | 2239 "mixed progressive and telecine". |
2174 | 2240 <screen> |
2175 <screen>mencoder dvd://1 -oac copy -vf pullup,softskip -ovc lavc -ofps 24000/1001</screen> | 2241 mencoder dvd://1 -oac copy -vf pullup,softskip |
2176 </para> | 2242 -ovc lavc -ofps 24000/1001<!-- |
2177 | 2243 --></screen> |
2178 | 2244 </para></listitem> |
2179 </listitem> | 2245 <listitem><para> |
2180 <listitem><para> | |
2181 An older method | 2246 An older method |
2182 is to, rather than inverse-telecine the telecined parts, telecine | 2247 is to, rather than inverse-telecine the telecined parts, telecine |
2183 the non-telecined parts and then inverse-telecine the whole | 2248 the non-telecined parts and then inverse-telecine the whole |
2184 video. Sound confusing? softpulldown is a filter that goes through | 2249 video. Sound confusing? softpulldown is a filter that goes through |
2185 a video and makes the entire file telecined. If we follow | 2250 a video and makes the entire file telecined. If we follow |
2186 softpulldown with either <option>detc</option> or | 2251 softpulldown with either <option>detc</option> or |
2187 <option>ivtc</option>, the final result will be entirely | 2252 <option>ivtc</option>, the final result will be entirely |
2188 progressive. <option>-ofps 24000/1001</option> is needed. | 2253 progressive. <option>-ofps 24000/1001</option> is needed. |
2189 | 2254 <screen> |
2190 <screen>mencoder dvd://1 -oac copy -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001</screen> | 2255 mencoder dvd://1 -oac copy -vf softpulldown,ivtc=1 -ovc lavc -ofps 24000/1001 |
2191 </para> | 2256 </screen> |
2192 </listitem> | 2257 </para></listitem> |
2193 | 2258 |
2194 <listitem><para> | 2259 <listitem><para> |
2195 I have not used <option>-vf filmdint</option> myself, but here is what | 2260 I have not used <option>-vf filmdint</option> myself, but here is what |
2196 D Richard Felker III has to say: | 2261 D Richard Felker III has to say: |
2197 | 2262 |
2198 <blockquote><para>It is OK, but IMO it tries to deinterlace rather | 2263 <blockquote><para>It is OK, but IMO it tries to deinterlace rather |
2199 than doing inverse telecine too often (much like settop DVD | 2264 than doing inverse telecine too often (much like settop DVD |
2200 players & progressive TVs) which gives ugly flickering and | 2265 players & progressive TVs) which gives ugly flickering and |
2201 other artifacts. If you are going to use it, you at least need to | 2266 other artifacts. If you are going to use it, you at least need to |
2202 spend some time tuning the options and watching the output first | 2267 spend some time tuning the options and watching the output first |
2203 to make sure it is not messing up.</para></blockquote> | 2268 to make sure it is not messing up. |
2204 </para></listitem> | 2269 </para></blockquote> |
2270 </para></listitem> | |
2205 </itemizedlist> | 2271 </itemizedlist> |
2206 </sect3> | 2272 </sect3> |
2207 | 2273 |
2274 | |
2208 <sect3 id="menc-feat-telecine-encode-mixedpi"> | 2275 <sect3 id="menc-feat-telecine-encode-mixedpi"> |
2209 <title>Mixed progressive and interlaced</title> | 2276 <title>Mixed progressive and interlaced</title> |
2210 <para> | 2277 |
2211 There are two options for dealing with this category, each of | 2278 <para> |
2212 which is a compromise. You should decide based on the | 2279 There are two options for dealing with this category, each of |
2213 duration/location of each type. | 2280 which is a compromise. You should decide based on the |
2281 duration/location of each type. | |
2214 </para> | 2282 </para> |
2215 | 2283 |
2216 <itemizedlist> | 2284 <itemizedlist> |
2217 <listitem><para> | 2285 <listitem> |
2286 <para> | |
2218 Treat it as progressive. The interlaced parts will look interlaced, | 2287 Treat it as progressive. The interlaced parts will look interlaced, |
2219 and some of the interlaced fields will have to be dropped, resulting | 2288 and some of the interlaced fields will have to be dropped, resulting |
2220 in a bit of uneven jumpiness. You can use a postprocessing filter if | 2289 in a bit of uneven jumpiness. You can use a postprocessing filter if |
2221 you want to, but it may slightly degrade the progressive parts. | 2290 you want to, but it may slightly degrade the progressive parts. |
2222 </para> | 2291 </para> |
2249 display it. If your video is 90% progressive and you never intend to | 2318 display it. If your video is 90% progressive and you never intend to |
2250 show it on a TV, you should favor a progressive approach. If it is | 2319 show it on a TV, you should favor a progressive approach. If it is |
2251 only half progressive, you probably want to encode it as if it is all | 2320 only half progressive, you probably want to encode it as if it is all |
2252 interlaced. | 2321 interlaced. |
2253 </para> | 2322 </para> |
2254 </listitem> | 2323 </listitem> |
2255 | 2324 |
2256 <listitem><para> | 2325 <listitem><para> |
2257 Treat it as interlaced. Some frames of the progressive parts will | 2326 Treat it as interlaced. Some frames of the progressive parts will |
2258 need to be duplicated, resulting in uneven jumpiness. Again, | 2327 need to be duplicated, resulting in uneven jumpiness. Again, |
2259 deinterlacing filters may slightly degrade the progressive parts. | 2328 deinterlacing filters may slightly degrade the progressive parts. |
2260 </para></listitem> | 2329 </para></listitem> |
2261 | |
2262 </itemizedlist> | 2330 </itemizedlist> |
2263 </sect3> | 2331 </sect3> |
2264 | |
2265 </sect2> | 2332 </sect2> |
2333 | |
2334 <!-- ********** --> | |
2266 | 2335 |
2267 <sect2 id="menc-feat-telecine-footnotes"> | 2336 <sect2 id="menc-feat-telecine-footnotes"> |
2268 <title>Footnotes</title> | 2337 <title>Footnotes</title> |
2338 | |
2269 <orderedlist> | 2339 <orderedlist> |
2270 <listitem><formalpara> | 2340 <listitem> |
2341 <formalpara> | |
2271 <title>About cropping:</title> | 2342 <title>About cropping:</title> |
2272 <para> | 2343 <para> |
2273 Video data on DVDs are stored in a format called YUV 4:2:0. In YUV | 2344 Video data on DVDs are stored in a format called YUV 4:2:0. In YUV |
2274 video, luma ("brightness") and chroma ("color") | 2345 video, luma ("brightness") and chroma ("color") |
2275 are stored separately. Because the human eye is somewhat less | 2346 are stored separately. Because the human eye is somewhat less |
2309 <para> | 2380 <para> |
2310 For interlaced (not telecined) video, you must always crop | 2381 For interlaced (not telecined) video, you must always crop |
2311 vertically by multiples of four unless you use <option>-vf | 2382 vertically by multiples of four unless you use <option>-vf |
2312 field</option> before cropping. | 2383 field</option> before cropping. |
2313 </para> | 2384 </para> |
2314 </listitem> | 2385 </listitem> |
2315 | 2386 |
2316 <listitem><formalpara> | 2387 <listitem><formalpara> |
2317 <title>About encoding parameters and quality:</title> | 2388 <title>About encoding parameters and quality:</title> |
2318 <para> | 2389 <para> |
2319 Just because I recommend <option>mbd=2</option> here does not mean it | 2390 Just because I recommend <option>mbd=2</option> here does not mean it |
2325 encoding). There are many other options to | 2396 encoding). There are many other options to |
2326 <systemitem class="library">libavcodec</systemitem> that increase | 2397 <systemitem class="library">libavcodec</systemitem> that increase |
2327 encoding quality (and decrease encoding speed) but that is beyond | 2398 encoding quality (and decrease encoding speed) but that is beyond |
2328 the scope of this document. | 2399 the scope of this document. |
2329 </para> | 2400 </para> |
2330 </formalpara> | 2401 </formalpara></listitem> |
2331 </listitem> | |
2332 | 2402 |
2333 <listitem><formalpara> | 2403 <listitem><formalpara> |
2334 <title>About the performance of pullup:</title> | 2404 <title>About the performance of pullup:</title> |
2335 <para> | 2405 <para> |
2336 It is safe to use <option>pullup</option> (along with <option>softskip | 2406 It is safe to use <option>pullup</option> (along with <option>softskip |
2340 <option>pullup</option> causes <application>MEncoder</application> to | 2410 <option>pullup</option> causes <application>MEncoder</application> to |
2341 be 50% slower. Adding sound processing and advanced <option>lavcopts | 2411 be 50% slower. Adding sound processing and advanced <option>lavcopts |
2342 </option> overshadows that difference, bringing the performance | 2412 </option> overshadows that difference, bringing the performance |
2343 decrease of using <option>pullup</option> down to 2%. | 2413 decrease of using <option>pullup</option> down to 2%. |
2344 </para> | 2414 </para> |
2345 </formalpara> | 2415 </formalpara></listitem> |
2346 </listitem> | |
2347 | |
2348 </orderedlist> | 2416 </orderedlist> |
2349 | |
2350 </sect2> | 2417 </sect2> |
2351 | |
2352 </sect1> | 2418 </sect1> |
2419 | |
2420 | |
2421 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
2353 | 2422 |
2354 | 2423 |
2355 <sect1 id="menc-feat-enc-libavcodec"> | 2424 <sect1 id="menc-feat-enc-libavcodec"> |
2356 <title>Encoding with the <systemitem class="library">libavcodec</systemitem> | 2425 <title>Encoding with the <systemitem class="library">libavcodec</systemitem> |
2357 codec family</title> | 2426 codec family</title> |
2360 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link> | 2429 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link> |
2361 provides simple encoding to a lot of interesting video and audio formats. | 2430 provides simple encoding to a lot of interesting video and audio formats. |
2362 You can encode to the following codecs (more or less up to date): | 2431 You can encode to the following codecs (more or less up to date): |
2363 </para> | 2432 </para> |
2364 | 2433 |
2434 <!-- ********** --> | |
2435 | |
2365 <sect2 id="menc-feat-enc-libavcodec-video-codecs"> | 2436 <sect2 id="menc-feat-enc-libavcodec-video-codecs"> |
2366 <title><systemitem class="library">libavcodec</systemitem>'s video codecs</title> | 2437 <title><systemitem class="library">libavcodec</systemitem>'s |
2438 video codecs</title> | |
2367 | 2439 |
2368 <para> | 2440 <para> |
2369 <informaltable frame="all"> | 2441 <informaltable frame="all"> |
2370 <tgroup cols="2"> | 2442 <tgroup cols="2"> |
2371 <thead> | 2443 <thead> |
2372 <row><entry>Video codec name</entry><entry>Description</entry></row> | 2444 <row><entry>Video codec name</entry><entry>Description</entry></row> |
2373 </thead> | 2445 </thead> |
2374 <tbody> | 2446 <tbody> |
2375 <row><entry>mjpeg</entry><entry> | 2447 <row> |
2376 Motion JPEG | 2448 <entry>mjpeg</entry> |
2377 </entry></row> | 2449 <entry>Motion JPEG</entry> |
2378 <row><entry>ljpeg</entry><entry> | 2450 </row> |
2379 lossless JPEG | 2451 <row> |
2380 </entry></row> | 2452 <entry>ljpeg</entry> |
2381 <row><entry>h261</entry><entry> | 2453 <entry>lossless JPEG</entry> |
2382 H.261 | 2454 </row> |
2383 </entry></row> | 2455 <row> |
2384 <row><entry>h263</entry><entry> | 2456 <entry>h261</entry> |
2385 H.263 | 2457 <entry>H.261</entry> |
2386 </entry></row> | 2458 </row> |
2387 <row><entry>h263p</entry><entry> | 2459 <row> |
2388 H.263+ | 2460 <entry>h263</entry> |
2389 </entry></row> | 2461 <entry>H.263 </entry> |
2390 <row><entry>mpeg4</entry><entry> | 2462 </row> |
2391 ISO standard MPEG-4 (DivX, Xvid compatible) | 2463 <row> |
2392 </entry></row> | 2464 <entry>h263p</entry> |
2393 <row><entry>msmpeg4</entry><entry> | 2465 <entry>H.263+</entry> |
2394 pre-standard MPEG-4 variant by MS, v3 (AKA DivX3) | 2466 </row> |
2395 </entry></row> | 2467 <row> |
2396 <row><entry>msmpeg4v2</entry><entry> | 2468 <entry>mpeg4</entry> |
2397 pre-standard MPEG-4 by MS, v2 (used in old ASF files) | 2469 <entry>ISO standard MPEG-4 (DivX, Xvid compatible)</entry> |
2398 </entry></row> | 2470 </row> |
2399 <row><entry>wmv1</entry><entry> | 2471 <row> |
2400 Windows Media Video, version 1 (AKA WMV7) | 2472 <entry>msmpeg4</entry> |
2401 </entry></row> | 2473 <entry>pre-standard MPEG-4 variant by MS, v3 (AKA DivX3)</entry> |
2402 <row><entry>wmv2</entry><entry> | 2474 </row> |
2403 Windows Media Video, version 2 (AKA WMV8) | 2475 <row> |
2404 </entry></row> | 2476 <entry>msmpeg4v2</entry> |
2405 <row><entry>rv10</entry><entry> | 2477 <entry>pre-standard MPEG-4 by MS, v2 (used in old ASF files)</entry> |
2406 RealVideo 1.0 | 2478 </row> |
2407 </entry></row> | 2479 <row> |
2408 <row><entry>rv20</entry><entry> | 2480 <entry>wmv1</entry> |
2409 RealVideo 2.0 | 2481 <entry>Windows Media Video, version 1 (AKA WMV7)</entry> |
2410 </entry></row> | 2482 </row> |
2411 <row><entry>mpeg1video</entry><entry> | 2483 <row> |
2412 MPEG-1 video | 2484 <entry>wmv2</entry> |
2413 </entry></row> | 2485 <entry>Windows Media Video, version 2 (AKA WMV8)</entry> |
2414 <row><entry>mpeg2video</entry><entry> | 2486 </row> |
2415 MPEG-2 video | 2487 <row> |
2416 </entry></row> | 2488 <entry>rv10</entry> |
2417 <row><entry>huffyuv</entry><entry> | 2489 <entry>RealVideo 1.0</entry> |
2418 lossless compression | 2490 </row> |
2419 </entry></row> | 2491 <row> |
2420 <row><entry>asv1</entry><entry> | 2492 <entry>rv20</entry> |
2421 ASUS Video v1 | 2493 <entry>RealVideo 2.0</entry> |
2422 </entry></row> | 2494 </row> |
2423 <row><entry>asv2</entry><entry> | 2495 <row> |
2424 ASUS Video v2 | 2496 <entry>mpeg1video</entry> |
2425 </entry></row> | 2497 <entry>MPEG-1 video</entry> |
2426 <row><entry>ffv1</entry><entry> | 2498 </row> |
2427 FFmpeg's lossless video codec | 2499 <row> |
2428 </entry></row> | 2500 <entry>mpeg2video</entry> |
2429 <row><entry>svq1</entry><entry> | 2501 <entry>MPEG-2 video</entry> |
2430 Sorenson video 1 | 2502 </row> |
2431 </entry></row> | 2503 <row> |
2432 <row><entry>flv</entry><entry> | 2504 <entry>huffyuv</entry> |
2433 Sorenson H.263 used in Flash Video | 2505 <entry>lossless compression</entry> |
2434 </entry></row> | 2506 </row> |
2435 <row><entry>dvvideo</entry><entry> | 2507 <row> |
2436 Sony Digital Video | 2508 <entry>asv1</entry> |
2437 </entry></row> | 2509 <entry>ASUS Video v1</entry> |
2438 <row><entry>snow</entry><entry> | 2510 </row> |
2439 FFmpeg's experimental wavelet-based codec | 2511 <row> |
2440 </entry></row> | 2512 <entry>asv2</entry> |
2513 <entry>ASUS Video v2</entry> | |
2514 </row> | |
2515 <row> | |
2516 <entry>ffv1</entry> | |
2517 <entry>FFmpeg's lossless video codec</entry> | |
2518 </row> | |
2519 <row> | |
2520 <entry>svq1</entry> | |
2521 <entry>Sorenson video 1</entry> | |
2522 </row> | |
2523 <row> | |
2524 <entry>flv</entry> | |
2525 <entry>Sorenson H.263 used in Flash Video</entry> | |
2526 </row> | |
2527 <row> | |
2528 <entry>dvvideo</entry> | |
2529 <entry>Sony Digital Video</entry> | |
2530 </row> | |
2531 <row> | |
2532 <entry>snow</entry> | |
2533 <entry>FFmpeg's experimental wavelet-based codec</entry> | |
2534 </row> | |
2441 </tbody> | 2535 </tbody> |
2442 </tgroup> | 2536 </tgroup> |
2443 </informaltable> | 2537 </informaltable> |
2444 | 2538 |
2445 The first column contains the codec names that should be passed after the | 2539 The first column contains the codec names that should be passed after the |
2446 <literal>vcodec</literal> config, like: <option>-lavcopts vcodec=msmpeg4</option> | 2540 <literal>vcodec</literal> config, |
2447 </para> | 2541 like: <option>-lavcopts vcodec=msmpeg4</option> |
2448 <informalexample> | 2542 </para> |
2449 <para> | 2543 |
2544 <informalexample><para> | |
2450 An example with MJPEG compression: | 2545 An example with MJPEG compression: |
2451 <screen>mencoder dvd://2 -o title2.avi -ovc lavc -lavcopts vcodec=mjpeg -oac copy</screen> | 2546 <screen> |
2452 </para> | 2547 mencoder dvd://2 -o <replaceable>title2.avi</replaceable> -ovc lavc -lavcopts vcodec=mjpeg -oac copy |
2453 </informalexample> | 2548 </screen> |
2549 </para></informalexample> | |
2454 </sect2> | 2550 </sect2> |
2455 | 2551 |
2552 <!-- ********** --> | |
2553 | |
2456 <sect2 id="menc-feat-enc-libavcodec-audio-codecs"> | 2554 <sect2 id="menc-feat-enc-libavcodec-audio-codecs"> |
2457 <title><systemitem class="library">libavcodec</systemitem>'s audio codecs</title> | 2555 <title><systemitem class="library">libavcodec</systemitem>'s |
2556 audio codecs</title> | |
2557 | |
2458 <para> | 2558 <para> |
2459 <informaltable frame="all"> | 2559 <informaltable frame="all"> |
2460 <tgroup cols="2"> | 2560 <tgroup cols="2"> |
2461 <thead> | 2561 <thead> |
2462 <row><entry>Audio codec name</entry><entry>Description</entry></row> | 2562 <row><entry>Audio codec name</entry><entry>Description</entry></row> |
2463 </thead> | 2563 </thead> |
2464 <tbody> | 2564 <tbody> |
2465 <row> | 2565 <row> |
2466 <entry>mp2</entry> | 2566 <entry>mp2</entry> |
2467 <entry>MPEG Layer 2</entry> | 2567 <entry>MPEG Layer 2</entry> |
2468 </row> | 2568 </row> |
2469 <row> | 2569 <row> |
2470 <entry>ac3</entry> | 2570 <entry>ac3</entry> |
2471 <entry>AC3, AKA Dolby Digital</entry> | 2571 <entry>AC3, AKA Dolby Digital</entry> |
2472 </row> | 2572 </row> |
2473 <row> | 2573 <row> |
2474 <entry>adpcm_ima_wav</entry> | 2574 <entry>adpcm_ima_wav</entry> |
2475 <entry>IMA adaptive PCM (4 bits per sample, 4:1 compression)</entry> | 2575 <entry>IMA adaptive PCM (4 bits per sample, 4:1 compression)</entry> |
2476 </row> | 2576 </row> |
2477 <row> | 2577 <row> |
2478 <entry>sonic</entry> | 2578 <entry>sonic</entry> |
2479 <entry>experimental lossy/lossless codec</entry> | 2579 <entry>experimental lossy/lossless codec</entry> |
2480 </row> | 2580 </row> |
2481 </tbody> | 2581 </tbody> |
2482 </tgroup> | 2582 </tgroup> |
2483 </informaltable> | 2583 </informaltable> |
2484 | 2584 |
2485 The first column contains the codec names that should be passed after the | 2585 The first column contains the codec names that should be passed after the |
2486 <literal>acodec</literal> option, like: <option>-lavcopts acodec=ac3</option> | 2586 <literal>acodec</literal> option, like: <option>-lavcopts acodec=ac3</option> |
2487 </para> | 2587 </para> |
2488 | 2588 |
2489 <informalexample> | 2589 <informalexample><para> |
2490 <para> | |
2491 An example with AC3 compression: | 2590 An example with AC3 compression: |
2492 <screen>mencoder dvd://2 -o title2.avi -oac lavc -lavcopts acodec=ac3 -ovc copy</screen> | 2591 <screen> |
2493 </para> | 2592 mencoder dvd://2 -o <replaceable>title2.avi</replaceable> -oac lavc -lavcopts acodec=ac3 -ovc copy |
2494 </informalexample> | 2593 </screen> |
2495 | 2594 </para></informalexample> |
2496 <para> | 2595 |
2497 Contrary to <systemitem class="library">libavcodec</systemitem>'s video | 2596 <para> |
2498 codecs, its audio codecs do not make a wise usage of the bits they are | 2597 Contrary to <systemitem class="library">libavcodec</systemitem>'s video |
2499 given as they lack some minimal psychoacoustic model (if at all) | 2598 codecs, its audio codecs do not make a wise usage of the bits they are |
2500 which most other codec implementations feature. | 2599 given as they lack some minimal psychoacoustic model (if at all) |
2501 However, note that all these audio codecs are very fast and work | 2600 which most other codec implementations feature. |
2502 out-of-the-box everywhere <application>MEncoder</application> has been | 2601 However, note that all these audio codecs are very fast and work |
2503 compiled with <systemitem class="library">libavcodec</systemitem> (which | 2602 out-of-the-box everywhere <application>MEncoder</application> has been |
2504 is the case most of time), and do not depend on external libraries. | 2603 compiled with <systemitem class="library">libavcodec</systemitem> (which |
2604 is the case most of time), and do not depend on external libraries. | |
2505 </para> | 2605 </para> |
2506 </sect2> | 2606 </sect2> |
2507 | 2607 |
2608 <!-- ********** --> | |
2508 | 2609 |
2509 <sect2 id="menc-feat-dvd-mpeg4-lavc-encoding-options"> | 2610 <sect2 id="menc-feat-dvd-mpeg4-lavc-encoding-options"> |
2510 <title>Encoding options of libavcodec</title> | 2611 <title>Encoding options of libavcodec</title> |
2511 | 2612 |
2512 <para> | 2613 <para> |
2513 Ideally, you would probably want to be able to just tell the encoder to switch | 2614 Ideally, you would probably want to be able to just tell the encoder to switch |
2514 into "high quality" mode and move on. | 2615 into "high quality" mode and move on. |
2515 That would probably be nice, but unfortunately hard to implement as different | 2616 That would probably be nice, but unfortunately hard to implement as different |
2516 encoding options yield different quality results depending on the source material. | 2617 encoding options yield different quality results depending on the source |
2517 That is because compression depends on the visual properties of the video | 2618 material. That is because compression depends on the visual properties of the |
2518 in question. | 2619 video in question. |
2519 For example, anime and live action have very different properties and | 2620 For example, anime and live action have very different properties and |
2520 thus require different options to obtain optimum encoding. | 2621 thus require different options to obtain optimum encoding. |
2521 The good news is that some options should never be left out, like | 2622 The good news is that some options should never be left out, like |
2522 <option>mbd=2</option>, <option>trell</option>, and <option>v4mv</option>. | 2623 <option>mbd=2</option>, <option>trell</option>, and <option>v4mv</option>. |
2523 See below for a detailed description of common encoding options. | 2624 See below for a detailed description of common encoding options. |
2524 </para> | 2625 </para> |
2525 | |
2526 | 2626 |
2527 <itemizedlist> | 2627 <itemizedlist> |
2528 <title>Options to adjust:</title> | 2628 <title>Options to adjust:</title> |
2529 <listitem><para> | 2629 <listitem><para> |
2530 <emphasis role="bold">vmax_b_frames</emphasis>: 1 or 2 is good, depending on | 2630 <emphasis role="bold">vmax_b_frames</emphasis>: 1 or 2 is good, depending on |
2533 need to activate closed GOP support, using | 2633 need to activate closed GOP support, using |
2534 <systemitem class="library">libavcodec</systemitem>'s <option>cgop</option> | 2634 <systemitem class="library">libavcodec</systemitem>'s <option>cgop</option> |
2535 option, but you need to deactivate scene detection, which | 2635 option, but you need to deactivate scene detection, which |
2536 is not a good idea as it will hurt encode efficiency a bit. | 2636 is not a good idea as it will hurt encode efficiency a bit. |
2537 </para></listitem> | 2637 </para></listitem> |
2538 | |
2539 <listitem><para> | 2638 <listitem><para> |
2540 <emphasis role="bold">vb_strategy=1</emphasis>: helps in high-motion scenes. | 2639 <emphasis role="bold">vb_strategy=1</emphasis>: helps in high-motion scenes. |
2541 On some videos, vmax_b_frames may hurt quality, but vmax_b_frames=2 along | 2640 On some videos, vmax_b_frames may hurt quality, but vmax_b_frames=2 along |
2542 with vb_strategy=1 helps. | 2641 with vb_strategy=1 helps. |
2543 </para></listitem> | 2642 </para></listitem> |
2544 | |
2545 <listitem><para> | 2643 <listitem><para> |
2546 <emphasis role="bold">dia</emphasis>: motion search range. Bigger is better | 2644 <emphasis role="bold">dia</emphasis>: motion search range. Bigger is better |
2547 and slower. | 2645 and slower. |
2548 Negative values are a completely different scale. | 2646 Negative values are a completely different scale. |
2549 Good values are -1 for a fast encode, or 2-4 for slower. | 2647 Good values are -1 for a fast encode, or 2-4 for slower. |
2550 </para></listitem> | 2648 </para></listitem> |
2551 | |
2552 <listitem><para> | 2649 <listitem><para> |
2553 <emphasis role="bold">predia</emphasis>: motion search pre-pass. | 2650 <emphasis role="bold">predia</emphasis>: motion search pre-pass. |
2554 Not as important as dia. Good values are 1 (default) to 4. Requires preme=2 | 2651 Not as important as dia. Good values are 1 (default) to 4. Requires preme=2 |
2555 to really be useful. | 2652 to really be useful. |
2556 </para></listitem> | 2653 </para></listitem> |
2557 | |
2558 <listitem><para> | 2654 <listitem><para> |
2559 <emphasis role="bold">cmp, subcmp, precmp</emphasis>: Comparison function for | 2655 <emphasis role="bold">cmp, subcmp, precmp</emphasis>: Comparison function for |
2560 motion estimation. | 2656 motion estimation. |
2561 Experiment with values of 0 (default), 2 (hadamard), 3 (dct), and 6 (rate | 2657 Experiment with values of 0 (default), 2 (hadamard), 3 (dct), and 6 (rate |
2562 distortion). | 2658 distortion). |
2563 0 is fastest, and sufficient for precmp. | 2659 0 is fastest, and sufficient for precmp. |
2564 For cmp and subcmp, 2 is good for anime, and 3 is good for live action. | 2660 For cmp and subcmp, 2 is good for anime, and 3 is good for live action. |
2565 6 may or may not be slightly better, but is slow. | 2661 6 may or may not be slightly better, but is slow. |
2566 </para></listitem> | 2662 </para></listitem> |
2567 | |
2568 <listitem><para> | 2663 <listitem><para> |
2569 <emphasis role="bold">last_pred</emphasis>: Number of motion predictors to | 2664 <emphasis role="bold">last_pred</emphasis>: Number of motion predictors to |
2570 take from the previous frame. | 2665 take from the previous frame. |
2571 1-3 or so help at little speed cost. | 2666 1-3 or so help at little speed cost. |
2572 Higher values are slow for no extra gain. | 2667 Higher values are slow for no extra gain. |
2573 </para></listitem> | 2668 </para></listitem> |
2574 | 2669 <listitem><para> |
2575 <listitem><para> | 2670 <emphasis role="bold">cbp, mv0</emphasis>: Controls the selection of |
2576 <emphasis role="bold">cbp, mv0</emphasis>: Controls the selection of macroblocks. | 2671 macroblocks. Small speed cost for small quality gain. |
2577 Small speed cost for small quality gain. | 2672 </para></listitem> |
2578 </para></listitem> | |
2579 | |
2580 <listitem><para> | 2673 <listitem><para> |
2581 <emphasis role="bold">qprd</emphasis>: adaptive quantization based on the | 2674 <emphasis role="bold">qprd</emphasis>: adaptive quantization based on the |
2582 macroblock's complexity. | 2675 macroblock's complexity. |
2583 May help or hurt depending on the video and other options. | 2676 May help or hurt depending on the video and other options. |
2584 This can cause artifacts unless you set vqmax to some reasonably small value | 2677 This can cause artifacts unless you set vqmax to some reasonably small value |
2585 (6 is good, maybe as low as 4); vqmin=1 should also help. | 2678 (6 is good, maybe as low as 4); vqmin=1 should also help. |
2586 </para></listitem> | 2679 </para></listitem> |
2587 | |
2588 <listitem><para> | 2680 <listitem><para> |
2589 <emphasis role="bold">qns</emphasis>: very slow, especially when combined | 2681 <emphasis role="bold">qns</emphasis>: very slow, especially when combined |
2590 with qprd. | 2682 with qprd. |
2591 This option will make the encoder minimize noise due to compression | 2683 This option will make the encoder minimize noise due to compression |
2592 artifacts instead of making the encoded video strictly match the source. | 2684 artifacts instead of making the encoded video strictly match the source. |
2593 Do not use this unless you have already tweaked everything else as far as it | 2685 Do not use this unless you have already tweaked everything else as far as it |
2594 will go and the results still are not good enough. | 2686 will go and the results still are not good enough. |
2595 </para></listitem> | 2687 </para></listitem> |
2596 | |
2597 <listitem><para> | 2688 <listitem><para> |
2598 <emphasis role="bold">vqcomp</emphasis>: Tweak ratecontrol. | 2689 <emphasis role="bold">vqcomp</emphasis>: Tweak ratecontrol. |
2599 What values are good depends on the movie. | 2690 What values are good depends on the movie. |
2600 You can safely leave this alone if you want. | 2691 You can safely leave this alone if you want. |
2601 Reducing vqcomp puts more bits on low-complexity scenes, increasing it puts | 2692 Reducing vqcomp puts more bits on low-complexity scenes, increasing it puts |
2602 them on high-complexity scenes (default: 0.5, range: 0-1. recommended range: | 2693 them on high-complexity scenes (default: 0.5, range: 0-1. recommended range: |
2603 0.5-0.7). | 2694 0.5-0.7). |
2604 </para></listitem> | 2695 </para></listitem> |
2605 | |
2606 <listitem><para> | 2696 <listitem><para> |
2607 <emphasis role="bold">vlelim, vcelim</emphasis>: Sets the single coefficient | 2697 <emphasis role="bold">vlelim, vcelim</emphasis>: Sets the single coefficient |
2608 elimination threshold for luminance and chroma planes. | 2698 elimination threshold for luminance and chroma planes. |
2609 These are encoded separately in all MPEG-like algorithms. | 2699 These are encoded separately in all MPEG-like algorithms. |
2610 The idea behind these options is to use some good heuristics to determine | 2700 The idea behind these options is to use some good heuristics to determine |
2612 such a case, to just encode the block as "no change". | 2702 such a case, to just encode the block as "no change". |
2613 This saves bits and perhaps speeds up encoding. vlelim=-4 and vcelim=9 | 2703 This saves bits and perhaps speeds up encoding. vlelim=-4 and vcelim=9 |
2614 seem to be good for live movies, but seem not to help with anime; | 2704 seem to be good for live movies, but seem not to help with anime; |
2615 when encoding animation, you should probably leave them unchanged. | 2705 when encoding animation, you should probably leave them unchanged. |
2616 </para></listitem> | 2706 </para></listitem> |
2617 | |
2618 <listitem><para> | 2707 <listitem><para> |
2619 <emphasis role="bold">qpel</emphasis>: Quarter pixel motion estimation. | 2708 <emphasis role="bold">qpel</emphasis>: Quarter pixel motion estimation. |
2620 MPEG-4 uses half pixel precision for its motion search by default, | 2709 MPEG-4 uses half pixel precision for its motion search by default, |
2621 therefore this option comes with an overhead as more information will be | 2710 therefore this option comes with an overhead as more information will be |
2622 stored in the encoded file. | 2711 stored in the encoded file. |
2623 The compression gain/loss depends on the movie, but it is usually not very | 2712 The compression gain/loss depends on the movie, but it is usually not very |
2624 effective on anime. | 2713 effective on anime. |
2625 qpel always incurs a significant cost in CPU decode time (+25% in | 2714 qpel always incurs a significant cost in CPU decode time (+25% in |
2626 practice). | 2715 practice). |
2627 </para></listitem> | 2716 </para></listitem> |
2628 | |
2629 <listitem><para> | 2717 <listitem><para> |
2630 <emphasis role="bold">psnr</emphasis>: does not affect the actual encoding, | 2718 <emphasis role="bold">psnr</emphasis>: does not affect the actual encoding, |
2631 but writes a log file giving the type/size/quality of each frame, and | 2719 but writes a log file giving the type/size/quality of each frame, and |
2632 prints a summary of PSNR (Peak Signal to Noise Ratio) at the end. | 2720 prints a summary of PSNR (Peak Signal to Noise Ratio) at the end. |
2633 </para></listitem> | 2721 </para></listitem> |
2634 | |
2635 </itemizedlist> | 2722 </itemizedlist> |
2636 | 2723 |
2637 <itemizedlist> | 2724 <itemizedlist> |
2638 <title>Options not recommended to play with:</title> | 2725 <title>Options not recommended to play with:</title> |
2639 <listitem><para> | 2726 <listitem><para> |
2640 <emphasis role="bold">vme</emphasis>: The default is best. | 2727 <emphasis role="bold">vme</emphasis>: The default is best. |
2641 </para></listitem> | 2728 </para></listitem> |
2642 | |
2643 <listitem><para> | 2729 <listitem><para> |
2644 <emphasis role="bold">lumi_mask, dark_mask</emphasis>: Psychovisual adaptive | 2730 <emphasis role="bold">lumi_mask, dark_mask</emphasis>: Psychovisual adaptive |
2645 quantization. | 2731 quantization. |
2646 You do not want to play with those options if you care about quality. | 2732 You do not want to play with those options if you care about quality. |
2647 Reasonable values may be effective in your case, but be warned this is very | 2733 Reasonable values may be effective in your case, but be warned this is very |
2648 subjective. | 2734 subjective. |
2649 </para></listitem> | 2735 </para></listitem> |
2650 | |
2651 <listitem><para> | 2736 <listitem><para> |
2652 <emphasis role="bold">scplx_mask</emphasis>: Tries to prevent blocky | 2737 <emphasis role="bold">scplx_mask</emphasis>: Tries to prevent blocky |
2653 artifacts, but postprocessing is better. | 2738 artifacts, but postprocessing is better. |
2654 </para></listitem> | 2739 </para></listitem> |
2655 </itemizedlist> | 2740 </itemizedlist> |
2656 </sect2> | 2741 </sect2> |
2657 | 2742 |
2743 <!-- ********** --> | |
2744 | |
2658 <sect2 id="menc-feat-mpeg4-lavc-example-settings"> | 2745 <sect2 id="menc-feat-mpeg4-lavc-example-settings"> |
2659 <title>Encoding setting examples</title> | 2746 <title>Encoding setting examples</title> |
2660 | 2747 |
2661 <para> | 2748 <para> |
2662 The following settings are examples of different encoding | 2749 The following settings are examples of different encoding |
2663 option combinations that affect the speed vs quality tradeoff | 2750 option combinations that affect the speed vs quality tradeoff |
2664 at the same target bitrate. | 2751 at the same target bitrate. |
2665 </para> | 2752 </para> |
2666 | 2753 |
2667 <para> | 2754 <para> |
2668 All the encoding settings were tested on a 720x448 @30000/1001 fps | 2755 All the encoding settings were tested on a 720x448 @30000/1001 fps |
2669 video sample, the target bitrate was 900kbps, and the machine was an | 2756 video sample, the target bitrate was 900kbps, and the machine was an |
2670 AMD-64 3400+ at 2400 MHz in 64 bits mode. | 2757 AMD-64 3400+ at 2400 MHz in 64 bits mode. |
2671 Each encoding setting features the measured encoding speed (in | 2758 Each encoding setting features the measured encoding speed (in |
2672 frames per second) and the PSNR loss (in dB) compared to the "very | 2759 frames per second) and the PSNR loss (in dB) compared to the "very |
2673 high quality" setting. | 2760 high quality" setting. |
2674 Please understand that depending on your source, your machine type | 2761 Please understand that depending on your source, your machine type |
2675 and development advancements, you may get very different results. | 2762 and development advancements, you may get very different results. |
2676 </para> | 2763 </para> |
2677 | 2764 |
2678 <para> | 2765 <para> |
2679 <informaltable frame="all"> | 2766 <informaltable frame="all"> |
2680 <tgroup cols="4"> | 2767 <tgroup cols="4"> |
2681 <thead> | 2768 <thead> |
2682 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> | 2769 <row> |
2770 <entry>Description</entry> | |
2771 <entry>Encoding options</entry> | |
2772 <entry>speed (in fps)</entry> | |
2773 <entry>Relative PSNR loss (in dB)</entry> | |
2774 </row> | |
2683 </thead> | 2775 </thead> |
2684 <tbody> | 2776 <tbody> |
2685 <row> | 2777 <row> |
2686 <entry>Very high quality</entry> | 2778 <entry>Very high quality</entry> |
2687 <entry><option>vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2</option></entry> | 2779 <entry><option>vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=2:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2</option></entry> |
2710 </tgroup> | 2802 </tgroup> |
2711 </informaltable> | 2803 </informaltable> |
2712 </para> | 2804 </para> |
2713 </sect2> | 2805 </sect2> |
2714 | 2806 |
2715 <sect2 id="custommatrices"><title>Custom inter/intra matrices</title> | 2807 <!-- ********** --> |
2808 | |
2809 <sect2 id="custommatrices"> | |
2810 <title>Custom inter/intra matrices</title> | |
2716 | 2811 |
2717 <para> | 2812 <para> |
2718 With this feature of | 2813 With this feature of |
2719 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link> | 2814 <link linkend="ffmpeg"><systemitem class="library">libavcodec</systemitem></link> |
2720 you are able to set custom inter (I-frames/keyframes) and intra | 2815 you are able to set custom inter (I-frames/keyframes) and intra |
2759 </para> | 2854 </para> |
2760 | 2855 |
2761 <para> | 2856 <para> |
2762 Usage: | 2857 Usage: |
2763 <screen> | 2858 <screen> |
2764 $ mencoder <replaceable>input.avi</replaceable> -o <replaceable>output.avi</replaceable> -oac copy -ovc lavc -lavcopts inter_matrix=...:intra_matrix=... | 2859 mencoder <replaceable>input.avi</replaceable> -o <replaceable>output.avi</replaceable> -oac copy -ovc lavc \ |
2860 -lavcopts inter_matrix=...:intra_matrix=... | |
2765 </screen> | 2861 </screen> |
2766 </para> | 2862 </para> |
2767 | 2863 |
2768 <para> | 2864 <para> |
2769 <screen> | 2865 <screen> |
2770 $ mencoder <replaceable>input.avi</replaceable> -ovc lavc -lavcopts | 2866 mencoder <replaceable>input.avi</replaceable> -ovc lavc -lavcopts \ |
2771 vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37, | 2867 vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,\ |
2772 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, | 2868 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,\ |
2773 29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79 | 2869 29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79\ |
2774 :inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26, | 2870 :inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,\ |
2775 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, | 2871 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,\ |
2776 36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg | 2872 36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg |
2777 </screen> | 2873 </screen> |
2778 </para> | 2874 </para> |
2779 </sect2> | 2875 </sect2> |
2780 | 2876 |
2877 <!-- ********** --> | |
2781 | 2878 |
2782 <sect2 id="menc-feat-dvd-mpeg4-example"> | 2879 <sect2 id="menc-feat-dvd-mpeg4-example"> |
2783 <title>Example</title> | 2880 <title>Example</title> |
2784 | 2881 |
2785 <para> | 2882 <para> |
2786 So, you have just bought your shiny new copy of Harry Potter and the Chamber | 2883 So, you have just bought your shiny new copy of Harry Potter and the Chamber |
2787 of Secrets (widescreen edition, of course), and you want to rip this DVD | 2884 of Secrets (widescreen edition, of course), and you want to rip this DVD |
2788 so that you can add it to your Home Theatre PC. This is a region 1 DVD, | 2885 so that you can add it to your Home Theatre PC. This is a region 1 DVD, |
2789 so it is NTSC. The example below will still apply to PAL, except you will | 2886 so it is NTSC. The example below will still apply to PAL, except you will |
2790 omit <option>-ofps 24000/1001</option> (because the output framerate is the | 2887 omit <option>-ofps 24000/1001</option> (because the output framerate is the |
2791 same as the input framerate), and of course the crop dimensions will be | 2888 same as the input framerate), and of course the crop dimensions will be |
2792 different. | 2889 different. |
2793 </para> | 2890 </para> |
2794 | 2891 |
2795 <para> | 2892 <para> |
2796 After running <option>mplayer dvd://1</option>, we follow the process | 2893 After running <option>mplayer dvd://1</option>, we follow the process |
2797 detailed in the section <link linkend="menc-feat-telecine">How to deal | 2894 detailed in the section <link linkend="menc-feat-telecine">How to deal |
2798 with telecine and interlacing in NTSC DVDs</link> and discover that it is | 2895 with telecine and interlacing in NTSC DVDs</link> and discover that it is |
2799 24000/1001 fps progressive video, which means that we need not use an inverse | 2896 24000/1001 fps progressive video, which means that we need not use an inverse |
2800 telecine filter, such as <option>pullup</option> or | 2897 telecine filter, such as <option>pullup</option> or |
2801 <option>filmdint</option>. | 2898 <option>filmdint</option>. |
2802 </para> | 2899 </para> |
2803 | 2900 |
2804 <para> | 2901 <para> |
2805 Next, we want to determine the appropriate crop rectangle, so we use the | 2902 Next, we want to determine the appropriate crop rectangle, so we use the |
2806 cropdetect filter: | 2903 cropdetect filter: |
2807 | 2904 <screen>mplayer dvd://1 -vf cropdetect</screen> |
2808 <screen>mplayer dvd://1 -vf cropdetect</screen> | 2905 Make sure you seek to a fully filled frame (such as a bright scene), and |
2809 | 2906 you will see in <application>MPlayer</application>'s console output: |
2810 Make sure you seek to a fully filled frame (such as a bright scene), and | 2907 <screen>crop area: X: 0..719 Y: 57..419 (-vf crop=720:362:0:58)</screen> |
2811 you will see in <application>MPlayer</application>'s console output: | 2908 We then play the movie back with this filter to test its correctness: |
2812 | 2909 <screen>mplayer dvd://1 -vf crop=720:362:0:58</screen> |
2813 <screen>crop area: X: 0..719 Y: 57..419 (-vf crop=720:362:0:58)</screen> | 2910 And we see that it looks perfectly fine. Next, we ensure the width and |
2814 | 2911 height are a multiple of 16. The width is fine, however the height is |
2815 We then play the movie back with this filter to test its correctness: | 2912 not. Since we did not fail 7th grade math, we know that the nearest |
2816 | 2913 multiple of 16 lower than 362 is 352. |
2817 <screen>mplayer dvd://1 -vf crop=720:362:0:58</screen> | 2914 </para> |
2818 | 2915 |
2819 And we see that it looks perfectly fine. Next, we ensure the width and | 2916 <para> |
2820 height are a multiple of 16. The width is fine, however the height is | 2917 We could just use <option>crop=720:352:0:58</option>, but it would be nice |
2821 not. Since we did not fail 7th grade math, we know that the nearest | 2918 to take a little off the top and a little off the bottom so that we |
2822 multiple of 16 lower than 362 is 352. | 2919 retain the center. We have shrunk the height by 10 pixels, but we do not |
2823 </para> | 2920 want to increase the y-offset by 5-pixels since that is an odd number and |
2824 | 2921 will adversely affect quality. Instead, we will increase the y-offset by |
2825 <para> | 2922 4 pixels: |
2826 We could just use <option>crop=720:352:0:58</option>, but it would be nice | 2923 <screen>mplayer dvd://1 -vf crop=720:352:0:62</screen> |
2827 to take a little off the top and a little off the bottom so that we | 2924 Another reason to shave pixels from both the top and the bottom is that we |
2828 retain the center. We have shrunk the height by 10 pixels, but we do not | 2925 ensure we have eliminated any half-black pixels if they exist. Note that if |
2829 want to increase the y-offset by 5-pixels since that is an odd number and | 2926 your video is telecined, make sure the <option>pullup</option> filter (or |
2830 will adversely affect quality. Instead, we will increase the y-offset by | 2927 whichever inverse telecine filter you decide to use) appears in the filter |
2831 4 pixels: | 2928 chain before you crop. If it is interlaced, deinterlace before cropping. |
2832 | 2929 (If you choose to preserve the interlaced video, then make sure your |
2833 <screen>mplayer dvd://1 -vf crop=720:352:0:62</screen> | 2930 vertical crop offset is a multiple of 4.) |
2834 | 2931 </para> |
2835 Another reason to shave pixels from both the top and the bottom is that we | 2932 |
2836 ensure we have eliminated any half-black pixels if they exist. Note that if | 2933 <para> |
2837 your video is telecined, make sure the <option>pullup</option> filter (or | 2934 If you are really concerned about losing those 10 pixels, you might |
2838 whichever inverse telecine filter you decide to use) appears in the filter | 2935 prefer instead to scale the dimensions down to the nearest multiple of 16. |
2839 chain before you crop. If it is interlaced, deinterlace before cropping. | 2936 The filter chain would look like: |
2840 (If you choose to preserve the interlaced video, then make sure your | 2937 <screen>-vf crop=720:362:0:58,scale=720:352</screen> |
2841 vertical crop offset is a multiple of 4.) | 2938 Scaling the video down like this will mean that some small amount of |
2842 </para> | 2939 detail is lost, though it probably will not be perceptible. Scaling up will |
2843 | 2940 result in lower quality (unless you increase the bitrate). Cropping |
2844 <para> | 2941 discards those pixels altogether. It is a tradeoff that you will want to |
2845 If you are really concerned about losing those 10 pixels, you might | 2942 consider for each circumstance. For example, if the DVD video was made |
2846 prefer instead to scale the dimensions down to the nearest multiple of 16. | 2943 for television, you might want to avoid vertical scaling, since the line |
2847 The filter chain would look like: | 2944 sampling corresponds to the way the content was originally recorded. |
2848 | 2945 </para> |
2849 <screen>-vf crop=720:362:0:58,scale=720:352</screen> | 2946 |
2850 | 2947 <para> |
2851 Scaling the video down like this will mean that some small amount of | 2948 On inspection, we see that our movie has a fair bit of action and high |
2852 detail is lost, though it probably will not be perceptible. Scaling up will | 2949 amounts of detail, so we pick 2400Kbit for our bitrate. |
2853 result in lower quality (unless you increase the bitrate). Cropping | 2950 </para> |
2854 discards those pixels altogether. It is a tradeoff that you will want to | 2951 |
2855 consider for each circumstance. For example, if the DVD video was made | 2952 <para> |
2856 for television, you might want to avoid vertical scaling, since the line | 2953 We are now ready to do the two pass encode. Pass one: |
2857 sampling corresponds to the way the content was originally recorded. | 2954 <screen> |
2858 </para> | 2955 mencoder dvd://1 -ofps 24000/1001 -oac copy -o <replaceable>Harry_Potter_2.avi</replaceable> -ovc lavc \ |
2859 | 2956 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 \ |
2860 <para> | 2957 -vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2 |
2861 On inspection, we see that our movie has a fair bit of action and high | 2958 </screen> |
2862 amounts of detail, so we pick 2400Kbit for our bitrate. | 2959 And pass two is the same, except that we specify <option>vpass=2</option>: |
2863 </para> | 2960 <screen> |
2864 | 2961 mencoder dvd://1 -ofps 24000/1001 -oac copy -o <replaceable>Harry_Potter_2.avi</replaceable> -ovc lavc \ |
2865 <para> | 2962 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=2 \ |
2866 We are now ready to do the two pass encode. Pass one: | 2963 -vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2 |
2867 | 2964 </screen> |
2868 <screen>mencoder dvd://1 -ofps 24000/1001 -oac copy -vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \ | 2965 </para> |
2869 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 \ | 2966 |
2870 -o Harry_Potter_2.avi</screen> | 2967 <para> |
2871 | 2968 The options <option>v4mv:mbd=2:trell</option> will greatly increase the |
2872 And pass two is the same, except that we specify <option>vpass=2</option>: | 2969 quality at the expense of encoding time. There is little reason to leave |
2873 | 2970 these options out when the primary goal is quality. The options |
2874 <screen>mencoder dvd://1 -ofps 24000/1001 -oac copy -vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2 -ovc lavc \ | 2971 <option>cmp=3:subcmp=3:mbcmp=3</option> select a comparison function that |
2875 -lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=2 \ | 2972 yields higher quality than the defaults. You might try experimenting with |
2876 -o Harry_Potter_2.avi</screen> | 2973 this parameter (refer to the man page for the possible values) as |
2877 </para> | 2974 different functions can have a large impact on quality depending on the |
2878 | 2975 source material. For example, if you find |
2879 <para> | 2976 <systemitem class="library">libavcodec</systemitem> produces too much |
2880 The options <option>v4mv:mbd=2:trell</option> will greatly increase the | 2977 blocky artifacting, you could try selecting the experimental NSSE as |
2881 quality at the expense of encoding time. There is little reason to leave | 2978 comparison function via <option>*cmp=10</option>. |
2882 these options out when the primary goal is quality. The options | 2979 </para> |
2883 <option>cmp=3:subcmp=3:mbcmp=3</option> select a comparison function that | 2980 |
2884 yields higher quality than the defaults. You might try experimenting with | 2981 <para> |
2885 this parameter (refer to the man page for the possible values) as | 2982 For this movie, the resulting AVI will be 138 minutes long and nearly |
2886 different functions can have a large impact on quality depending on the | 2983 3GB. And because you said that file size does not matter, this is a |
2887 source material. For example, if you find | 2984 perfectly acceptable size. However, if you had wanted it smaller, you |
2888 <systemitem class="library">libavcodec</systemitem> produces too much | 2985 could try a lower bitrate. Increasing bitrates have diminishing |
2889 blocky artifacting, you could try selecting the experimental NSSE as | 2986 returns, so while we might clearly see an improvement from 1800Kbit to |
2890 comparison function via <option>*cmp=10</option>. | 2987 2000Kbit, it might not be so noticeable above 2000Kbit. Feel |
2891 </para> | 2988 free to experiment until you are happy. |
2892 | 2989 </para> |
2893 <para> | 2990 |
2894 For this movie, the resulting AVI will be 138 minutes long and nearly | 2991 <para> |
2895 3GB. And because you said that file size does not matter, this is a | 2992 Because we passed the source video through a denoise filter, you may want |
2896 perfectly acceptable size. However, if you had wanted it smaller, you | 2993 to add some of it back during playback. This, along with the |
2897 could try a lower bitrate. Increasing bitrates have diminishing | 2994 <option>spp</option> post-processing filter, drastically improves the |
2898 returns, so while we might clearly see an improvement from 1800Kbit to | 2995 perception of quality and helps eliminate blocky artifacts in the video. |
2899 2000Kbit, it might not be so noticeable above 2000Kbit. Feel | 2996 With <application>MPlayer</application>'s <option>autoq</option> option, |
2900 free to experiment until you are happy. | 2997 you can vary the amount of post-processing done by the spp filter |
2901 </para> | 2998 depending on available CPU. Also, at this point, you may want to apply |
2902 | 2999 gamma and/or color correction to best suit your display. For example: |
2903 <para> | 3000 <screen> |
2904 Because we passed the source video through a denoise filter, you may want | 3001 mplayer <replaceable>Harry_Potter_2.avi</replaceable> -vf spp,noise=9ah:5ah,eq2=1.2 -autoq 3 |
2905 to add some of it back during playback. This, along with the | 3002 </screen> |
2906 <option>spp</option> post-processing filter, drastically improves the | |
2907 perception of quality and helps eliminate blocky artifacts in the video. | |
2908 With <application>MPlayer</application>'s <option>autoq</option> option, | |
2909 you can vary the amount of post-processing done by the spp filter | |
2910 depending on available CPU. Also, at this point, you may want to apply | |
2911 gamma and/or color correction to best suit your display. For example: | |
2912 | |
2913 <screen>mplayer Harry_Potter_2.avi -vf spp,noise=9ah:5ah,eq2=1.2 -autoq 3</screen> | |
2914 | |
2915 </para> | 3003 </para> |
2916 </sect2> | 3004 </sect2> |
2917 </sect1> | 3005 </sect1> |
2918 | 3006 |
2919 | 3007 |
3008 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
3009 | |
3010 | |
2920 <sect1 id="menc-feat-xvid"> | 3011 <sect1 id="menc-feat-xvid"> |
2921 <title>Encoding with the <systemitem class="library">Xvid</systemitem> | 3012 <title>Encoding with the <systemitem class="library">Xvid</systemitem> |
2922 codec</title> | 3013 codec</title> |
2923 <para> | 3014 |
2924 <systemitem class="library">Xvid</systemitem> is a free library for | 3015 <para> |
2925 encoding MPEG-4 ASP video streams. | 3016 <systemitem class="library">Xvid</systemitem> is a free library for |
2926 Before starting to encode, you need to <link linkend="xvid"> | 3017 encoding MPEG-4 ASP video streams. |
2927 set up <application>MEncoder</application> to support it</link>. | 3018 Before starting to encode, you need to <link linkend="xvid"> |
2928 </para> | 3019 set up <application>MEncoder</application> to support it</link>. |
2929 <para> | 3020 </para> |
2930 This guide mainly aims at featuring the same kind of information | 3021 |
2931 as x264's encoding guide. | 3022 <para> |
2932 Therefore, please begin by reading | 3023 This guide mainly aims at featuring the same kind of information |
2933 <link linkend="menc-feat-x264-encoding-options-intro">the first part</link> | 3024 as x264's encoding guide. |
2934 of that guide. | 3025 Therefore, please begin by reading |
2935 </para> | 3026 <link linkend="menc-feat-x264-encoding-options-intro">the first part</link> |
2936 | 3027 of that guide. |
3028 </para> | |
3029 | |
3030 <!-- ********** --> | |
2937 | 3031 |
2938 <sect2 id="menc-feat-xvid-intro"> | 3032 <sect2 id="menc-feat-xvid-intro"> |
2939 <title>What options should I use to get the best results?</title> | 3033 <title>What options should I use to get the best results?</title> |
2940 | 3034 |
2941 <para> | 3035 <para> |
2942 Please begin by reviewing the | 3036 Please begin by reviewing the |
2943 <systemitem class="library">Xvid</systemitem> section of | 3037 <systemitem class="library">Xvid</systemitem> section of |
2944 <application>MPlayer</application>'s man page. | 3038 <application>MPlayer</application>'s man page. |
2945 This section is intended to be a supplement to the man page. | 3039 This section is intended to be a supplement to the man page. |
2946 </para> | 3040 </para> |
2947 <para> | 3041 |
2948 The Xvid default settings are already a good tradeoff between | 3042 <para> |
2949 speed and quality, therefore you can safely stick to them if | 3043 The Xvid default settings are already a good tradeoff between |
2950 the following section puzzles you. | 3044 speed and quality, therefore you can safely stick to them if |
3045 the following section puzzles you. | |
2951 </para> | 3046 </para> |
2952 </sect2> | 3047 </sect2> |
3048 | |
3049 <!-- ********** --> | |
2953 | 3050 |
2954 <sect2 id="menc-feat-xvid-encoding-options"> | 3051 <sect2 id="menc-feat-xvid-encoding-options"> |
2955 <title>Encoding options of <systemitem class="library">Xvid</systemitem></title> | 3052 <title>Encoding options of <systemitem class="library">Xvid</systemitem></title> |
2956 | 3053 |
2957 <itemizedlist> | 3054 <itemizedlist> |
2958 <listitem><para> | 3055 <listitem><para> |
2959 <emphasis role="bold">vhq</emphasis> | 3056 <emphasis role="bold">vhq</emphasis> |
2960 This setting affects the macroblock decision algorithm, where the | 3057 This setting affects the macroblock decision algorithm, where the |
2961 higher the setting, the wiser the decision. | 3058 higher the setting, the wiser the decision. |
2962 The default setting may be safely used for every encode, while | 3059 The default setting may be safely used for every encode, while |
2963 higher settings always help PSNR but are significantly slower. | 3060 higher settings always help PSNR but are significantly slower. |
2964 Please note that a better PSNR does not necessarily mean | 3061 Please note that a better PSNR does not necessarily mean |
2965 that the picture will look better, but tells you that it is | 3062 that the picture will look better, but tells you that it is |
2966 closer to the original. | 3063 closer to the original. |
2967 Turning it off will noticeably speed up encoding; if speed is | 3064 Turning it off will noticeably speed up encoding; if speed is |
2968 critical for you, the tradeoff may be worth it. | 3065 critical for you, the tradeoff may be worth it. |
2969 </para></listitem> | 3066 </para></listitem> |
2970 | 3067 <listitem><para> |
2971 <listitem><para> | 3068 <emphasis role="bold">bvhq</emphasis> |
2972 <emphasis role="bold">bvhq</emphasis> | |
2973 This does the same job as vhq, but does it on B-frames. | 3069 This does the same job as vhq, but does it on B-frames. |
2974 It has a negligible impact on speed, and slightly improves quality | 3070 It has a negligible impact on speed, and slightly improves quality |
2975 (around +0.1dB PSNR). | 3071 (around +0.1dB PSNR). |
2976 </para></listitem> | 3072 </para></listitem> |
2977 | 3073 <listitem><para> |
2978 <listitem><para> | 3074 <emphasis role="bold">max_bframes</emphasis> |
2979 <emphasis role="bold">max_bframes</emphasis> | |
2980 A higher number of consecutive allowed B-frames usually improves | 3075 A higher number of consecutive allowed B-frames usually improves |
2981 compressibility, although it may also lead to more blocking artifacts. | 3076 compressibility, although it may also lead to more blocking artifacts. |
2982 The default setting is a good tradeoff between compressibility and | 3077 The default setting is a good tradeoff between compressibility and |
2983 quality, but you may increase it up to 3 if you are bitrate-starved. | 3078 quality, but you may increase it up to 3 if you are bitrate-starved. |
2984 You may also decrease it to 1 or 0 if you are aiming at perfect | 3079 You may also decrease it to 1 or 0 if you are aiming at perfect |
2985 quality, though in that case you should make sure your | 3080 quality, though in that case you should make sure your |
2986 target bitrate is high enough to ensure that the encoder does not | 3081 target bitrate is high enough to ensure that the encoder does not |
2987 have to increase quantizers to reach it. | 3082 have to increase quantizers to reach it. |
2988 </para></listitem> | 3083 </para></listitem> |
2989 | 3084 <listitem><para> |
2990 <listitem><para> | 3085 <emphasis role="bold">bf_threshold</emphasis> |
2991 <emphasis role="bold">bf_threshold</emphasis> | |
2992 This controls the B-frame sensitivity of the encoder, where a higher | 3086 This controls the B-frame sensitivity of the encoder, where a higher |
2993 value leads to more B-frames being used (and vice versa). | 3087 value leads to more B-frames being used (and vice versa). |
2994 This setting is to be used together with <option>max_bframes</option>; | 3088 This setting is to be used together with <option>max_bframes</option>; |
2995 if you are bitrate-starved, you should increase both | 3089 if you are bitrate-starved, you should increase both |
2996 <option>max_bframes</option> and <option>bf_threshold</option>, | 3090 <option>max_bframes</option> and <option>bf_threshold</option>, |
3005 However, if you need to be compatible with standalone players that | 3099 However, if you need to be compatible with standalone players that |
3006 only support old DivX profiles (which only supports up to 1 | 3100 only support old DivX profiles (which only supports up to 1 |
3007 consecutive B-frame), this would be your only way to | 3101 consecutive B-frame), this would be your only way to |
3008 increase compressibility through using B-frames. | 3102 increase compressibility through using B-frames. |
3009 </para></listitem> | 3103 </para></listitem> |
3010 | 3104 <listitem><para> |
3011 <listitem><para> | 3105 <emphasis role="bold">trellis</emphasis> |
3012 <emphasis role="bold">trellis</emphasis> | |
3013 Optimizes the quantization process to get an optimal tradeoff | 3106 Optimizes the quantization process to get an optimal tradeoff |
3014 between PSNR and bitrate, which allows significant bit saving. | 3107 between PSNR and bitrate, which allows significant bit saving. |
3015 These bits will in return be spent elsewhere on the video, | 3108 These bits will in return be spent elsewhere on the video, |
3016 raising overall visual quality. | 3109 raising overall visual quality. |
3017 You should always leave it on as its impact on quality is huge. | 3110 You should always leave it on as its impact on quality is huge. |
3018 Even if you are looking for speed, do not disable it until you | 3111 Even if you are looking for speed, do not disable it until you |
3019 have turned down <option>vhq</option> and all other more | 3112 have turned down <option>vhq</option> and all other more |
3020 CPU-hungry options to the minimum. | 3113 CPU-hungry options to the minimum. |
3021 </para></listitem> | 3114 </para></listitem> |
3022 | |
3023 <listitem><para> | 3115 <listitem><para> |
3024 <emphasis role="bold">hq_ac</emphasis> | 3116 <emphasis role="bold">hq_ac</emphasis> |
3025 Activates a better coefficient cost estimation method, which slightly | 3117 Activates a better coefficient cost estimation method, which slightly |
3026 reduces filesize by around 0.15 to 0.19% (which corresponds to less | 3118 reduces filesize by around 0.15 to 0.19% (which corresponds to less |
3027 than 0.01dB PSNR increase), while having a negligible impact on speed. | 3119 than 0.01dB PSNR increase), while having a negligible impact on speed. |
3028 It is therefore recommended to always leave it on. | 3120 It is therefore recommended to always leave it on. |
3029 </para></listitem> | 3121 </para></listitem> |
3030 | |
3031 <listitem><para> | 3122 <listitem><para> |
3032 <emphasis role="bold">cartoon</emphasis> | 3123 <emphasis role="bold">cartoon</emphasis> |
3033 Designed to better encode cartoon content, and has no impact on | 3124 Designed to better encode cartoon content, and has no impact on |
3034 speed as it just tunes the mode decision heuristics for this type | 3125 speed as it just tunes the mode decision heuristics for this type |
3035 of content. | 3126 of content. |
3036 </para></listitem> | 3127 </para></listitem> |
3037 | 3128 <listitem> |
3038 <listitem><para> | 3129 <para> |
3039 <emphasis role="bold">me_quality</emphasis> | 3130 <emphasis role="bold">me_quality</emphasis> |
3040 This setting is to control the precision of the motion estimation. | 3131 This setting is to control the precision of the motion estimation. |
3041 The higher <option>me_quality</option>, the more | 3132 The higher <option>me_quality</option>, the more |
3042 precise the estimation of the original motion will be, and the | 3133 precise the estimation of the original motion will be, and the |
3043 better the resulting clip will capture the original motion. | 3134 better the resulting clip will capture the original motion. |
3044 </para> | 3135 </para> |
3045 <para> | 3136 <para> |
3046 The default setting is best in all cases; | 3137 The default setting is best in all cases; |
3047 thus it is not recommended to turn it down unless you are | 3138 thus it is not recommended to turn it down unless you are |
3048 really looking for speed, as all the bits saved by a good motion | 3139 really looking for speed, as all the bits saved by a good motion |
3049 estimation would be spent elsewhere, raising overall quality. | 3140 estimation would be spent elsewhere, raising overall quality. |
3050 Therefore, do not go any lower than 5, and even that only as a last | 3141 Therefore, do not go any lower than 5, and even that only as a last |
3051 resort. | 3142 resort. |
3052 </para></listitem> | 3143 </para> |
3053 | 3144 </listitem> |
3054 <listitem><para> | 3145 <listitem><para> |
3055 <emphasis role="bold">chroma_me</emphasis> | 3146 <emphasis role="bold">chroma_me</emphasis> |
3056 Improves motion estimation by also taking the chroma (color) | 3147 Improves motion estimation by also taking the chroma (color) |
3057 information into account, whereas <option>me_quality</option> | 3148 information into account, whereas <option>me_quality</option> |
3058 alone only uses luma (grayscale). | 3149 alone only uses luma (grayscale). |
3059 This slows down encoding by 5-10% but improves visual quality | 3150 This slows down encoding by 5-10% but improves visual quality |
3060 quite a bit by reducing blocking effects and reduces filesize by | 3151 quite a bit by reducing blocking effects and reduces filesize by |
3061 around 1.3%. | 3152 around 1.3%. |
3062 If you are looking for speed, you should disable this option before | 3153 If you are looking for speed, you should disable this option before |
3063 starting to consider reducing <option>me_quality</option>. | 3154 starting to consider reducing <option>me_quality</option>. |
3064 </para></listitem> | 3155 </para></listitem> |
3065 | |
3066 <listitem><para> | 3156 <listitem><para> |
3067 <emphasis role="bold">chroma_opt</emphasis> | 3157 <emphasis role="bold">chroma_opt</emphasis> |
3068 Is intended to increase chroma image quality around pure | 3158 Is intended to increase chroma image quality around pure |
3069 white/black edges, rather than improving compression. | 3159 white/black edges, rather than improving compression. |
3070 This can help to reduce the "red stairs" effect. | 3160 This can help to reduce the "red stairs" effect. |
3071 </para></listitem> | 3161 </para></listitem> |
3072 | |
3073 <listitem><para> | 3162 <listitem><para> |
3074 <emphasis role="bold">lumi_mask</emphasis> | 3163 <emphasis role="bold">lumi_mask</emphasis> |
3075 Tries to give less bitrate to part of the picture that the | 3164 Tries to give less bitrate to part of the picture that the |
3076 human eye cannot see very well, which should allow the encoder | 3165 human eye cannot see very well, which should allow the encoder |
3077 to spend the saved bits on more important parts of the picture. | 3166 to spend the saved bits on more important parts of the picture. |
3078 The quality of the encode yielded by this option highly depends | 3167 The quality of the encode yielded by this option highly depends |
3079 on personal preferences and on the type and monitor settings | 3168 on personal preferences and on the type and monitor settings |
3080 used to watch it (typically, it will not look as good if it is | 3169 used to watch it (typically, it will not look as good if it is |
3081 bright or if it is a TFT monitor). | 3170 bright or if it is a TFT monitor). |
3082 </para></listitem> | 3171 </para></listitem> |
3083 | 3172 <listitem> |
3084 <listitem><para> | 3173 <para> |
3085 <emphasis role="bold">qpel</emphasis> | 3174 <emphasis role="bold">qpel</emphasis> |
3086 Raise the number of candidate motion vectors by increasing | 3175 Raise the number of candidate motion vectors by increasing |
3087 the precision of the motion estimation from halfpel to | 3176 the precision of the motion estimation from halfpel to |
3088 quarterpel. | 3177 quarterpel. |
3089 The idea is to find better motion vectors which will in return | 3178 The idea is to find better motion vectors which will in return |
3090 reduce bitrate (hence increasing quality). | 3179 reduce bitrate (hence increasing quality). |
3091 However, motion vectors with quarterpel precision require a | 3180 However, motion vectors with quarterpel precision require a |
3092 few extra bits to code, but the candidate vectors do not always | 3181 few extra bits to code, but the candidate vectors do not always |
3093 give (much) better results. | 3182 give (much) better results. |
3094 Quite often, the codec still spends bits on the extra precision, | 3183 Quite often, the codec still spends bits on the extra precision, |
3095 but little or no extra quality is gained in return. | 3184 but little or no extra quality is gained in return. |
3096 Unfortunately, there is no way to foresee the possible gains of | 3185 Unfortunately, there is no way to foresee the possible gains of |
3097 <option>qpel</option>, so you need to actually encode with and | 3186 <option>qpel</option>, so you need to actually encode with and |
3098 without it to know for sure. | 3187 without it to know for sure. |
3099 </para><para> | 3188 </para> |
3100 <option>qpel</option> can be almost double encoding time, and | 3189 <para> |
3101 requires as much as 25% more processing power to decode. | 3190 <option>qpel</option> can be almost double encoding time, and |
3102 It is not supported by all standalone players. | 3191 requires as much as 25% more processing power to decode. |
3103 </para></listitem> | 3192 It is not supported by all standalone players. |
3104 | 3193 </para> |
3194 </listitem> | |
3105 <listitem><para> | 3195 <listitem><para> |
3106 <emphasis role="bold">gmc</emphasis> | 3196 <emphasis role="bold">gmc</emphasis> |
3107 Tries to save bits on panning scenes by using a single motion | 3197 Tries to save bits on panning scenes by using a single motion |
3108 vector for the whole frame. | 3198 vector for the whole frame. |
3109 This almost always raises PSNR, but significantly slows down | 3199 This almost always raises PSNR, but significantly slows down |
3110 encoding (as well as decoding). | 3200 encoding (as well as decoding). |
3111 Therefore, you should only use it when you have turned | 3201 Therefore, you should only use it when you have turned |
3112 <option>vhq</option> to the maximum. | 3202 <option>vhq</option> to the maximum. |
3113 <systemitem class="library">Xvid</systemitem>'s GMC is more | 3203 <systemitem class="library">Xvid</systemitem>'s GMC is more |
3114 sophisticated than DivX's, but is only supported by few | 3204 sophisticated than DivX's, but is only supported by few |
3115 standalone players. | 3205 standalone players. |
3116 </para></listitem> | 3206 </para></listitem> |
3117 | |
3118 </itemizedlist> | 3207 </itemizedlist> |
3119 </sect2> | 3208 </sect2> |
3120 | 3209 |
3210 <!-- ********** --> | |
3211 | |
3121 <sect2 id="menc-feat-xvid-encoding-profiles"> | 3212 <sect2 id="menc-feat-xvid-encoding-profiles"> |
3122 <title>Encoding profiles</title> | 3213 <title>Encoding profiles</title> |
3123 <para> | 3214 |
3124 Xvid supports encoding profiles through the <option>profile</option> option, | 3215 <para> |
3125 which are used to impose restrictions on the properties of the Xvid video | 3216 Xvid supports encoding profiles through the <option>profile</option> option, |
3126 stream such that it will be playable on anything which supports the | 3217 which are used to impose restrictions on the properties of the Xvid video |
3127 chosen profile. | 3218 stream such that it will be playable on anything which supports the |
3128 The restrictions relate to resolutions, bitrates and certain MPEG-4 | 3219 chosen profile. |
3129 features. | 3220 The restrictions relate to resolutions, bitrates and certain MPEG-4 |
3130 The following table shows what each profile supports. | 3221 features. |
3131 </para> | 3222 The following table shows what each profile supports. |
3223 </para> | |
3224 | |
3132 <informaltable> | 3225 <informaltable> |
3133 <tgroup cols="16" align="center"> | 3226 <tgroup cols="16" align="center"> |
3134 <colspec colnum="1" colname="col1"/> | 3227 <colspec colnum="1" colname="col1"/> |
3135 <colspec colnum="2" colname="col2"/> | 3228 <colspec colnum="2" colname="col2"/> |
3136 <colspec colnum="3" colname="col3"/> | 3229 <colspec colnum="3" colname="col3"/> |
3149 <colspec colnum="16" colname="col16"/> | 3242 <colspec colnum="16" colname="col16"/> |
3150 <colspec colnum="17" colname="col17"/> | 3243 <colspec colnum="17" colname="col17"/> |
3151 <spanspec spanname="spa2-5" namest="col2" nameend="col5"/> | 3244 <spanspec spanname="spa2-5" namest="col2" nameend="col5"/> |
3152 <spanspec spanname="spa6-11" namest="col6" nameend="col11"/> | 3245 <spanspec spanname="spa6-11" namest="col6" nameend="col11"/> |
3153 <spanspec spanname="spa12-17" namest="col12" nameend="col17"/> | 3246 <spanspec spanname="spa12-17" namest="col12" nameend="col17"/> |
3154 <tbody> | 3247 <tbody> |
3155 <row> | 3248 <row> |
3156 <entry></entry> | 3249 <entry></entry> |
3157 <entry spanname="spa2-5">Simple</entry> | 3250 <entry spanname="spa2-5">Simple</entry> |
3158 <entry spanname="spa6-11">Advanced Simple</entry> | 3251 <entry spanname="spa6-11">Advanced Simple</entry> |
3159 <entry spanname="spa12-17">DivX</entry> | 3252 <entry spanname="spa12-17">DivX</entry> |
3160 </row> | 3253 </row> |
3161 <row> | 3254 <row> |
3162 <entry>Profile name</entry> | 3255 <entry>Profile name</entry> |
3163 <entry>0</entry> | 3256 <entry>0</entry> |
3164 <entry>1</entry> | 3257 <entry>1</entry> |
3165 <entry>2</entry> | 3258 <entry>2</entry> |
3166 <entry>3</entry> | 3259 <entry>3</entry> |
3167 <entry>0</entry> | 3260 <entry>0</entry> |
3168 <entry>1</entry> | 3261 <entry>1</entry> |
3169 <entry>2</entry> | 3262 <entry>2</entry> |
3170 <entry>3</entry> | 3263 <entry>3</entry> |
3171 <entry>4</entry> | 3264 <entry>4</entry> |
3172 <entry>5</entry> | 3265 <entry>5</entry> |
3173 <entry>Handheld</entry> | 3266 <entry>Handheld</entry> |
3174 <entry>Portable NTSC</entry> | 3267 <entry>Portable NTSC</entry> |
3175 <entry>Portable PAL</entry> | 3268 <entry>Portable PAL</entry> |
3176 <entry>Home Theater NTSC</entry> | 3269 <entry>Home Theater NTSC</entry> |
3177 <entry>Home Theater PAL</entry> | 3270 <entry>Home Theater PAL</entry> |
3178 <entry>HDTV</entry> | 3271 <entry>HDTV</entry> |
3179 </row> | 3272 </row> |
3180 <row> | 3273 <row> |
3181 <entry>Width [pixels]</entry> | 3274 <entry>Width [pixels]</entry> |
3182 <entry>176</entry> | 3275 <entry>176</entry> |
3183 <entry>176</entry> | 3276 <entry>176</entry> |
3184 <entry>352</entry> | 3277 <entry>352</entry> |
3185 <entry>352</entry> | 3278 <entry>352</entry> |
3186 <entry>176</entry> | 3279 <entry>176</entry> |
3187 <entry>176</entry> | 3280 <entry>176</entry> |
3188 <entry>352</entry> | 3281 <entry>352</entry> |
3189 <entry>352</entry> | 3282 <entry>352</entry> |
3190 <entry>352</entry> | 3283 <entry>352</entry> |
3191 <entry>720</entry> | 3284 <entry>720</entry> |
3192 <entry>176</entry> | 3285 <entry>176</entry> |
3193 <entry>352</entry> | 3286 <entry>352</entry> |
3194 <entry>352</entry> | 3287 <entry>352</entry> |
3195 <entry>720</entry> | 3288 <entry>720</entry> |
3196 <entry>720</entry> | 3289 <entry>720</entry> |
3197 <entry>1280</entry> | 3290 <entry>1280</entry> |
3198 </row> | 3291 </row> |
3199 <row> | 3292 <row> |
3200 <entry>Height [pixels]</entry> | 3293 <entry>Height [pixels]</entry> |
3201 <entry>144</entry> | 3294 <entry>144</entry> |
3202 <entry>144</entry> | 3295 <entry>144</entry> |
3203 <entry>288</entry> | 3296 <entry>288</entry> |
3204 <entry>288</entry> | 3297 <entry>288</entry> |
3205 <entry>144</entry> | 3298 <entry>144</entry> |
3206 <entry>144</entry> | 3299 <entry>144</entry> |
3207 <entry>288</entry> | 3300 <entry>288</entry> |
3208 <entry>288</entry> | 3301 <entry>288</entry> |
3209 <entry>576</entry> | 3302 <entry>576</entry> |
3210 <entry>576</entry> | 3303 <entry>576</entry> |
3211 <entry>144</entry> | 3304 <entry>144</entry> |
3212 <entry>240</entry> | 3305 <entry>240</entry> |
3213 <entry>288</entry> | 3306 <entry>288</entry> |
3214 <entry>480</entry> | 3307 <entry>480</entry> |
3215 <entry>576</entry> | 3308 <entry>576</entry> |
3216 <entry>720</entry> | 3309 <entry>720</entry> |
3217 </row> | 3310 </row> |
3218 <row> | 3311 <row> |
3219 <entry>Frame rate [fps]</entry> | 3312 <entry>Frame rate [fps]</entry> |
3220 <entry>15</entry> | 3313 <entry>15</entry> |
3221 <entry>15</entry> | 3314 <entry>15</entry> |
3222 <entry>15</entry> | 3315 <entry>15</entry> |
3223 <entry>15</entry> | 3316 <entry>15</entry> |
3224 <entry>30</entry> | 3317 <entry>30</entry> |
3225 <entry>30</entry> | 3318 <entry>30</entry> |
3226 <entry>15</entry> | 3319 <entry>15</entry> |
3227 <entry>30</entry> | 3320 <entry>30</entry> |
3228 <entry>30</entry> | 3321 <entry>30</entry> |
3229 <entry>30</entry> | 3322 <entry>30</entry> |
3230 <entry>15</entry> | 3323 <entry>15</entry> |
3231 <entry>30</entry> | 3324 <entry>30</entry> |
3232 <entry>25</entry> | 3325 <entry>25</entry> |
3233 <entry>30</entry> | 3326 <entry>30</entry> |
3234 <entry>25</entry> | 3327 <entry>25</entry> |
3235 <entry>30</entry> | 3328 <entry>30</entry> |
3236 </row> | 3329 </row> |
3237 <row> | 3330 <row> |
3238 <entry>Max average bitrate [kbps]</entry> | 3331 <entry>Max average bitrate [kbps]</entry> |
3239 <entry>64</entry> | 3332 <entry>64</entry> |
3240 <entry>64</entry> | 3333 <entry>64</entry> |
3241 <entry>128</entry> | 3334 <entry>128</entry> |
3242 <entry>384</entry> | 3335 <entry>384</entry> |
3243 <entry>128</entry> | 3336 <entry>128</entry> |
3244 <entry>128</entry> | 3337 <entry>128</entry> |
3245 <entry>384</entry> | 3338 <entry>384</entry> |
3246 <entry>768</entry> | 3339 <entry>768</entry> |
3247 <entry>3000</entry> | 3340 <entry>3000</entry> |
3248 <entry>8000</entry> | 3341 <entry>8000</entry> |
3249 <entry>537.6</entry> | 3342 <entry>537.6</entry> |
3250 <entry>4854</entry> | 3343 <entry>4854</entry> |
3251 <entry>4854</entry> | 3344 <entry>4854</entry> |
3252 <entry>4854</entry> | 3345 <entry>4854</entry> |
3253 <entry>4854</entry> | 3346 <entry>4854</entry> |
3254 <entry>9708.4</entry> | 3347 <entry>9708.4</entry> |
3255 </row> | 3348 </row> |
3256 <row> | 3349 <row> |
3257 <entry>Peak average bitrate over 3 secs [kbps]</entry> | 3350 <entry>Peak average bitrate over 3 secs [kbps]</entry> |
3258 <entry></entry> | 3351 <entry></entry> |
3259 <entry></entry> | 3352 <entry></entry> |
3260 <entry></entry> | 3353 <entry></entry> |
3261 <entry></entry> | 3354 <entry></entry> |
3262 <entry></entry> | 3355 <entry></entry> |
3263 <entry></entry> | 3356 <entry></entry> |
3264 <entry></entry> | 3357 <entry></entry> |
3265 <entry></entry> | 3358 <entry></entry> |
3266 <entry></entry> | 3359 <entry></entry> |
3267 <entry></entry> | 3360 <entry></entry> |
3268 <entry>800</entry> | 3361 <entry>800</entry> |
3269 <entry>8000</entry> | 3362 <entry>8000</entry> |
3270 <entry>8000</entry> | 3363 <entry>8000</entry> |
3271 <entry>8000</entry> | 3364 <entry>8000</entry> |
3272 <entry>8000</entry> | 3365 <entry>8000</entry> |
3273 <entry>16000</entry> | 3366 <entry>16000</entry> |
3274 </row> | 3367 </row> |
3275 <row> | 3368 <row> |
3276 <entry>Max. B-frames</entry> | 3369 <entry>Max. B-frames</entry> |
3277 <entry>0</entry> | 3370 <entry>0</entry> |
3278 <entry>0</entry> | 3371 <entry>0</entry> |
3279 <entry>0</entry> | 3372 <entry>0</entry> |
3280 <entry>0</entry> | 3373 <entry>0</entry> |
3281 <entry></entry> | 3374 <entry></entry> |
3282 <entry></entry> | 3375 <entry></entry> |
3283 <entry></entry> | 3376 <entry></entry> |
3284 <entry></entry> | 3377 <entry></entry> |
3285 <entry></entry> | 3378 <entry></entry> |
3286 <entry></entry> | 3379 <entry></entry> |
3287 <entry>0</entry> | 3380 <entry>0</entry> |
3288 <entry>1</entry> | 3381 <entry>1</entry> |
3289 <entry>1</entry> | 3382 <entry>1</entry> |
3290 <entry>1</entry> | 3383 <entry>1</entry> |
3291 <entry>1</entry> | 3384 <entry>1</entry> |
3292 <entry>2</entry> | 3385 <entry>2</entry> |
3293 </row> | 3386 </row> |
3294 <row> | 3387 <row> |
3295 <entry>MPEG quantization</entry> | 3388 <entry>MPEG quantization</entry> |
3296 <entry></entry> | 3389 <entry></entry> |
3297 <entry></entry> | 3390 <entry></entry> |
3298 <entry></entry> | 3391 <entry></entry> |
3299 <entry></entry> | 3392 <entry></entry> |
3300 <entry>X</entry> | 3393 <entry>X</entry> |
3301 <entry>X</entry> | 3394 <entry>X</entry> |
3302 <entry>X</entry> | 3395 <entry>X</entry> |
3303 <entry>X</entry> | 3396 <entry>X</entry> |
3304 <entry>X</entry> | 3397 <entry>X</entry> |
3305 <entry>X</entry> | 3398 <entry>X</entry> |
3306 <entry></entry> | 3399 <entry></entry> |
3307 <entry></entry> | 3400 <entry></entry> |
3308 <entry></entry> | 3401 <entry></entry> |
3309 <entry></entry> | 3402 <entry></entry> |
3310 <entry></entry> | 3403 <entry></entry> |
3311 <entry></entry> | 3404 <entry></entry> |
3312 </row> | 3405 </row> |
3313 <row> | 3406 <row> |
3314 <entry>Adaptive quantization</entry> | 3407 <entry>Adaptive quantization</entry> |
3315 <entry></entry> | 3408 <entry></entry> |
3316 <entry></entry> | 3409 <entry></entry> |
3317 <entry></entry> | 3410 <entry></entry> |
3318 <entry></entry> | 3411 <entry></entry> |
3319 <entry>X</entry> | 3412 <entry>X</entry> |
3320 <entry>X</entry> | 3413 <entry>X</entry> |
3321 <entry>X</entry> | 3414 <entry>X</entry> |
3322 <entry>X</entry> | 3415 <entry>X</entry> |
3323 <entry>X</entry> | 3416 <entry>X</entry> |
3324 <entry>X</entry> | 3417 <entry>X</entry> |
3325 <entry>X</entry> | 3418 <entry>X</entry> |
3326 <entry>X</entry> | 3419 <entry>X</entry> |
3327 <entry>X</entry> | 3420 <entry>X</entry> |
3328 <entry>X</entry> | 3421 <entry>X</entry> |
3329 <entry>X</entry> | 3422 <entry>X</entry> |
3330 <entry>X</entry> | 3423 <entry>X</entry> |
3331 </row> | 3424 </row> |
3332 <row> | 3425 <row> |
3333 <entry>Interlaced encoding</entry> | 3426 <entry>Interlaced encoding</entry> |
3334 <entry></entry> | 3427 <entry></entry> |
3335 <entry></entry> | 3428 <entry></entry> |
3336 <entry></entry> | 3429 <entry></entry> |
3337 <entry></entry> | 3430 <entry></entry> |
3338 <entry>X</entry> | 3431 <entry>X</entry> |
3339 <entry>X</entry> | 3432 <entry>X</entry> |
3340 <entry>X</entry> | 3433 <entry>X</entry> |
3341 <entry>X</entry> | 3434 <entry>X</entry> |
3342 <entry>X</entry> | 3435 <entry>X</entry> |
3343 <entry>X</entry> | 3436 <entry>X</entry> |
3344 <entry></entry> | 3437 <entry></entry> |
3345 <entry></entry> | 3438 <entry></entry> |
3346 <entry></entry> | 3439 <entry></entry> |
3347 <entry>X</entry> | 3440 <entry>X</entry> |
3348 <entry>X</entry> | 3441 <entry>X</entry> |
3349 <entry>X</entry> | 3442 <entry>X</entry> |
3350 </row> | 3443 </row> |
3351 <row> | 3444 <row> |
3352 <entry>Quaterpixel</entry> | 3445 <entry>Quaterpixel</entry> |
3353 <entry></entry> | 3446 <entry></entry> |
3354 <entry></entry> | 3447 <entry></entry> |
3355 <entry></entry> | 3448 <entry></entry> |
3356 <entry></entry> | 3449 <entry></entry> |
3357 <entry>X</entry> | 3450 <entry>X</entry> |
3358 <entry>X</entry> | 3451 <entry>X</entry> |
3359 <entry>X</entry> | 3452 <entry>X</entry> |
3360 <entry>X</entry> | 3453 <entry>X</entry> |
3361 <entry>X</entry> | 3454 <entry>X</entry> |
3362 <entry>X</entry> | 3455 <entry>X</entry> |
3363 <entry></entry> | 3456 <entry></entry> |
3364 <entry></entry> | 3457 <entry></entry> |
3365 <entry></entry> | 3458 <entry></entry> |
3366 <entry></entry> | 3459 <entry></entry> |
3367 <entry></entry> | 3460 <entry></entry> |
3368 <entry></entry> | 3461 <entry></entry> |
3369 </row> | 3462 </row> |
3370 <row> | 3463 <row> |
3371 <entry>Global motion compensation</entry> | 3464 <entry>Global motion compensation</entry> |
3372 <entry></entry> | 3465 <entry></entry> |
3373 <entry></entry> | 3466 <entry></entry> |
3374 <entry></entry> | 3467 <entry></entry> |
3375 <entry></entry> | 3468 <entry></entry> |
3376 <entry>X</entry> | 3469 <entry>X</entry> |
3377 <entry>X</entry> | 3470 <entry>X</entry> |
3378 <entry>X</entry> | 3471 <entry>X</entry> |
3379 <entry>X</entry> | 3472 <entry>X</entry> |
3380 <entry>X</entry> | 3473 <entry>X</entry> |
3381 <entry>X</entry> | 3474 <entry>X</entry> |
3382 <entry></entry> | 3475 <entry></entry> |
3383 <entry></entry> | 3476 <entry></entry> |
3384 <entry></entry> | 3477 <entry></entry> |
3385 <entry></entry> | 3478 <entry></entry> |
3386 <entry></entry> | 3479 <entry></entry> |
3387 <entry></entry> | 3480 <entry></entry> |
3388 </row> | 3481 </row> |
3389 </tbody> | 3482 </tbody> |
3390 </tgroup> | 3483 </tgroup> |
3391 </informaltable> | 3484 </informaltable> |
3392 </sect2> | 3485 </sect2> |
3393 | 3486 |
3487 <!-- ********** --> | |
3488 | |
3394 <sect2 id="menc-feat-xvid-example-settings"> | 3489 <sect2 id="menc-feat-xvid-example-settings"> |
3395 <title>Encoding setting examples</title> | 3490 <title>Encoding setting examples</title> |
3396 | 3491 |
3397 <para> | 3492 <para> |
3398 The following settings are examples of different encoding | 3493 The following settings are examples of different encoding |
3399 option combinations that affect the speed vs quality tradeoff | 3494 option combinations that affect the speed vs quality tradeoff |
3400 at the same target bitrate. | 3495 at the same target bitrate. |
3401 </para> | 3496 </para> |
3402 | 3497 |
3403 <para> | 3498 <para> |
3404 All the encoding settings were tested on a 720x448 @30000/1001 fps | 3499 All the encoding settings were tested on a 720x448 @30000/1001 fps |
3405 video sample, the target bitrate was 900kbps, and the machine was an | 3500 video sample, the target bitrate was 900kbps, and the machine was an |
3406 AMD-64 3400+ at 2400 MHz in 64 bits mode. | 3501 AMD-64 3400+ at 2400 MHz in 64 bits mode. |
3407 Each encoding setting features the measured encoding speed (in | 3502 Each encoding setting features the measured encoding speed (in |
3408 frames per second) and the PSNR loss (in dB) compared to the "very | 3503 frames per second) and the PSNR loss (in dB) compared to the "very |
3409 high quality" setting. | 3504 high quality" setting. |
3410 Please understand that depending on your source, your machine type | 3505 Please understand that depending on your source, your machine type |
3411 and development advancements, you may get very different results. | 3506 and development advancements, you may get very different results. |
3412 </para> | 3507 </para> |
3413 | 3508 |
3414 <para> | |
3415 <informaltable frame="all"> | 3509 <informaltable frame="all"> |
3416 <tgroup cols="4"> | 3510 <tgroup cols="4"> |
3417 <thead> | 3511 <thead> |
3418 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> | 3512 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> |
3419 </thead> | 3513 </thead> |
3443 <entry>-1.48dB</entry> | 3537 <entry>-1.48dB</entry> |
3444 </row> | 3538 </row> |
3445 </tbody> | 3539 </tbody> |
3446 </tgroup> | 3540 </tgroup> |
3447 </informaltable> | 3541 </informaltable> |
3448 </para> | |
3449 </sect2> | 3542 </sect2> |
3450 | |
3451 </sect1> | 3543 </sect1> |
3452 | 3544 |
3545 | |
3546 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
3547 | |
3548 | |
3453 <sect1 id="menc-feat-x264"> | 3549 <sect1 id="menc-feat-x264"> |
3454 <title>Encoding with the <systemitem class="library">x264</systemitem> codec</title> | 3550 <title>Encoding with the |
3455 <para> | 3551 <systemitem class="library">x264</systemitem> codec</title> |
3456 <systemitem class="library">x264</systemitem> is a free library for | 3552 |
3457 encoding H.264/AVC video streams. | 3553 <para> |
3458 Before starting to encode, you need to <link linkend="codec-x264-encode"> | 3554 <systemitem class="library">x264</systemitem> is a free library for |
3459 set up <application>MEncoder</application> to support it</link>. | 3555 encoding H.264/AVC video streams. |
3460 </para> | 3556 Before starting to encode, you need to |
3557 <link linkend="codec-x264-encode">set up <application>MEncoder</application> to support it</link>. | |
3558 </para> | |
3559 | |
3560 <!-- ********** --> | |
3461 | 3561 |
3462 <sect2 id="menc-feat-x264-encoding-options"> | 3562 <sect2 id="menc-feat-x264-encoding-options"> |
3463 <title>Encoding options of x264</title> | 3563 <title>Encoding options of x264</title> |
3464 | 3564 |
3465 <para> | 3565 <para> |
3466 Please begin by reviewing the | 3566 Please begin by reviewing the |
3467 <systemitem class="library">x264</systemitem> section of | 3567 <systemitem class="library">x264</systemitem> section of |
3468 <application>MPlayer</application>'s man page. | 3568 <application>MPlayer</application>'s man page. |
3469 This section is intended to be a supplement to the man page. | 3569 This section is intended to be a supplement to the man page. |
3470 Here you will find quick hints about which options are most | 3570 Here you will find quick hints about which options are most |
3471 likely to interest most people. The man page is more terse, | 3571 likely to interest most people. The man page is more terse, |
3472 but also more exhaustive, and it sometimes offers much better | 3572 but also more exhaustive, and it sometimes offers much better |
3473 technical detail. | 3573 technical detail. |
3474 </para> | 3574 </para> |
3575 | |
3475 | 3576 |
3476 <sect3 id="menc-feat-x264-encoding-options-intro"> | 3577 <sect3 id="menc-feat-x264-encoding-options-intro"> |
3477 <title>Introduction</title> | 3578 <title>Introduction</title> |
3478 <para>This guide considers two major categories of encoding options:</para> | 3579 |
3580 <para> | |
3581 This guide considers two major categories of encoding options: | |
3582 </para> | |
3479 | 3583 |
3480 <orderedlist> | 3584 <orderedlist> |
3481 <listitem><para>Options which mainly trade off encoding time vs. quality | 3585 <listitem><para> |
3482 </para></listitem> | 3586 Options which mainly trade off encoding time vs. quality |
3483 <listitem><para>Options which may be useful for fulfilling various personal | 3587 </para></listitem> |
3484 preferences and special requirements</para></listitem> | 3588 <listitem><para> |
3589 Options which may be useful for fulfilling various personal | |
3590 preferences and special requirements | |
3591 </para></listitem> | |
3485 </orderedlist> | 3592 </orderedlist> |
3486 | 3593 |
3487 <para> | 3594 <para> |
3488 Ultimately, only you can decide which options are best for your | 3595 Ultimately, only you can decide which options are best for your |
3489 purposes. The decision for the first class of options is the simplest: | 3596 purposes. The decision for the first class of options is the simplest: |
3490 you only have to decide whether you think the quality differences | 3597 you only have to decide whether you think the quality differences |
3491 justify the speed differences. For the second class of options, | 3598 justify the speed differences. For the second class of options, |
3492 preferences may be far more subjective, and more factors may be | 3599 preferences may be far more subjective, and more factors may be |
3493 involved. Note that some of the "personal preferences and special | 3600 involved. Note that some of the "personal preferences and special |
3494 requirements" options can still have large impacts on speed or quality, | 3601 requirements" options can still have large impacts on speed or quality, |
3495 but that is not what they are primarily useful for. A couple of the | 3602 but that is not what they are primarily useful for. A couple of the |
3496 "personal preference" options may even cause changes that look better | 3603 "personal preference" options may even cause changes that look better |
3497 to some people, but look worse to others. | 3604 to some people, but look worse to others. |
3498 </para> | 3605 </para> |
3499 | 3606 |
3500 <para> | 3607 <para> |
3501 Before continuing, you need to understand that this guide uses only one | 3608 Before continuing, you need to understand that this guide uses only one |
3502 quality metric: global PSNR. | 3609 quality metric: global PSNR. |
3503 For a brief explanation of what PSNR is, see | 3610 For a brief explanation of what PSNR is, see |
3504 <ulink url="http://en.wikipedia.org/wiki/PSNR">the Wikipedia article on PSNR</ulink>. | 3611 <ulink url="http://en.wikipedia.org/wiki/PSNR">the Wikipedia article on PSNR</ulink>. |
3505 Global PSNR is the last PSNR number reported when you include | 3612 Global PSNR is the last PSNR number reported when you include |
3506 the <option>psnr</option> option in <option>x264encopts</option>. | 3613 the <option>psnr</option> option in <option>x264encopts</option>. |
3507 Any time you read a claim about PSNR, one of the assumptions | 3614 Any time you read a claim about PSNR, one of the assumptions |
3508 behind the claim is that equal bitrates are used. | 3615 behind the claim is that equal bitrates are used. |
3509 </para> | 3616 </para> |
3510 | 3617 |
3511 <para> | 3618 <para> |
3512 Nearly all of this guide's comments assume you are using | 3619 Nearly all of this guide's comments assume you are using two pass. |
3513 two pass. | 3620 When comparing options, there are two major reasons for using |
3514 When comparing options, there are two major reasons for using | 3621 two pass encoding. |
3515 two pass encoding. | 3622 First, using two pass often gains around 1dB PSNR, which is a |
3516 First, using two pass often gains around 1dB PSNR, which is a | 3623 very big difference. |
3517 very big difference. | 3624 Secondly, testing options by doing direct quality comparisons |
3518 Secondly, testing options by doing direct quality comparisons | 3625 with one pass encodes introduces a major confounding |
3519 with one pass encodes introduces a major confounding | 3626 factor: bitrate often varies significantly with each encode. |
3520 factor: bitrate often varies significantly with each encode. | 3627 It is not always easy to tell whether quality changes are due |
3521 It is not always easy to tell whether quality changes are due | 3628 mainly to changed options, or if they mostly reflect essentially |
3522 mainly to changed options, or if they mostly reflect essentially | 3629 random differences in the achieved bitrate. |
3523 random differences in the achieved bitrate. | 3630 </para> |
3524 </para> | |
3525 | |
3526 </sect3> | 3631 </sect3> |
3632 | |
3527 | 3633 |
3528 <sect3 id="menc-feat-x264-encoding-options-speedvquality"> | 3634 <sect3 id="menc-feat-x264-encoding-options-speedvquality"> |
3529 <title>Options which primarily affect speed and quality</title> | 3635 <title>Options which primarily affect speed and quality</title> |
3530 | 3636 |
3531 <itemizedlist> | 3637 <itemizedlist> |
3532 <listitem><para> | 3638 <listitem> |
3639 <para> | |
3533 <emphasis role="bold">subq</emphasis>: | 3640 <emphasis role="bold">subq</emphasis>: |
3534 Of the options which allow you to trade off speed for quality, | 3641 Of the options which allow you to trade off speed for quality, |
3535 <option>subq</option> and <option>frameref</option> (see below) are usually | 3642 <option>subq</option> and <option>frameref</option> (see below) are usually |
3536 by far the most important. | 3643 by far the most important. |
3537 If you are interested in tweaking either speed or quality, these | 3644 If you are interested in tweaking either speed or quality, these |
3546 <option>subq</option>'s effect on PSNR seems fairly constant | 3653 <option>subq</option>'s effect on PSNR seems fairly constant |
3547 regardless of the number of reference frames. | 3654 regardless of the number of reference frames. |
3548 Typically, <option>subq=5</option> achieves 0.2-0.5 dB higher global | 3655 Typically, <option>subq=5</option> achieves 0.2-0.5 dB higher global |
3549 PSNR in comparison <option>subq=1</option>. | 3656 PSNR in comparison <option>subq=1</option>. |
3550 This is usually enough to be visible. | 3657 This is usually enough to be visible. |
3551 </para> | 3658 </para> |
3552 <para> | 3659 <para> |
3553 <option>subq=6</option> is the slowest, highest quality mode. | 3660 <option>subq=6</option> is the slowest, highest quality mode. |
3554 In comparison to <option>subq=5</option>, it usually gains 0.1-0.4 dB | 3661 In comparison to <option>subq=5</option>, it usually gains 0.1-0.4 dB |
3555 global PSNR with speed costs varying from 25%-100%. | 3662 global PSNR with speed costs varying from 25%-100%. |
3556 Unlike other levels of <option>subq</option>, the behavior of | 3663 Unlike other levels of <option>subq</option>, the behavior of |
3557 <option>subq=6</option> does not depend much on <option>frameref</option> | 3664 <option>subq=6</option> does not depend much on <option>frameref</option> |
3559 </option> depends mostly upon the number of B-frames used. In normal | 3666 </option> depends mostly upon the number of B-frames used. In normal |
3560 usage, this means <option>subq=6</option> has a large impact on both speed | 3667 usage, this means <option>subq=6</option> has a large impact on both speed |
3561 and quality in complex, high motion scenes, but it may not have much effect | 3668 and quality in complex, high motion scenes, but it may not have much effect |
3562 in low-motion scenes. Note that it is still recommended to always set | 3669 in low-motion scenes. Note that it is still recommended to always set |
3563 <option>bframes</option> to something other than zero (see below). | 3670 <option>bframes</option> to something other than zero (see below). |
3564 </para></listitem> | 3671 </para> |
3565 <listitem><para> | 3672 </listitem> |
3673 <listitem> | |
3674 <para> | |
3566 <emphasis role="bold">frameref</emphasis>: | 3675 <emphasis role="bold">frameref</emphasis>: |
3567 <option>frameref</option> is set to 1 by default, but this | 3676 <option>frameref</option> is set to 1 by default, but this |
3568 should not be taken to imply that it is reasonable to set it | 3677 should not be taken to imply that it is reasonable to set it to 1. |
3569 to 1. | |
3570 Merely raising <option>frameref</option> to 2 gains around | 3678 Merely raising <option>frameref</option> to 2 gains around |
3571 0.15dB PSNR with a 5-10% speed penalty; this seems like a | 3679 0.15dB PSNR with a 5-10% speed penalty; this seems like a good tradeoff. |
3572 good tradeoff. | |
3573 <option>frameref=3</option> gains around 0.25dB PSNR over | 3680 <option>frameref=3</option> gains around 0.25dB PSNR over |
3574 <option>frameref=1</option>, which should be a visible | 3681 <option>frameref=1</option>, which should be a visible difference. |
3575 difference. | |
3576 <option>frameref=3</option> is around 15% slower than | 3682 <option>frameref=3</option> is around 15% slower than |
3577 <option>frameref=1</option>. | 3683 <option>frameref=1</option>. |
3578 Unfortunately, diminishing returns set in rapidly. | 3684 Unfortunately, diminishing returns set in rapidly. |
3579 <option>frameref=6</option> can be expected to gain only | 3685 <option>frameref=6</option> can be expected to gain only |
3580 0.05-0.1 dB over <option>frameref=3</option> at an additional | 3686 0.05-0.1 dB over <option>frameref=3</option> at an additional |
3581 15% speed penalty. | 3687 15% speed penalty. |
3582 Above <option>frameref=6</option>, the quality gains are | 3688 Above <option>frameref=6</option>, the quality gains are |
3583 usually very small (although you should keep in mind throughout | 3689 usually very small (although you should keep in mind throughout |
3584 this whole discussion that it can vary quite a lot depending on | 3690 this whole discussion that it can vary quite a lot depending on your source). |
3585 your source). | |
3586 In a fairly typical case, <option>frameref=12</option> | 3691 In a fairly typical case, <option>frameref=12</option> |
3587 will improve global PSNR by a tiny 0.02dB over | 3692 will improve global PSNR by a tiny 0.02dB over |
3588 <option>frameref=6</option>, at a speed cost of 15%-20%. | 3693 <option>frameref=6</option>, at a speed cost of 15%-20%. |
3589 At such high <option>frameref</option> values, the only really | 3694 At such high <option>frameref</option> values, the only really |
3590 good thing that can be said is that increasing it even further will | 3695 good thing that can be said is that increasing it even further will |
3591 almost certainly never <emphasis role="bold">harm</emphasis> | 3696 almost certainly never <emphasis role="bold">harm</emphasis> |
3592 PSNR, but the additional quality benefits are barely even | 3697 PSNR, but the additional quality benefits are barely even |
3593 measurable, let alone perceptible. | 3698 measurable, let alone perceptible. |
3594 </para> | 3699 </para> |
3595 <note><title>Note:</title> | 3700 <note><title>Note:</title> |
3596 <para> | 3701 <para> |
3597 Raising <option>frameref</option> to unnecessarily high values | 3702 Raising <option>frameref</option> to unnecessarily high values |
3598 <emphasis role="bold">can</emphasis> and | 3703 <emphasis role="bold">can</emphasis> and |
3599 <emphasis role="bold">usually does</emphasis> | 3704 <emphasis role="bold">usually does</emphasis> |
3600 hurt coding efficiency if you turn CABAC off. | 3705 hurt coding efficiency if you turn CABAC off. |
3601 With CABAC on (the default behavior), the possibility of setting | 3706 With CABAC on (the default behavior), the possibility of setting |
3602 <option>frameref</option> "too high" currently seems too remote | 3707 <option>frameref</option> "too high" currently seems too remote |
3603 to even worry about, and in the future, optimizations may remove | 3708 to even worry about, and in the future, optimizations may remove |
3604 the possibility altogether. | 3709 the possibility altogether. |
3605 </para> | 3710 </para></note> |
3606 </note> | 3711 <para> |
3607 <para> | |
3608 If you care about speed, a reasonable compromise is to use low | 3712 If you care about speed, a reasonable compromise is to use low |
3609 <option>subq</option> and <option>frameref</option> values on | 3713 <option>subq</option> and <option>frameref</option> values on |
3610 the first pass, and then raise them on the second pass. | 3714 the first pass, and then raise them on the second pass. |
3611 Typically, this has a negligible negative effect on the final | 3715 Typically, this has a negligible negative effect on the final |
3612 quality: You will probably lose well under 0.1dB PSNR, which | 3716 quality: You will probably lose well under 0.1dB PSNR, which |
3622 For example, if the scene flashes back and forth between two images | 3726 For example, if the scene flashes back and forth between two images |
3623 over a duration of three frames, set the first pass | 3727 over a duration of three frames, set the first pass |
3624 <option>frameref</option> to 3 or higher. | 3728 <option>frameref</option> to 3 or higher. |
3625 This issue is probably extremely rare in live action video material, | 3729 This issue is probably extremely rare in live action video material, |
3626 but it does sometimes come up in video game captures. | 3730 but it does sometimes come up in video game captures. |
3627 </para></listitem> | 3731 </para> |
3628 | 3732 </listitem> |
3629 <listitem><para> | 3733 <listitem> |
3734 <para> | |
3630 <emphasis role="bold">me</emphasis>: | 3735 <emphasis role="bold">me</emphasis>: |
3631 This option is for choosing the motion estimation search method. | 3736 This option is for choosing the motion estimation search method. |
3632 Altering this option provides a straightforward quality-vs-speed | 3737 Altering this option provides a straightforward quality-vs-speed |
3633 tradeoff. <option>me=dia</option> is only a few percent faster than | 3738 tradeoff. <option>me=dia</option> is only a few percent faster than |
3634 the default search, at a cost of under 0.1dB global PSNR. The | 3739 the default search, at a cost of under 0.1dB global PSNR. The |
3638 <option>frameref</option>. At high values of | 3743 <option>frameref</option>. At high values of |
3639 <option>frameref</option> (e.g. 12 or so), <option>me=umh</option> | 3744 <option>frameref</option> (e.g. 12 or so), <option>me=umh</option> |
3640 is about 40% slower than the default <option> me=hex</option>. With | 3745 is about 40% slower than the default <option> me=hex</option>. With |
3641 <option>frameref=3</option>, the speed penalty incurred drops to | 3746 <option>frameref=3</option>, the speed penalty incurred drops to |
3642 25%-30%. | 3747 25%-30%. |
3643 </para> | 3748 </para> |
3644 <para> | 3749 <para> |
3645 <option>me=esa</option> uses an exhaustive search that is too slow for | 3750 <option>me=esa</option> uses an exhaustive search that is too slow for |
3646 practical use. | 3751 practical use. |
3647 </para> | 3752 </para> |
3648 </listitem> | 3753 </listitem> |
3649 | |
3650 <listitem><para> | 3754 <listitem><para> |
3651 <emphasis role="bold">partitions=all</emphasis>: | 3755 <emphasis role="bold">partitions=all</emphasis>: |
3652 This option enables the use of 8x4, 4x8 and 4x4 subpartitions in | 3756 This option enables the use of 8x4, 4x8 and 4x4 subpartitions in |
3653 predicted macroblocks (in addition to the default partitions). | 3757 predicted macroblocks (in addition to the default partitions). |
3654 Enabling it results in a fairly consistent | 3758 Enabling it results in a fairly consistent |
3655 10%-15% loss of speed. This option is rather useless in source | 3759 10%-15% loss of speed. This option is rather useless in source |
3656 containing only low motion, however in some high-motion source, | 3760 containing only low motion, however in some high-motion source, |
3657 particularly source with lots of small moving objects, gains of | 3761 particularly source with lots of small moving objects, gains of |
3658 about 0.1dB can be expected. | 3762 about 0.1dB can be expected. |
3659 </para> | 3763 </para></listitem> |
3660 </listitem> | 3764 <listitem> |
3661 | 3765 <para> |
3662 <listitem><para> | |
3663 <emphasis role="bold">bframes</emphasis>: | 3766 <emphasis role="bold">bframes</emphasis>: |
3664 If you are used to encoding with other codecs, you may have found | 3767 If you are used to encoding with other codecs, you may have found |
3665 that B-frames are not always useful. | 3768 that B-frames are not always useful. |
3666 In H.264, this has changed: there are new techniques and block | 3769 In H.264, this has changed: there are new techniques and block |
3667 types that are possible in B-frames. | 3770 types that are possible in B-frames. |
3668 Usually, even a naive B-frame choice algorithm can have a | 3771 Usually, even a naive B-frame choice algorithm can have a |
3669 significant PSNR benefit. | 3772 significant PSNR benefit. |
3670 It is interesting to note that using B-frames usually speeds up | 3773 It is interesting to note that using B-frames usually speeds up |
3671 the second pass somewhat, and may also speed up a single | 3774 the second pass somewhat, and may also speed up a single |
3672 pass encode if adaptive B-frame decision is turned off. | 3775 pass encode if adaptive B-frame decision is turned off. |
3673 </para> | 3776 </para> |
3674 <para> | 3777 <para> |
3675 With adaptive B-frame decision turned off | 3778 With adaptive B-frame decision turned off |
3676 (<option>x264encopts</option>'s <option>nob_adapt</option>), | 3779 (<option>x264encopts</option>'s <option>nob_adapt</option>), |
3677 the optimal value for this setting is usually no more than | 3780 the optimal value for this setting is usually no more than |
3678 <option>bframes=1</option>, or else high-motion scenes can suffer. | 3781 <option>bframes=1</option>, or else high-motion scenes can suffer. |
3679 With adaptive B-frame decision on (the default behavior), it is | 3782 With adaptive B-frame decision on (the default behavior), it is |
3680 safe to use higher values; the encoder will reduce the use of | 3783 safe to use higher values; the encoder will reduce the use of |
3681 B-frames in scenes where they would hurt compression. | 3784 B-frames in scenes where they would hurt compression. |
3682 The encoder rarely chooses to use more than 3 or 4 B-frames; | 3785 The encoder rarely chooses to use more than 3 or 4 B-frames; |
3683 setting this option any higher will have little effect. | 3786 setting this option any higher will have little effect. |
3684 </para></listitem> | 3787 </para> |
3685 | 3788 </listitem> |
3686 <listitem><para> | 3789 <listitem> |
3790 <para> | |
3687 <emphasis role="bold">b_adapt</emphasis>: | 3791 <emphasis role="bold">b_adapt</emphasis>: |
3688 Note: This is on by default. | 3792 Note: This is on by default. |
3689 </para> | 3793 </para> |
3690 <para> | 3794 <para> |
3691 With this option enabled, the encoder will use a reasonably fast | 3795 With this option enabled, the encoder will use a reasonably fast |
3692 decision process to reduce the number of B-frames used in scenes that | 3796 decision process to reduce the number of B-frames used in scenes that |
3693 might not benefit from them as much. | 3797 might not benefit from them as much. |
3694 You can use <option>b_bias</option> to tweak how B-frame-happy | 3798 You can use <option>b_bias</option> to tweak how B-frame-happy |
3695 the encoder is. | 3799 the encoder is. |
3698 It usually does not hurt, however. | 3802 It usually does not hurt, however. |
3699 Note that this only affects speed and frametype decision on the | 3803 Note that this only affects speed and frametype decision on the |
3700 first pass. | 3804 first pass. |
3701 <option>b_adapt</option> and <option>b_bias</option> have no | 3805 <option>b_adapt</option> and <option>b_bias</option> have no |
3702 effect on subsequent passes. | 3806 effect on subsequent passes. |
3703 </para></listitem> | 3807 </para> |
3704 | 3808 </listitem> |
3705 <listitem><para> | 3809 <listitem><para> |
3706 <emphasis role="bold">b_pyramid</emphasis>: | 3810 <emphasis role="bold">b_pyramid</emphasis>: |
3707 You might as well enable this option if you are using >=2 B-frames; | 3811 You might as well enable this option if you are using >=2 B-frames; |
3708 as the man page says, you get a little quality improvement at no | 3812 as the man page says, you get a little quality improvement at no |
3709 speed cost. | 3813 speed cost. |
3710 Note that these videos cannot be read by libavcodec-based decoders | 3814 Note that these videos cannot be read by libavcodec-based decoders |
3711 older than about March 5, 2005. | 3815 older than about March 5, 2005. |
3712 </para></listitem> | 3816 </para></listitem> |
3713 | 3817 <listitem> |
3714 <listitem><para> | 3818 <para> |
3715 <emphasis role="bold">weight_b</emphasis>: | 3819 <emphasis role="bold">weight_b</emphasis>: |
3716 In typical cases, there is not much gain with this option. | 3820 In typical cases, there is not much gain with this option. |
3717 However, in crossfades or fade-to-black scenes, weighted | 3821 However, in crossfades or fade-to-black scenes, weighted |
3718 prediction gives rather large bitrate savings. | 3822 prediction gives rather large bitrate savings. |
3719 In MPEG-4 ASP, a fade-to-black is usually best coded as a series | 3823 In MPEG-4 ASP, a fade-to-black is usually best coded as a series |
3722 B-frames. | 3826 B-frames. |
3723 Encoding time cost is minimal, as no extra decisions need to be made. | 3827 Encoding time cost is minimal, as no extra decisions need to be made. |
3724 Also, contrary to what some people seem to guess, the decoder | 3828 Also, contrary to what some people seem to guess, the decoder |
3725 CPU requirements are not much affected by weighted prediction, | 3829 CPU requirements are not much affected by weighted prediction, |
3726 all else being equal. | 3830 all else being equal. |
3727 </para> | 3831 </para> |
3728 <para> | 3832 <para> |
3729 Unfortunately, the current adaptive B-frame decision algorithm | 3833 Unfortunately, the current adaptive B-frame decision algorithm |
3730 has a strong tendency to avoid B-frames during fades. | 3834 has a strong tendency to avoid B-frames during fades. |
3731 Until this changes, it may be a good idea to add | 3835 Until this changes, it may be a good idea to add |
3732 <option>nob_adapt</option> to your x264encopts, if you expect | 3836 <option>nob_adapt</option> to your x264encopts, if you expect |
3733 fades to have a large effect in your particular video | 3837 fades to have a large effect in your particular video |
3734 clip. | 3838 clip. |
3735 </para></listitem> | 3839 </para> |
3840 </listitem> | |
3736 </itemizedlist> | 3841 </itemizedlist> |
3737 </sect3> | 3842 </sect3> |
3738 | 3843 |
3844 | |
3739 <sect3 id="menc-feat-x264-encoding-options-misc-preferences"> | 3845 <sect3 id="menc-feat-x264-encoding-options-misc-preferences"> |
3740 <title>Options pertaining to miscellaneous preferences</title> | 3846 <title>Options pertaining to miscellaneous preferences</title> |
3847 | |
3741 <itemizedlist> | 3848 <itemizedlist> |
3742 <listitem><para> | 3849 <listitem> |
3850 <para> | |
3743 <emphasis role="bold">Two pass encoding</emphasis>: | 3851 <emphasis role="bold">Two pass encoding</emphasis>: |
3744 Above, it was suggested to always use two pass encoding, but there | 3852 Above, it was suggested to always use two pass encoding, but there |
3745 are still reasons for not using it. For instance, if you are capturing | 3853 are still reasons for not using it. For instance, if you are capturing |
3746 live TV and encoding in realtime, you are forced to use single-pass. | 3854 live TV and encoding in realtime, you are forced to use single-pass. |
3747 Also, one pass is obviously faster than two passes; if you use the | 3855 Also, one pass is obviously faster than two passes; if you use the |
3748 exact same set of options on both passes, two pass encoding is almost | 3856 exact same set of options on both passes, two pass encoding is almost |
3749 twice as slow. | 3857 twice as slow. |
3750 </para> | 3858 </para> |
3751 <para> | 3859 <para> |
3752 Still, there are very good reasons for using two pass encoding. For | 3860 Still, there are very good reasons for using two pass encoding. For |
3753 one thing, single pass ratecontrol is not psychic, and it often makes | 3861 one thing, single pass ratecontrol is not psychic, and it often makes |
3754 unreasonable choices because it cannot see the big picture. For example, | 3862 unreasonable choices because it cannot see the big picture. For example, |
3755 suppose you have a two minute long video consisting of two distinct | 3863 suppose you have a two minute long video consisting of two distinct |
3756 halves. The first half is a very high-motion scene lasting 60 seconds | 3864 halves. The first half is a very high-motion scene lasting 60 seconds |
3770 of the video. This "error period" of heavily over-quantized low motion | 3878 of the video. This "error period" of heavily over-quantized low motion |
3771 will look jarringly bad, and will actually use less than the 300kbps | 3879 will look jarringly bad, and will actually use less than the 300kbps |
3772 it would have taken to make it look decent. There are ways to | 3880 it would have taken to make it look decent. There are ways to |
3773 mitigate the pitfalls of single-pass encoding, but they may tend to | 3881 mitigate the pitfalls of single-pass encoding, but they may tend to |
3774 increase bitrate misprediction. | 3882 increase bitrate misprediction. |
3775 </para> | 3883 </para> |
3776 <para> | 3884 <para> |
3777 Multipass ratecontrol can offer huge advantages over a single pass. | 3885 Multipass ratecontrol can offer huge advantages over a single pass. |
3778 Using the statistics gathered from the first pass encode, the encoder | 3886 Using the statistics gathered from the first pass encode, the encoder |
3779 can estimate, with reasonable accuracy, the "cost" (in bits) of | 3887 can estimate, with reasonable accuracy, the "cost" (in bits) of |
3780 encoding any given frame, at any given quantizer. This allows for | 3888 encoding any given frame, at any given quantizer. This allows for |
3781 a much more rational, better planned allocation of bits between the | 3889 a much more rational, better planned allocation of bits between the |
3782 expensive (high-motion) and cheap (low-motion) scenes. See | 3890 expensive (high-motion) and cheap (low-motion) scenes. See |
3783 <option>qcomp</option> below for some ideas on how to tweak this | 3891 <option>qcomp</option> below for some ideas on how to tweak this |
3784 allocation to your liking. | 3892 allocation to your liking. |
3785 </para> | 3893 </para> |
3786 <para> | 3894 <para> |
3787 Moreover, two passes need not take twice as long as one pass. You can | 3895 Moreover, two passes need not take twice as long as one pass. You can |
3788 tweak the options in the first pass for higher speed and lower quality. | 3896 tweak the options in the first pass for higher speed and lower quality. |
3789 If you choose your options well, you can get a very fast first pass. | 3897 If you choose your options well, you can get a very fast first pass. |
3790 The resulting quality in the second pass will be slightly lower because size | 3898 The resulting quality in the second pass will be slightly lower because size |
3791 prediction is less accurate, but the quality difference is normally much | 3899 prediction is less accurate, but the quality difference is normally much |
3792 too small to be visible. Try, for example, adding | 3900 too small to be visible. Try, for example, adding |
3793 <option>subq=1:frameref=1</option> to the first pass | 3901 <option>subq=1:frameref=1</option> to the first pass |
3794 <option>x264encopts</option>. Then, on the second pass, use slower, | 3902 <option>x264encopts</option>. Then, on the second pass, use slower, |
3795 higher-quality options: | 3903 higher-quality options: |
3796 <option>subq=6:frameref=15:partitions=all:me=umh</option> | 3904 <option>subq=6:frameref=15:partitions=all:me=umh</option> |
3797 </para></listitem> | 3905 </para> |
3906 </listitem> | |
3798 <listitem><para> | 3907 <listitem><para> |
3799 <emphasis role="bold">Three pass encoding</emphasis>? | 3908 <emphasis role="bold">Three pass encoding</emphasis>? |
3800 | |
3801 x264 offers the ability to make an arbitrary number of consecutive | 3909 x264 offers the ability to make an arbitrary number of consecutive |
3802 passes. If you specify <option>pass=1</option> on the first pass, | 3910 passes. If you specify <option>pass=1</option> on the first pass, |
3803 then use <option>pass=3</option> on a subsequent pass, the subsequent | 3911 then use <option>pass=3</option> on a subsequent pass, the subsequent |
3804 pass will both read the statistics from the previous pass, and write | 3912 pass will both read the statistics from the previous pass, and write |
3805 its own statistics. An additional pass following this one will have | 3913 its own statistics. An additional pass following this one will have |
3811 prediction or bad looking scene transitions when using only two passes. | 3919 prediction or bad looking scene transitions when using only two passes. |
3812 This is somewhat likely to happen on extremely short clips. There are | 3920 This is somewhat likely to happen on extremely short clips. There are |
3813 also a few special cases in which three (or more) passes are handy | 3921 also a few special cases in which three (or more) passes are handy |
3814 for advanced users, but for brevity, this guide omits discussing those | 3922 for advanced users, but for brevity, this guide omits discussing those |
3815 special cases. | 3923 special cases. |
3816 | |
3817 </para></listitem> | 3924 </para></listitem> |
3818 <listitem><para> | 3925 <listitem><para> |
3819 <emphasis role="bold">qcomp</emphasis>: | 3926 <emphasis role="bold">qcomp</emphasis>: |
3820 <option>qcomp</option> trades off the number of bits allocated | 3927 <option>qcomp</option> trades off the number of bits allocated |
3821 to "expensive" high-motion versus "cheap" low-motion frames. At | 3928 to "expensive" high-motion versus "cheap" low-motion frames. At |
3843 and not about seekability, you can set it to much higher values | 3950 and not about seekability, you can set it to much higher values |
3844 (understanding that there are diminishing returns which may become | 3951 (understanding that there are diminishing returns which may become |
3845 vanishingly low, or even zero). The video stream will still have seekable | 3952 vanishingly low, or even zero). The video stream will still have seekable |
3846 points as long as there are some scene changes. | 3953 points as long as there are some scene changes. |
3847 </para></listitem> | 3954 </para></listitem> |
3848 <listitem><para> | 3955 <listitem> |
3956 <para> | |
3849 <emphasis role="bold">deblock</emphasis>: | 3957 <emphasis role="bold">deblock</emphasis>: |
3850 This topic is going to be a bit controversial. | 3958 This topic is going to be a bit controversial. |
3851 </para> | 3959 </para> |
3852 <para> | 3960 <para> |
3853 H.264 defines a simple deblocking procedure on I-blocks that uses | 3961 H.264 defines a simple deblocking procedure on I-blocks that uses |
3854 pre-set strengths and thresholds depending on the QP of the block | 3962 pre-set strengths and thresholds depending on the QP of the block |
3855 in question. | 3963 in question. |
3856 By default, high QP blocks are filtered heavily, and low QP blocks | 3964 By default, high QP blocks are filtered heavily, and low QP blocks |
3857 are not deblocked at all. | 3965 are not deblocked at all. |
3858 The pre-set strengths defined by the standard are well-chosen and | 3966 The pre-set strengths defined by the standard are well-chosen and |
3859 the odds are very good that they are PSNR-optimal for whatever | 3967 the odds are very good that they are PSNR-optimal for whatever |
3860 video you are trying to encode. | 3968 video you are trying to encode. |
3861 The <option>deblock</option> allow you to specify offsets to the preset deblocking | 3969 The <option>deblock</option> allow you to specify offsets to the preset |
3862 thresholds. | 3970 deblocking thresholds. |
3863 </para> | 3971 </para> |
3864 <para> | 3972 <para> |
3865 Many people seem to think it is a good idea to lower the deblocking | 3973 Many people seem to think it is a good idea to lower the deblocking |
3866 filter strength by large amounts (say, -3). | 3974 filter strength by large amounts (say, -3). |
3867 This is however almost never a good idea, and in most cases, | 3975 This is however almost never a good idea, and in most cases, |
3868 people who are doing this do not understand very well how | 3976 people who are doing this do not understand very well how |
3869 deblocking works by default. | 3977 deblocking works by default. |
3870 </para> | 3978 </para> |
3871 <para> | 3979 <para> |
3872 The first and most important thing to know about the in-loop | 3980 The first and most important thing to know about the in-loop |
3873 deblocking filter is that the default thresholds are almost always | 3981 deblocking filter is that the default thresholds are almost always |
3874 PSNR-optimal. | 3982 PSNR-optimal. |
3875 In the rare cases that they are not optimal, the ideal offset is | 3983 In the rare cases that they are not optimal, the ideal offset is |
3876 plus or minus 1. | 3984 plus or minus 1. |
3877 Adjusting deblocking parameters by a larger amount is almost | 3985 Adjusting deblocking parameters by a larger amount is almost |
3878 guaranteed to hurt PSNR. | 3986 guaranteed to hurt PSNR. |
3879 Strengthening the filter will smear more details; weakening the | 3987 Strengthening the filter will smear more details; weakening the |
3880 filter will increase the appearance of blockiness. | 3988 filter will increase the appearance of blockiness. |
3881 </para> | 3989 </para> |
3882 <para> | 3990 <para> |
3883 It is definitely a bad idea to lower the deblocking thresholds if | 3991 It is definitely a bad idea to lower the deblocking thresholds if |
3884 your source is mainly low in spacial complexity (i.e., not a lot | 3992 your source is mainly low in spacial complexity (i.e., not a lot |
3885 of detail or noise). | 3993 of detail or noise). |
3886 The in-loop filter does a rather excellent job of concealing | 3994 The in-loop filter does a rather excellent job of concealing |
3887 the artifacts that occur. | 3995 the artifacts that occur. |
3894 When it comes to subjective quality, noise and detail are somewhat | 4002 When it comes to subjective quality, noise and detail are somewhat |
3895 interchangeable. | 4003 interchangeable. |
3896 By lowering the deblocking filter strength, you are most likely | 4004 By lowering the deblocking filter strength, you are most likely |
3897 increasing error by adding ringing artifacts, but the eye does | 4005 increasing error by adding ringing artifacts, but the eye does |
3898 not notice because it confuses the artifacts with detail. | 4006 not notice because it confuses the artifacts with detail. |
3899 </para> | 4007 </para> |
3900 | 4008 <para> |
3901 <para> | |
3902 This <emphasis role="bold">still</emphasis> does not justify | 4009 This <emphasis role="bold">still</emphasis> does not justify |
3903 lowering the deblocking filter strength, however. | 4010 lowering the deblocking filter strength, however. |
3904 You can generally get better quality noise from postprocessing. | 4011 You can generally get better quality noise from postprocessing. |
3905 If your H.264 encodes look too blurry or smeared, try playing with | 4012 If your H.264 encodes look too blurry or smeared, try playing with |
3906 <option>-vf noise</option> when you play your encoded movie. | 4013 <option>-vf noise</option> when you play your encoded movie. |
3907 <option>-vf noise=8a:4a</option> should conceal most mild | 4014 <option>-vf noise=8a:4a</option> should conceal most mild |
3908 artifacting. | 4015 artifacting. |
3909 It will almost certainly look better than the results you | 4016 It will almost certainly look better than the results you |
3910 would have gotten just by fiddling with the deblocking filter. | 4017 would have gotten just by fiddling with the deblocking filter. |
3911 </para></listitem> | 4018 </para> |
4019 </listitem> | |
3912 </itemizedlist> | 4020 </itemizedlist> |
3913 </sect3> | 4021 </sect3> |
3914 </sect2> | 4022 </sect2> |
3915 | 4023 |
4024 <!-- ********** --> | |
4025 | |
3916 <sect2 id="menc-feat-x264-example-settings"> | 4026 <sect2 id="menc-feat-x264-example-settings"> |
3917 <title>Encoding setting examples</title> | 4027 <title>Encoding setting examples</title> |
3918 | 4028 |
3919 <para> | 4029 <para> |
3920 The following settings are examples of different encoding | 4030 The following settings are examples of different encoding |
3921 option combinations that affect the speed vs quality tradeoff | 4031 option combinations that affect the speed vs quality tradeoff |
3922 at the same target bitrate. | 4032 at the same target bitrate. |
3923 </para> | 4033 </para> |
3924 | 4034 |
3925 <para> | 4035 <para> |
3926 All the encoding settings were tested on a 720x448 @30000/1001 fps | 4036 All the encoding settings were tested on a 720x448 @30000/1001 fps |
3927 video sample, the target bitrate was 900kbps, and the machine was an | 4037 video sample, the target bitrate was 900kbps, and the machine was an |
3928 AMD-64 3400+ at 2400 MHz in 64 bits mode. | 4038 AMD-64 3400+ at 2400 MHz in 64 bits mode. |
3929 Each encoding setting features the measured encoding speed (in | 4039 Each encoding setting features the measured encoding speed (in |
3930 frames per second) and the PSNR loss (in dB) compared to the "very | 4040 frames per second) and the PSNR loss (in dB) compared to the "very |
3931 high quality" setting. | 4041 high quality" setting. |
3932 Please understand that depending on your source, your machine type | 4042 Please understand that depending on your source, your machine type |
3933 and development advancements, you may get very different results. | 4043 and development advancements, you may get very different results. |
3934 </para> | 4044 </para> |
3935 | 4045 |
3936 <para> | |
3937 <informaltable frame="all"> | 4046 <informaltable frame="all"> |
3938 <tgroup cols="4"> | 4047 <tgroup cols="4"> |
3939 <thead> | 4048 <thead> |
3940 <row><entry>Description</entry><entry>Encoding options</entry><entry>speed (in fps)</entry><entry>Relative PSNR loss (in dB)</entry></row> | 4049 <row> |
4050 <entry>Description</entry> | |
4051 <entry>Encoding options</entry> | |
4052 <entry>speed (in fps)</entry> | |
4053 <entry>Relative PSNR loss (in dB)</entry> | |
4054 </row> | |
3941 </thead> | 4055 </thead> |
3942 <tbody> | 4056 <tbody> |
3943 <row> | 4057 <row> |
3944 <entry>Very high quality</entry> | 4058 <entry>Very high quality</entry> |
3945 <entry><option>subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b</option></entry> | 4059 <entry><option>subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b</option></entry> |
3959 <entry>-1.48dB</entry> | 4073 <entry>-1.48dB</entry> |
3960 </row> | 4074 </row> |
3961 </tbody> | 4075 </tbody> |
3962 </tgroup> | 4076 </tgroup> |
3963 </informaltable> | 4077 </informaltable> |
3964 </para> | |
3965 </sect2> | 4078 </sect2> |
3966 | |
3967 </sect1> | 4079 </sect1> |
3968 | 4080 |
4081 | |
4082 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
4083 | |
4084 | |
3969 <sect1 id="menc-feat-video-for-windows"> | 4085 <sect1 id="menc-feat-video-for-windows"> |
3970 <title>Encoding with the <systemitem class="library">Video For Windows</systemitem> codec family</title> | 4086 <title> |
4087 Encoding with the <systemitem class="library">Video For Windows</systemitem> | |
4088 codec family | |
4089 </title> | |
3971 | 4090 |
3972 <para> | 4091 <para> |
3973 Video for Windows provides simple encoding by means of binary video codecs. | 4092 Video for Windows provides simple encoding by means of binary video codecs. |
3974 You can encode with the following codecs (if you have more, please tell us!) | 4093 You can encode with the following codecs (if you have more, please tell us!) |
3975 </para> | 4094 </para> |
4095 | |
3976 <para> | 4096 <para> |
3977 Note that support for this is very experimental and some codecs may not work | 4097 Note that support for this is very experimental and some codecs may not work |
3978 correctly. Some codecs will only work in certain colorspaces, try | 4098 correctly. Some codecs will only work in certain colorspaces, try |
3979 <option>-vf format=bgr24</option> and <option>-vf format=yuy2</option> | 4099 <option>-vf format=bgr24</option> and <option>-vf format=yuy2</option> |
3980 if a codec fails or gives wrong output. | 4100 if a codec fails or gives wrong output. |
3981 </para> | 4101 </para> |
3982 | 4102 |
4103 <!-- ********** --> | |
4104 | |
3983 <sect2 id="menc-feat-enc-vfw-video-codecs"> | 4105 <sect2 id="menc-feat-enc-vfw-video-codecs"> |
3984 <title>Video for Windows supported codecs</title> | 4106 <title>Video for Windows supported codecs</title> |
3985 | 4107 |
3986 <para> | 4108 <para> |
3987 <informaltable frame="all"> | 4109 <informaltable frame="all"> |
3988 <tgroup cols="4"> | 4110 <tgroup cols="4"> |
3989 <thead> | 4111 <thead> |
3990 <row> | 4112 <row> |
3991 <entry>Video codec file name</entry> | 4113 <entry>Video codec file name</entry> |
3992 <entry>Description (FourCC)</entry> | 4114 <entry>Description (FourCC)</entry> |
3993 <entry>md5sum</entry> | 4115 <entry>md5sum</entry> |
3994 <entry>Comment</entry> | 4116 <entry>Comment</entry> |
3995 </row> | 4117 </row> |
3996 </thead> | 4118 </thead> |
3997 <tbody> | 4119 <tbody> |
3998 <row> | 4120 <row> |
3999 <entry>aslcodec_vfw.dll</entry> | 4121 <entry>aslcodec_vfw.dll</entry> |
4100 <row> | 4222 <row> |
4101 <entry>msulvc06.DLL</entry> | 4223 <entry>msulvc06.DLL</entry> |
4102 <entry>MSU Lossless codec (MSUD)</entry> | 4224 <entry>MSU Lossless codec (MSUD)</entry> |
4103 <entry>294bf9288f2f127bb86f00bfcc9ccdda</entry> | 4225 <entry>294bf9288f2f127bb86f00bfcc9ccdda</entry> |
4104 <entry> | 4226 <entry> |
4105 Decodable by <application>Window Media Player</application>, | 4227 Decodable by <application>Window Media Player</application>, |
4106 not <application>MPlayer</application> (yet). | 4228 not <application>MPlayer</application> (yet). |
4107 </entry> | 4229 </entry> |
4108 </row> | 4230 </row> |
4109 <row> | 4231 <row> |
4110 <entry>camcodec.dll</entry> | 4232 <entry>camcodec.dll</entry> |
4111 <entry>CamStudio lossless video codec (CSCD)</entry> | 4233 <entry>CamStudio lossless video codec (CSCD)</entry> |
4115 </tbody> | 4237 </tbody> |
4116 </tgroup> | 4238 </tgroup> |
4117 </informaltable> | 4239 </informaltable> |
4118 | 4240 |
4119 The first column contains the codec names that should be passed after the | 4241 The first column contains the codec names that should be passed after the |
4120 <literal>codec</literal> parameter, like: <option>-xvfwopts codec=divx.dll</option> | 4242 <literal>codec</literal> parameter, |
4243 like: <option>-xvfwopts codec=divx.dll</option> | |
4121 The FourCC code used by each codec is given in the parentheses. | 4244 The FourCC code used by each codec is given in the parentheses. |
4122 </para> | 4245 </para> |
4246 | |
4123 <informalexample> | 4247 <informalexample> |
4124 <para> | 4248 <para> |
4125 An example with VP3 compression: | 4249 An example with VP3 compression: |
4126 <screen>mencoder dvd://2 -o title2.avi -ovc vfw -xvfwopts codec=vp31vfw.dll -oac copy</screen> | 4250 <screen> |
4251 mencoder dvd://2 -o <replaceable>title2.avi</replaceable> -ovc vfw -xvfwopts codec=vp31vfw.dll -oac copy | |
4252 </screen> | |
4127 </para> | 4253 </para> |
4128 </informalexample> | 4254 </informalexample> |
4129 </sect2> | 4255 </sect2> |
4130 </sect1> | 4256 </sect1> |
4131 | 4257 |
4132 | 4258 |
4259 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | |
4260 | |
4261 | |
4133 <sect1 id="menc-feat-vcd-dvd"> | 4262 <sect1 id="menc-feat-vcd-dvd"> |
4134 <title>Using <application>MEncoder</application> to create VCD/SVCD/DVD-compliant files.</title> | 4263 <title>Using <application>MEncoder</application> |
4264 to create VCD/SVCD/DVD-compliant files</title> | |
4135 | 4265 |
4136 <sect2 id="menc-feat-vcd-dvd-constraints"> | 4266 <sect2 id="menc-feat-vcd-dvd-constraints"> |
4137 <title>Format Constraints</title> | 4267 <title>Format Constraints</title> |
4138 <para> | 4268 |
4139 <application>MEncoder</application> is capable of creating VCD, SCVD | 4269 <para> |
4140 and DVD format MPEG files using the | 4270 <application>MEncoder</application> is capable of creating VCD, SCVD |
4141 <systemitem class="library">libavcodec</systemitem> library. | 4271 and DVD format MPEG files using the |
4142 These files can then be used in conjunction with | 4272 <systemitem class="library">libavcodec</systemitem> library. |
4143 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink> | 4273 These files can then be used in conjunction with |
4144 or | 4274 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink> |
4145 <ulink url="http://dvdauthor.sourceforge.net/">dvdauthor</ulink> | 4275 or |
4146 to create discs that will play on a standard set-top player. | 4276 <ulink url="http://dvdauthor.sourceforge.net/">dvdauthor</ulink> |
4147 </para> | 4277 to create discs that will play on a standard set-top player. |
4148 | 4278 </para> |
4149 <para> | 4279 |
4150 The DVD, SVCD, and VCD formats are subject to heavy constraints. | 4280 <para> |
4151 Only a small selection of encoded picture sizes and aspect ratios are | 4281 The DVD, SVCD, and VCD formats are subject to heavy constraints. |
4152 available. | 4282 Only a small selection of encoded picture sizes and aspect ratios are |
4153 If your movie does not already meet these requirements, you may have | 4283 available. |
4154 to scale,crop or add black borders to the picture to make it | 4284 If your movie does not already meet these requirements, you may have |
4155 compliant. | 4285 to scale,crop or add black borders to the picture to make it |
4156 </para> | 4286 compliant. |
4287 </para> | |
4288 | |
4157 | 4289 |
4158 <sect3 id="menc-feat-vcd-dvd-constraints-resolution"> | 4290 <sect3 id="menc-feat-vcd-dvd-constraints-resolution"> |
4159 <title>Format Constraints</title> | 4291 <title>Format Constraints</title> |
4160 | 4292 |
4161 <informaltable frame="all"> | 4293 <informaltable frame="all"> |
4162 <tgroup cols="9"> | 4294 <tgroup cols="9"> |
4163 <thead> | 4295 <thead> |
4164 <row> | 4296 <row> |
4165 <entry>Format</entry> | 4297 <entry>Format</entry> |
4166 <entry>Resolution</entry> | 4298 <entry>Resolution</entry> |
4167 <entry>V. Codec</entry> | 4299 <entry>V. Codec</entry> |
4168 <entry>V. Bitrate</entry> | 4300 <entry>V. Bitrate</entry> |
4169 <entry>Sample Rate</entry> | 4301 <entry>Sample Rate</entry> |
4170 <entry>A. Codec</entry> | 4302 <entry>A. Codec</entry> |
4171 <entry>A. Bitrate</entry> | 4303 <entry>A. Bitrate</entry> |
4172 <entry>FPS</entry> | 4304 <entry>FPS</entry> |
4173 <entry>Aspect</entry> | 4305 <entry>Aspect</entry> |
4174 </row> | 4306 </row> |
4175 </thead> | 4307 </thead> |
4176 <tbody> | 4308 <tbody> |
4177 <row> | 4309 <row> |
4178 <entry>NTSC DVD</entry> | 4310 <entry>NTSC DVD</entry> |
4179 <entry>720x480, 704x480, 352x480, 352x240</entry> | 4311 <entry>720x480, 704x480, 352x480, 352x240</entry> |
4180 <entry>MPEG-2</entry> | 4312 <entry>MPEG-2</entry> |
4181 <entry>9800 kbps</entry> | 4313 <entry>9800 kbps</entry> |
4182 <entry>48000 Hz</entry> | 4314 <entry>48000 Hz</entry> |
4183 <entry>AC3,PCM</entry> | 4315 <entry>AC3,PCM</entry> |
4184 <entry>1536 kbps (max)</entry> | 4316 <entry>1536 kbps (max)</entry> |
4185 <entry>30000/1001, 24000/1001</entry> | 4317 <entry>30000/1001, 24000/1001</entry> |
4186 <entry>4:3, 16:9 (only for 720x480)</entry> | 4318 <entry>4:3, 16:9 (only for 720x480)</entry> |
4187 </row> | 4319 </row> |
4188 <row> | 4320 <row> |
4189 <entry>NTSC DVD</entry> | 4321 <entry>NTSC DVD</entry> |
4190 <entry>352x240<footnote id='fn-rare-resolutions'><para> | 4322 <entry>352x240<footnote id='fn-rare-resolutions'><para> |
4191 These resolutions are rarely used for DVDs because | 4323 These resolutions are rarely used for DVDs because |
4192 they are fairly low quality.</para></footnote></entry> | 4324 they are fairly low quality.</para></footnote></entry> |
4193 <entry>MPEG-1</entry> | 4325 <entry>MPEG-1</entry> |
4194 <entry>1856 kbps</entry> | 4326 <entry>1856 kbps</entry> |
4195 <entry>48000 Hz</entry> | 4327 <entry>48000 Hz</entry> |
4196 <entry>AC3,PCM</entry> | 4328 <entry>AC3,PCM</entry> |
4197 <entry>1536 kbps (max)</entry> | 4329 <entry>1536 kbps (max)</entry> |
4198 <entry>30000/1001, 24000/1001</entry> | 4330 <entry>30000/1001, 24000/1001</entry> |
4199 <entry>4:3, 16:9</entry> | 4331 <entry>4:3, 16:9</entry> |
4200 </row> | 4332 </row> |
4201 <row> | 4333 <row> |
4202 <entry>NTSC SVCD</entry> | 4334 <entry>NTSC SVCD</entry> |
4203 <entry>480x480</entry> | 4335 <entry>480x480</entry> |
4204 <entry>MPEG-2</entry> | 4336 <entry>MPEG-2</entry> |
4205 <entry>2600 kbps</entry> | 4337 <entry>2600 kbps</entry> |
4206 <entry>44100 Hz</entry> | 4338 <entry>44100 Hz</entry> |
4207 <entry>MP2</entry> | 4339 <entry>MP2</entry> |
4208 <entry>384 kbps (max)</entry> | 4340 <entry>384 kbps (max)</entry> |
4209 <entry>30000/1001</entry> | 4341 <entry>30000/1001</entry> |
4210 <entry>4:3</entry> | 4342 <entry>4:3</entry> |
4211 </row> | 4343 </row> |
4212 <row> | 4344 <row> |
4213 <entry>NTSC VCD</entry> | 4345 <entry>NTSC VCD</entry> |
4214 <entry>352x240</entry> | 4346 <entry>352x240</entry> |
4215 <entry>MPEG-1</entry> | 4347 <entry>MPEG-1</entry> |
4216 <entry>1150 kbps</entry> | 4348 <entry>1150 kbps</entry> |
4217 <entry>44100 Hz</entry> | 4349 <entry>44100 Hz</entry> |
4218 <entry>MP2</entry> | 4350 <entry>MP2</entry> |
4219 <entry>224 kbps</entry> | 4351 <entry>224 kbps</entry> |
4220 <entry>24000/1001, 30000/1001</entry> | 4352 <entry>24000/1001, 30000/1001</entry> |
4221 <entry>4:3</entry> | 4353 <entry>4:3</entry> |
4222 </row> | 4354 </row> |
4223 <row> | 4355 <row> |
4224 <entry>PAL DVD</entry> | 4356 <entry>PAL DVD</entry> |
4225 <entry>720x576, 704x576, 352x576, 352x288</entry> | 4357 <entry>720x576, 704x576, 352x576, 352x288</entry> |
4226 <entry>MPEG-2</entry> | 4358 <entry>MPEG-2</entry> |
4227 <entry>9800 kbps</entry> | 4359 <entry>9800 kbps</entry> |
4228 <entry>48000 Hz</entry> | 4360 <entry>48000 Hz</entry> |
4229 <entry>MP2,AC3,PCM</entry> | 4361 <entry>MP2,AC3,PCM</entry> |
4230 <entry>1536 kbps (max)</entry> | 4362 <entry>1536 kbps (max)</entry> |
4231 <entry>25</entry> | 4363 <entry>25</entry> |
4232 <entry>4:3, 16:9 (only for 720x576)</entry> | 4364 <entry>4:3, 16:9 (only for 720x576)</entry> |
4233 </row> | 4365 </row> |
4234 <row> | 4366 <row> |
4235 <entry>PAL DVD</entry> | 4367 <entry>PAL DVD</entry> |
4236 <entry>352x288<footnoteref linkend='fn-rare-resolutions'/></entry> | 4368 <entry>352x288<footnoteref linkend='fn-rare-resolutions'/></entry> |
4237 <entry>MPEG-1</entry> | 4369 <entry>MPEG-1</entry> |
4238 <entry>1856 kbps</entry> | 4370 <entry>1856 kbps</entry> |
4239 <entry>48000 Hz</entry> | 4371 <entry>48000 Hz</entry> |
4240 <entry>MP2,AC3,PCM</entry> | 4372 <entry>MP2,AC3,PCM</entry> |
4241 <entry>1536 kbps (max)</entry> | 4373 <entry>1536 kbps (max)</entry> |
4242 <entry>25</entry> | 4374 <entry>25</entry> |
4243 <entry>4:3, 16:9</entry> | 4375 <entry>4:3, 16:9</entry> |
4244 </row> | 4376 </row> |
4245 <row> | 4377 <row> |
4246 <entry>PAL SVCD</entry> | 4378 <entry>PAL SVCD</entry> |
4247 <entry>480x576</entry> | 4379 <entry>480x576</entry> |
4248 <entry>MPEG-2</entry> | 4380 <entry>MPEG-2</entry> |
4249 <entry>2600 kbps</entry> | 4381 <entry>2600 kbps</entry> |
4250 <entry>44100 Hz</entry> | 4382 <entry>44100 Hz</entry> |
4251 <entry>MP2</entry> | 4383 <entry>MP2</entry> |
4252 <entry>384 kbps (max)</entry> | 4384 <entry>384 kbps (max)</entry> |
4253 <entry>25</entry> | 4385 <entry>25</entry> |
4254 <entry>4:3</entry> | 4386 <entry>4:3</entry> |
4255 </row> | 4387 </row> |
4256 <row> | 4388 <row> |
4257 <entry>PAL VCD</entry> | 4389 <entry>PAL VCD</entry> |
4258 <entry>352x288</entry> | 4390 <entry>352x288</entry> |
4259 <entry>MPEG-1</entry> | 4391 <entry>MPEG-1</entry> |
4260 <entry>1152 kbps</entry> | 4392 <entry>1152 kbps</entry> |
4261 <entry>44100 Hz</entry> | 4393 <entry>44100 Hz</entry> |
4262 <entry>MP2</entry> | 4394 <entry>MP2</entry> |
4263 <entry>224 kbps</entry> | 4395 <entry>224 kbps</entry> |
4264 <entry>25</entry> | 4396 <entry>25</entry> |
4265 <entry>4:3</entry> | 4397 <entry>4:3</entry> |
4266 </row> | 4398 </row> |
4267 </tbody> | 4399 </tbody> |
4268 </tgroup> | 4400 </tgroup> |
4269 </informaltable> | 4401 </informaltable> |
4270 | 4402 |
4271 <para> | 4403 <para> |
4272 If your movie has 2.35:1 aspect (most recent action movies), you will | 4404 If your movie has 2.35:1 aspect (most recent action movies), you will |
4273 have to add black borders or crop the movie down to 16:9 to make a DVD | 4405 have to add black borders or crop the movie down to 16:9 to make a DVD or VCD. |
4274 or VCD. | 4406 If you add black borders, try to align them at 16-pixel boundaries in |
4275 If you add black borders, try to align them at 16-pixel boundaries in | 4407 order to minimize the impact on encoding performance. |
4276 order to minimize the impact on encoding performance. | 4408 Thankfully DVD has sufficiently excessive bitrate that you do not have |
4277 Thankfully DVD has sufficiently excessive bitrate that you do not have | 4409 to worry too much about encoding efficiency, but SVCD and VCD are |
4278 to worry too much about encoding efficiency, but SVCD and VCD are | 4410 highly bitrate-starved and require effort to obtain acceptable quality. |
4279 highly bitrate-starved and require effort to obtain acceptable quality. | |
4280 </para> | 4411 </para> |
4281 </sect3> | 4412 </sect3> |
4413 | |
4282 | 4414 |
4283 <sect3 id="menc-feat-vcd-dvd-constraints-gop"> | 4415 <sect3 id="menc-feat-vcd-dvd-constraints-gop"> |
4284 <title>GOP Size Constraints</title> | 4416 <title>GOP Size Constraints</title> |
4285 <para> | 4417 |
4286 DVD, VCD, and SVCD also constrain you to relatively low | 4418 <para> |
4287 GOP (Group of Pictures) sizes. | 4419 DVD, VCD, and SVCD also constrain you to relatively low |
4288 For 30 fps material the largest allowed GOP size is 18. | 4420 GOP (Group of Pictures) sizes. |
4289 For 25 or 24 fps, the maximum is 15. | 4421 For 30 fps material the largest allowed GOP size is 18. |
4290 The GOP size is set using the <option>keyint</option> option. | 4422 For 25 or 24 fps, the maximum is 15. |
4423 The GOP size is set using the <option>keyint</option> option. | |
4291 </para> | 4424 </para> |
4292 </sect3> | 4425 </sect3> |
4426 | |
4293 | 4427 |
4294 <sect3 id="menc-feat-vcd-dvd-constraints-bitrate"> | 4428 <sect3 id="menc-feat-vcd-dvd-constraints-bitrate"> |
4295 <title>Bitrate Constraints</title> | 4429 <title>Bitrate Constraints</title> |
4296 <para> | 4430 |
4297 VCD video is required to be CBR at 1152 kbps. | 4431 <para> |
4298 This highly limiting constraint also comes along with an extremly low vbv | 4432 VCD video is required to be CBR at 1152 kbps. |
4299 buffer size of 327 kilobits. | 4433 This highly limiting constraint also comes along with an extremly low vbv |
4300 SVCD allows varying video bitrates up to 2500 kbps, and a somewhat less | 4434 buffer size of 327 kilobits. |
4301 restrictive vbv buffer size of 917 kilobits is allowed. | 4435 SVCD allows varying video bitrates up to 2500 kbps, and a somewhat less |
4302 DVD video bitrates may range anywhere up to 9800 kbps (though typical | 4436 restrictive vbv buffer size of 917 kilobits is allowed. |
4303 bitrates are about half that), and the vbv buffer size is 1835 kilobits. | 4437 DVD video bitrates may range anywhere up to 9800 kbps (though typical |
4438 bitrates are about half that), and the vbv buffer size is 1835 kilobits. | |
4304 </para> | 4439 </para> |
4305 </sect3> | 4440 </sect3> |
4306 </sect2> | 4441 </sect2> |
4307 | 4442 |
4443 <!-- ********** --> | |
4444 | |
4308 <sect2 id="menc-feat-vcd-dvd-output"> | 4445 <sect2 id="menc-feat-vcd-dvd-output"> |
4309 <title>Output Options</title> | 4446 <title>Output Options</title> |
4310 <para> | 4447 |
4311 <application>MEncoder</application> has options to control the output | 4448 <para> |
4312 format. | 4449 <application>MEncoder</application> has options to control the output |
4313 Using these options we can instruct it to create the correct type of | 4450 format. |
4314 file. | 4451 Using these options we can instruct it to create the correct type of |
4315 </para> | 4452 file. |
4316 | 4453 </para> |
4317 <para> | 4454 |
4318 The options for VCD and SVCD are called xvcd and xsvcd, because they | 4455 <para> |
4319 are extended formats. | 4456 The options for VCD and SVCD are called xvcd and xsvcd, because they |
4320 They are not strictly compliant, mainly because the output does not | 4457 are extended formats. |
4321 contain scan offsets. | 4458 They are not strictly compliant, mainly because the output does not |
4322 If you need to generate an SVCD image, you should pass the output file | 4459 contain scan offsets. |
4323 to | 4460 If you need to generate an SVCD image, you should pass the output file to |
4324 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink>. | 4461 <ulink url="http://www.gnu.org/software/vcdimager/vcdimager.html">vcdimager</ulink>. |
4325 </para> | 4462 </para> |
4326 | 4463 |
4327 <para> | 4464 <para> |
4328 VCD: | 4465 VCD: |
4329 <screen> | 4466 <screen>-of mpeg -mpegopts format=xvcd</screen> |
4330 -of mpeg -mpegopts format=xvcd | 4467 </para> |
4331 </screen> | 4468 |
4332 </para> | 4469 <para> |
4333 | 4470 SVCD: |
4334 <para> | 4471 <screen>-of mpeg -mpegopts format=xsvcd</screen> |
4335 SVCD: | 4472 </para> |
4336 <screen> | 4473 |
4337 -of mpeg -mpegopts format=xsvcd | 4474 <para> |
4338 </screen> | 4475 DVD (with timestamps on every frame, if possible): |
4339 </para> | 4476 <screen>-of mpeg -mpegopts format=dvd:tsaf</screen> |
4340 | 4477 </para> |
4341 <para> | 4478 |
4342 DVD (with timestamps on every frame, if possible): | 4479 <para> |
4343 <screen> | 4480 DVD with NTSC Pullup: |
4344 -of mpeg -mpegopts format=dvd:tsaf | 4481 <screen>-of mpeg -mpegopts format=dvd:tsaf:telecine -ofps 24000/1001</screen> |
4345 </screen> | 4482 This allows 24000/1001 fps progressive content to be encoded at 30000/1001 |
4346 </para> | 4483 fps whilst maintaing DVD-compliance. |
4347 | 4484 </para> |
4348 <para> | 4485 |
4349 DVD with NTSC Pullup: | |
4350 <screen> | |
4351 -of mpeg -mpegopts format=dvd:tsaf:telecine -ofps 24000/1001 | |
4352 </screen> | |
4353 This allows 24000/1001 fps progressive content to be encoded at 30000/1001 | |
4354 fps whilst maintaing DVD-compliance. | |
4355 </para> | |
4356 | 4486 |
4357 <sect3 id="menc-feat-vcd-dvd-output-aspect"> | 4487 <sect3 id="menc-feat-vcd-dvd-output-aspect"> |
4358 <title>Aspect Ratio</title> | 4488 <title>Aspect Ratio</title> |
4359 <para> | 4489 |
4360 The aspect argument of <option>-lavcopts</option> is used to encode | 4490 <para> |
4361 the aspect ratio of the file. | 4491 The aspect argument of <option>-lavcopts</option> is used to encode |
4362 During playback the aspect ratio is used to restore the video to the | 4492 the aspect ratio of the file. |
4363 correct size. | 4493 During playback the aspect ratio is used to restore the video to the |
4364 </para> | 4494 correct size. |
4365 | 4495 </para> |
4366 <para> | 4496 |
4367 16:9 or "Widescreen" | 4497 <para> |
4368 <screen> | 4498 16:9 or "Widescreen" |
4369 -lavcopts aspect=16/9 | 4499 <screen>-lavcopts aspect=16/9</screen> |
4370 </screen> | 4500 </para> |
4371 </para> | 4501 |
4372 | 4502 <para> |
4373 <para> | 4503 4:3 or "Fullscreen" |
4374 4:3 or "Fullscreen" | 4504 <screen>-lavcopts aspect=4/3</screen> |
4375 <screen> | 4505 </para> |
4376 -lavcopts aspect=4/3 | 4506 |
4377 </screen> | 4507 <para> |
4378 </para> | 4508 2.35:1 or "Cinemascope" NTSC |
4379 | 4509 <screen>-vf scale=720:368,expand=720:480 -lavcopts aspect=16/9</screen> |
4380 <para> | 4510 To calculate the correct scaling size, use the expanded NTSC width of |
4381 2.35:1 or "Cinemascope" NTSC | 4511 854/2.35 = 368 |
4382 <screen> | 4512 </para> |
4383 -vf scale=720:368,expand=720:480 -lavcopts aspect=16/9 | 4513 |
4384 </screen> | 4514 <para> |
4385 To calculate the correct scaling size, use the expanded NTSC width of | 4515 2.35:1 or "Cinemascope" PAL |
4386 854/2.35 = 368 | 4516 <screen>-vf scale="720:432,expand=720:576 -lavcopts aspect=16/9</screen> |
4387 </para> | 4517 To calculate the correct scaling size, use the expanded PAL width of |
4388 | 4518 1024/2.35 = 432 |
4389 <para> | 4519 </para> |
4390 2.35:1 or "Cinemascope" PAL | |
4391 <screen> | |
4392 -vf scale="720:432,expand=720:576 -lavcopts aspect=16/9 | |
4393 </screen> | |
4394 To calculate the correct scaling size, use the expanded PAL width of | |
4395 1024/2.35 = 432 | |
4396 </para> | |
4397 | |
4398 </sect3> | 4520 </sect3> |
4521 | |
4399 | 4522 |
4400 <sect3 id="menc-feat-vcd-dvd-a-v-sync"> | 4523 <sect3 id="menc-feat-vcd-dvd-a-v-sync"> |
4401 <title>Maintaining A/V sync</title> | 4524 <title>Maintaining A/V sync</title> |
4402 <para> | 4525 |
4403 In order to maintain audio/video synchronization throughout the encode, | 4526 <para> |
4404 <application>MEncoder</application> has to drop or duplicate frames. | 4527 In order to maintain audio/video synchronization throughout the encode, |
4405 This works rather well when muxing into an AVI file, but is almost | 4528 <application>MEncoder</application> has to drop or duplicate frames. |
4406 guaranteed to fail to maintain A/V sync with other muxers such as MPEG. | 4529 This works rather well when muxing into an AVI file, but is almost |
4407 This is why it is necessary to append the | 4530 guaranteed to fail to maintain A/V sync with other muxers such as MPEG. |
4408 <option>harddup</option> video filter at the end of the filter chain | 4531 This is why it is necessary to append the |
4409 to avoid this kind of problem. | 4532 <option>harddup</option> video filter at the end of the filter chain |
4410 You can find more technical information about <option>harddup</option> | 4533 to avoid this kind of problem. |
4411 in the section | 4534 You can find more technical information about <option>harddup</option> |
4412 <link linkend="menc-feat-dvd-mpeg4-muxing-filter-issues">Improving muxing and A/V sync reliability</link> | 4535 in the section |
4413 or in the manual page. | 4536 <link linkend="menc-feat-dvd-mpeg4-muxing-filter-issues">Improving muxing and A/V sync reliability</link> |
4537 or in the manual page. | |
4414 </para> | 4538 </para> |
4415 </sect3> | 4539 </sect3> |
4540 | |
4416 | 4541 |
4417 <sect3 id="menc-feat-vcd-dvd-output-srate"> | 4542 <sect3 id="menc-feat-vcd-dvd-output-srate"> |
4418 <title>Sample Rate Conversion</title> | 4543 <title>Sample Rate Conversion</title> |
4419 <para> | 4544 |
4420 If the audio sample rate in the original file is not the same as | 4545 <para> |
4421 required by the target format, sample rate conversion is required. | 4546 If the audio sample rate in the original file is not the same as |
4422 This is achieved using the <option>-srate</option> option and | 4547 required by the target format, sample rate conversion is required. |
4423 the <option>-af lavcresample</option> audio filter together. | 4548 This is achieved using the <option>-srate</option> option and |
4424 </para> | 4549 the <option>-af lavcresample</option> audio filter together. |
4425 <para> | 4550 </para> |
4426 DVD: | 4551 |
4427 <screen> | 4552 <para> |
4428 -srate 48000 -af lavcresample=48000 | 4553 DVD: |
4429 </screen> | 4554 <screen>-srate 48000 -af lavcresample=48000</screen> |
4430 </para> | 4555 </para> |
4431 <para> | 4556 |
4432 VCD and SVCD: | 4557 <para> |
4433 <screen> | 4558 VCD and SVCD: |
4434 -srate 44100 -af lavcresample=44100 | 4559 <screen>-srate 44100 -af lavcresample=44100</screen> |
4435 </screen> | 4560 </para> |
4436 </para> | |
4437 </sect3> | 4561 </sect3> |
4438 </sect2> | 4562 </sect2> |
4439 | 4563 |
4564 <!-- ********** --> | |
4565 | |
4440 <sect2 id="menc-feat-vcd-dvd-lavc"> | 4566 <sect2 id="menc-feat-vcd-dvd-lavc"> |
4441 <title>Using libavcodec for VCD/SVCD/DVD Encoding</title> | 4567 <title>Using libavcodec for VCD/SVCD/DVD Encoding</title> |
4442 | 4568 |
4443 <sect3 id="menc-feat-vcd-dvd-lavc-intro"> | 4569 <sect3 id="menc-feat-vcd-dvd-lavc-intro"> |
4444 <title>Introduction</title> | 4570 <title>Introduction</title> |
4445 <para> | 4571 |
4446 <systemitem class="library">libavcodec</systemitem> can be used to | 4572 <para> |
4447 create VCD/SVCD/DVD compliant video by using the appropriate options. | 4573 <systemitem class="library">libavcodec</systemitem> can be used to |
4574 create VCD/SVCD/DVD compliant video by using the appropriate options. | |
4448 </para> | 4575 </para> |
4449 </sect3> | 4576 </sect3> |
4577 | |
4450 | 4578 |
4451 <sect3 id="menc-feat-vcd-dvd-lavc-options"> | 4579 <sect3 id="menc-feat-vcd-dvd-lavc-options"> |
4452 <title>lavcopts</title> | 4580 <title>lavcopts</title> |
4453 <para> | 4581 |
4454 This is a list of fields in <option>-lavcopts</option> that you may | 4582 <para> |
4455 be required to change in order to make a complaint movie for VCD, SVCD, | 4583 This is a list of fields in <option>-lavcopts</option> that you may |
4456 or DVD: | 4584 be required to change in order to make a complaint movie for VCD, SVCD, |
4585 or DVD: | |
4457 </para> | 4586 </para> |
4458 | 4587 |
4459 <itemizedlist> | 4588 <itemizedlist> |
4460 <listitem><para> | 4589 <listitem><para> |
4461 <emphasis role="bold">acodec</emphasis>: | 4590 <emphasis role="bold">acodec</emphasis>: |
4464 PCM audio may also be used for DVD, but this is mostly a big waste of | 4593 PCM audio may also be used for DVD, but this is mostly a big waste of |
4465 space. | 4594 space. |
4466 Note that MP3 audio is not compliant for any of these formats, but | 4595 Note that MP3 audio is not compliant for any of these formats, but |
4467 players often have no problem playing it anyway. | 4596 players often have no problem playing it anyway. |
4468 </para></listitem> | 4597 </para></listitem> |
4469 | |
4470 <listitem><para> | 4598 <listitem><para> |
4471 <emphasis role="bold">abitrate</emphasis>: | 4599 <emphasis role="bold">abitrate</emphasis>: |
4472 224 for VCD; up to 384 for SVCD; up to 1536 for DVD, but commonly | 4600 224 for VCD; up to 384 for SVCD; up to 1536 for DVD, but commonly |
4473 used values range from 192 kbps for stereo to 384 kbps for 5.1 channel | 4601 used values range from 192 kbps for stereo to 384 kbps for 5.1 channel |
4474 sound. | 4602 sound. |
4475 </para></listitem> | 4603 </para></listitem> |
4476 | |
4477 <listitem><para> | 4604 <listitem><para> |
4478 <emphasis role="bold">vcodec</emphasis>: | 4605 <emphasis role="bold">vcodec</emphasis>: |
4479 <option>mpeg1video</option> for VCD; | 4606 <option>mpeg1video</option> for VCD; |
4480 <option>mpeg2video</option> for SVCD; | 4607 <option>mpeg2video</option> for SVCD; |
4481 <option>mpeg2video</option> is usually used for DVD but you may also use | 4608 <option>mpeg2video</option> is usually used for DVD but you may also use |
4482 <option>mpeg1video</option> for CIF resolutions. | 4609 <option>mpeg1video</option> for CIF resolutions. |
4483 </para></listitem> | 4610 </para></listitem> |
4484 | |
4485 <listitem><para> | 4611 <listitem><para> |
4486 <emphasis role="bold">keyint</emphasis>: | 4612 <emphasis role="bold">keyint</emphasis>: |
4487 Used to set the GOP size. | 4613 Used to set the GOP size. |
4488 18 for 30fps material, or 15 for 25/24 fps material. | 4614 18 for 30fps material, or 15 for 25/24 fps material. |
4489 Commercial producers seem to prefer keyframe intervals of 12. | 4615 Commercial producers seem to prefer keyframe intervals of 12. |
4490 It is possible to make this much larger and still retain compatibility | 4616 It is possible to make this much larger and still retain compatibility |
4491 with most players. | 4617 with most players. |
4492 A <option>keyint</option> of 25 should never cause any problems. | 4618 A <option>keyint</option> of 25 should never cause any problems. |
4493 </para></listitem> | 4619 </para></listitem> |
4494 | |
4495 <listitem><para> | 4620 <listitem><para> |
4496 <emphasis role="bold">vrc_buf_size</emphasis>: | 4621 <emphasis role="bold">vrc_buf_size</emphasis>: |
4497 327 for VCD, 917 for SVCD, and 1835 for DVD. | 4622 327 for VCD, 917 for SVCD, and 1835 for DVD. |
4498 </para></listitem> | 4623 </para></listitem> |
4499 | |
4500 <listitem><para> | 4624 <listitem><para> |
4501 <emphasis role="bold">vrc_minrate</emphasis>: | 4625 <emphasis role="bold">vrc_minrate</emphasis>: |
4502 1152, for VCD. May be left alone for SVCD and DVD. | 4626 1152, for VCD. May be left alone for SVCD and DVD. |
4503 </para></listitem> | 4627 </para></listitem> |
4504 | |
4505 <listitem><para> | 4628 <listitem><para> |
4506 <emphasis role="bold">vrc_maxrate</emphasis>: | 4629 <emphasis role="bold">vrc_maxrate</emphasis>: |
4507 1152 for VCD; 2500 for SVCD; 9800 for DVD. | 4630 1152 for VCD; 2500 for SVCD; 9800 for DVD. |
4508 For SVCD and DVD, you might wish to use lower values depending on your | 4631 For SVCD and DVD, you might wish to use lower values depending on your |
4509 own personal preferences and requirements. | 4632 own personal preferences and requirements. |
4510 </para></listitem> | 4633 </para></listitem> |
4511 | |
4512 <listitem><para> | 4634 <listitem><para> |
4513 <emphasis role="bold">vbitrate</emphasis>: | 4635 <emphasis role="bold">vbitrate</emphasis>: |
4514 1152 for VCD; | 4636 1152 for VCD; |
4515 up to 2500 for SVCD; | 4637 up to 2500 for SVCD; |
4516 up to 9800 for DVD. | 4638 up to 9800 for DVD. |
4524 than an hour of video on a single-layer DVD. | 4646 than an hour of video on a single-layer DVD. |
4525 </para></listitem> | 4647 </para></listitem> |
4526 </itemizedlist> | 4648 </itemizedlist> |
4527 </sect3> | 4649 </sect3> |
4528 | 4650 |
4651 | |
4529 <sect3 id="menc-feat-vcd-dvd-lavc-examples"> | 4652 <sect3 id="menc-feat-vcd-dvd-lavc-examples"> |
4530 <title>Examples</title> | 4653 <title>Examples</title> |
4531 <para> | 4654 |
4532 This is a typical minimum set of <option>-lavcopts</option> for | 4655 <para> |
4533 encoding video: | 4656 This is a typical minimum set of <option>-lavcopts</option> for |
4534 </para> | 4657 encoding video: |
4535 <para> | 4658 </para> |
4536 VCD: | 4659 <para> |
4537 <screen> | 4660 VCD: |
4538 -lavcopts vcodec=mpeg1video:vrc_buf_size=327:vrc_minrate=1152:\ | 4661 <screen> |
4539 vrc_maxrate=1152:vbitrate=1152:keyint=15:acodec=mp2 | 4662 -lavcopts vcodec=mpeg1video:vrc_buf_size=327:vrc_minrate=1152:\ |
4540 </screen> | 4663 vrc_maxrate=1152:vbitrate=1152:keyint=15:acodec=mp2 |
4541 </para> | 4664 </screen> |
4542 | 4665 </para> |
4543 <para> | 4666 |
4544 SVCD: | 4667 <para> |
4545 <screen> | 4668 SVCD: |
4546 -lavcopts vcodec=mpeg2video:vrc_buf_size=917:vrc_maxrate=2500:vbitrate=1800:\ | 4669 <screen> |
4547 keyint=15:acodec=mp2 | 4670 -lavcopts vcodec=mpeg2video:vrc_buf_size=917:vrc_maxrate=2500:vbitrate=1800:\ |
4548 </screen> | 4671 keyint=15:acodec=mp2 |
4549 </para> | 4672 </screen> |
4550 | 4673 </para> |
4551 <para> | 4674 |
4552 DVD: | 4675 <para> |
4553 <screen> | 4676 DVD: |
4554 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ | 4677 <screen> |
4555 keyint=15:acodec=ac3 | 4678 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ |
4556 </screen> | 4679 keyint=15:acodec=ac3 |
4557 </para> | 4680 </screen> |
4558 | 4681 </para> |
4559 </sect3> | 4682 </sect3> |
4683 | |
4560 | 4684 |
4561 <sect3 id="menc-feat-vcd-dvd-lavc-advanced"> | 4685 <sect3 id="menc-feat-vcd-dvd-lavc-advanced"> |
4562 <title>Advanced Options</title> | 4686 <title>Advanced Options</title> |
4563 <para> | 4687 |
4564 For higher quality encoding, you may also wish to add quality-enhancing | 4688 <para> |
4565 options to lavcopts, such as <option>trell</option>, | 4689 For higher quality encoding, you may also wish to add quality-enhancing |
4566 <option>mbd=2</option>, and others. | 4690 options to lavcopts, such as <option>trell</option>, |
4567 Note that <option>qpel</option> and <option>v4mv</option>, while often | 4691 <option>mbd=2</option>, and others. |
4568 useful with MPEG-4, are not usable with MPEG-1 or MPEG-2. | 4692 Note that <option>qpel</option> and <option>v4mv</option>, while often |
4569 Also, if you are trying to make a very high quality DVD encode, it may | 4693 useful with MPEG-4, are not usable with MPEG-1 or MPEG-2. |
4570 be useful to add <option>dc=10</option> to lavcopts. | 4694 Also, if you are trying to make a very high quality DVD encode, it may |
4571 Doing so may help reduce the appearance of blocks in flat-colored areas. | 4695 be useful to add <option>dc=10</option> to lavcopts. |
4572 Putting it all together, this is an example of a set of lavcopts for a | 4696 Doing so may help reduce the appearance of blocks in flat-colored areas. |
4573 higher quality DVD: | 4697 Putting it all together, this is an example of a set of lavcopts for a |
4574 </para> | 4698 higher quality DVD: |
4575 | 4699 </para> |
4576 <para> | 4700 |
4577 <screen> | 4701 <para> |
4578 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=8000:\ | 4702 <screen> |
4579 keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:\ | 4703 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=8000:\ |
4580 vqmin=1:lmin=1:dc=10 | 4704 keyint=15:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:\ |
4581 </screen> | 4705 vqmin=1:lmin=1:dc=10 |
4582 </para> | 4706 </screen> |
4583 | 4707 </para> |
4584 </sect3> | 4708 </sect3> |
4585 </sect2> | 4709 </sect2> |
4586 | 4710 |
4711 <!-- ********** --> | |
4712 | |
4587 <sect2 id="menc-feat-vcd-dvd-audio"> | 4713 <sect2 id="menc-feat-vcd-dvd-audio"> |
4588 <title>Encoding Audio</title> | 4714 <title>Encoding Audio</title> |
4589 <para> | 4715 |
4590 VCD and SVCD support MPEG-1 layer II audio, using one of | 4716 <para> |
4591 <systemitem class="library">toolame</systemitem>, | 4717 VCD and SVCD support MPEG-1 layer II audio, using one of |
4592 <systemitem class="library">twolame</systemitem>, | 4718 <systemitem class="library">toolame</systemitem>, |
4593 or <systemitem class="library">libavcodec</systemitem>'s MP2 encoder. | 4719 <systemitem class="library">twolame</systemitem>, |
4594 The libavcodec MP2 is far from being as good as the other two libraries, | 4720 or <systemitem class="library">libavcodec</systemitem>'s MP2 encoder. |
4595 however it should always be available to use. | 4721 The libavcodec MP2 is far from being as good as the other two libraries, |
4596 VCD only supports constant bitrate audio (CBR) whereas SVCD supports | 4722 however it should always be available to use. |
4597 variable bitrate (VBR), too. | 4723 VCD only supports constant bitrate audio (CBR) whereas SVCD supports |
4598 Be careful when using VBR because some bad standalone players might not | 4724 variable bitrate (VBR), too. |
4599 support it too well. | 4725 Be careful when using VBR because some bad standalone players might not |
4600 </para> | 4726 support it too well. |
4601 | 4727 </para> |
4602 <para> | 4728 |
4603 For DVD audio, <systemitem class="library">libavcodec</systemitem>'s | 4729 <para> |
4604 AC3 codec is used. | 4730 For DVD audio, <systemitem class="library">libavcodec</systemitem>'s |
4605 </para> | 4731 AC3 codec is used. |
4732 </para> | |
4733 | |
4606 | 4734 |
4607 <sect3 id="menc-feat-vcd-dvd-audio-toolame"> | 4735 <sect3 id="menc-feat-vcd-dvd-audio-toolame"> |
4608 <title>toolame</title> | 4736 <title>toolame</title> |
4609 <para> | 4737 |
4610 For VCD and SVCD: | 4738 <para> |
4611 <screen> | 4739 For VCD and SVCD: |
4612 -oac toolame -toolameopts br=224 | 4740 <screen>-oac toolame -toolameopts br=224</screen> |
4613 </screen> | |
4614 </para> | 4741 </para> |
4615 </sect3> | 4742 </sect3> |
4743 | |
4616 | 4744 |
4617 <sect3 id="menc-feat-vcd-dvd-audio-twolame"> | 4745 <sect3 id="menc-feat-vcd-dvd-audio-twolame"> |
4618 <title>twolame</title> | 4746 <title>twolame</title> |
4619 <para> | 4747 |
4620 For VCD and SVCD: | 4748 <para> |
4621 <screen> | 4749 For VCD and SVCD: |
4622 -oac twolame -twolameopts br=224 | 4750 <screen>-oac twolame -twolameopts br=224</screen> |
4623 </screen> | |
4624 </para> | 4751 </para> |
4625 </sect3> | 4752 </sect3> |
4753 | |
4626 | 4754 |
4627 <sect3 id="menc-feat-vcd-dvd-audio-lavc"> | 4755 <sect3 id="menc-feat-vcd-dvd-audio-lavc"> |
4628 <title>libavcodec</title> | 4756 <title>libavcodec</title> |
4629 <para> | 4757 |
4630 For DVD with 2 channel sound: | 4758 <para> |
4631 <screen> | 4759 For DVD with 2 channel sound: |
4632 -oac lavc -lavcopts acodec=ac3:abitrate=192 | 4760 <screen>-oac lavc -lavcopts acodec=ac3:abitrate=192</screen> |
4633 </screen> | 4761 </para> |
4634 </para> | 4762 |
4635 <para> | 4763 <para> |
4636 For DVD with 5.1 channel sound: | 4764 For DVD with 5.1 channel sound: |
4637 <screen> | 4765 <screen>-channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=384</screen> |
4638 -channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=384 | 4766 </para> |
4639 </screen> | 4767 |
4640 </para> | 4768 <para> |
4641 <para> | 4769 For VCD and SVCD: |
4642 For VCD and SVCD: | 4770 <screen>-oac lavc -lavcopts acodec=mp2:abitrate=224</screen> |
4643 <screen> | |
4644 -oac lavc -lavcopts acodec=mp2:abitrate=224 | |
4645 </screen> | |
4646 </para> | 4771 </para> |
4647 </sect3> | 4772 </sect3> |
4648 | |
4649 </sect2> | 4773 </sect2> |
4774 | |
4775 <!-- ********** --> | |
4650 | 4776 |
4651 <sect2 id="menc-feat-vcd-dvd-all"> | 4777 <sect2 id="menc-feat-vcd-dvd-all"> |
4652 <title>Putting it all Together</title> | 4778 <title>Putting it all Together</title> |
4653 <para> | 4779 |
4654 This section shows some complete commands for creating VCD/SVCD/DVD | 4780 <para> |
4655 compliant videos. | 4781 This section shows some complete commands for creating VCD/SVCD/DVD |
4656 </para> | 4782 compliant videos. |
4783 </para> | |
4784 | |
4657 | 4785 |
4658 <sect3 id="menc-feat-vcd-dvd-all-pal-dvd"> | 4786 <sect3 id="menc-feat-vcd-dvd-all-pal-dvd"> |
4659 <title>PAL DVD</title> | 4787 <title>PAL DVD</title> |
4660 <para> | 4788 |
4661 <screen> | 4789 <para> |
4662 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf scale=720:576,\ | 4790 <screen> |
4663 harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:\ | 4791 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf \ |
4664 vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:\ | 4792 -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 \ |
4665 abitrate=192:aspect=16/9 -ofps 25 \ | 4793 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ |
4794 keyint=15:acodec=ac3:abitrate=192:aspect=16/9 -ofps 25 \ | |
4666 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4795 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
4667 </screen> | 4796 </screen> |
4668 </para> | 4797 </para> |
4669 </sect3> | 4798 </sect3> |
4799 | |
4670 | 4800 |
4671 <sect3 id="menc-feat-vcd-dvd-all-ntsc-dvd"> | 4801 <sect3 id="menc-feat-vcd-dvd-all-ntsc-dvd"> |
4672 <title>NTSC DVD</title> | 4802 <title>NTSC DVD</title> |
4673 <para> | 4803 |
4674 <screen> | 4804 <para> |
4675 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf scale=720:480,\ | 4805 <screen> |
4676 harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:\ | 4806 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf \ |
4677 vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:acodec=ac3:\ | 4807 -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 \ |
4678 abitrate=192:aspect=16/9 -ofps 30000/1001 \ | 4808 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ |
4809 keyint=18:acodec=ac3:abitrate=192:aspect=16/9 -ofps 30000/1001 \ | |
4679 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4810 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
4680 </screen> | 4811 </screen> |
4681 </para> | 4812 </para> |
4682 </sect3> | 4813 </sect3> |
4814 | |
4683 | 4815 |
4684 <sect3 id="menc-feat-vcd-dvd-all-pal-ac3-copy"> | 4816 <sect3 id="menc-feat-vcd-dvd-all-pal-ac3-copy"> |
4685 <title>PAL AVI Containing AC3 Audio to DVD</title> | 4817 <title>PAL AVI Containing AC3 Audio to DVD</title> |
4686 <para> | 4818 |
4687 If the source already has AC3 audio, use -oac copy instead of re-encoding it. | 4819 <para> |
4688 <screen> | 4820 If the source already has AC3 audio, use -oac copy instead of re-encoding it. |
4689 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf scale=720:576,\ | 4821 <screen> |
4690 harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:\ | 4822 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:tsaf \ |
4691 vbitrate=5000:keyint=15:aspect=16/9 -ofps 25 \ | 4823 -vf scale=720:576,harddup -ofps 25 \ |
4692 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4824 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:\ |
4693 </screen> | 4825 keyint=15:aspect=16/9 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
4826 </screen> | |
4694 </para> | 4827 </para> |
4695 </sect3> | 4828 </sect3> |
4829 | |
4696 | 4830 |
4697 <sect3 id="menc-feat-vcd-dvd-all-ntsc-ac3-copy"> | 4831 <sect3 id="menc-feat-vcd-dvd-all-ntsc-ac3-copy"> |
4698 <title>NTSC AVI Containing AC3 Audio to DVD</title> | 4832 <title>NTSC AVI Containing AC3 Audio to DVD</title> |
4699 <para> | 4833 |
4700 If the source already has AC3 audio, and is NTSC @ 24000/1001 fps: | 4834 <para> |
4701 <screen> | 4835 If the source already has AC3 audio, and is NTSC @ 24000/1001 fps: |
4702 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:tsaf:telecine \ | 4836 <screen> |
4837 mencoder -oac copy -ovc lavc -of mpeg -mpegopts format=dvd:tsaf:telecine \ | |
4703 -vf scale=720:480,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:\ | 4838 -vf scale=720:480,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:\ |
4704 vrc_maxrate=9800:vbitrate=5000:keyint=15:aspect=16/9 -ofps 24000/1001 \ | 4839 vrc_maxrate=9800:vbitrate=5000:keyint=15:aspect=16/9 -ofps 24000/1001 \ |
4705 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4840 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
4706 </screen> | 4841 </screen> |
4707 </para> | 4842 </para> |
4708 </sect3> | 4843 </sect3> |
4844 | |
4709 | 4845 |
4710 <sect3 id="menc-feat-vcd-dvd-all-pal-svcd"> | 4846 <sect3 id="menc-feat-vcd-dvd-all-pal-svcd"> |
4711 <title>PAL SVCD</title> | 4847 <title>PAL SVCD</title> |
4712 <para> | 4848 |
4713 <screen> | 4849 <para> |
4714 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ | 4850 <screen> |
4715 scale=480:576,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 4851 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ |
4716 vcodec=mpeg2video:mbd=2:keyint=15:vrc_buf_size=917:vrc_minrate=600:\ | 4852 scale=480:576,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
4717 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224 -ofps 25 \ | 4853 vcodec=mpeg2video:mbd=2:keyint=15:vrc_buf_size=917:vrc_minrate=600:\ |
4718 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4854 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224 -ofps 25 \ |
4855 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | |
4719 </screen> | 4856 </screen> |
4720 </para> | 4857 </para> |
4721 </sect3> | 4858 </sect3> |
4859 | |
4722 | 4860 |
4723 <sect3 id="menc-feat-vcd-dvd-all-ntsc-svcd"> | 4861 <sect3 id="menc-feat-vcd-dvd-all-ntsc-svcd"> |
4724 <title>NTSC SVCD</title> | 4862 <title>NTSC SVCD</title> |
4725 <para> | 4863 |
4726 <screen> | 4864 <para> |
4727 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ | 4865 <screen> |
4728 scale=480:480,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 4866 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xsvcd -vf \ |
4729 vcodec=mpeg2video:mbd=2:keyint=18:vrc_buf_size=917:vrc_minrate=600:\ | 4867 scale=480:480,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
4730 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224 -ofps 30000/1001 \ | 4868 vcodec=mpeg2video:mbd=2:keyint=18:vrc_buf_size=917:vrc_minrate=600:\ |
4731 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4869 vbitrate=2500:vrc_maxrate=2500:acodec=mp2:abitrate=224 -ofps 30000/1001 \ |
4732 </screen> | 4870 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
4871 </screen> | |
4733 </para> | 4872 </para> |
4734 </sect3> | 4873 </sect3> |
4874 | |
4735 | 4875 |
4736 <sect3 id="menc-feat-vcd-dvd-all-pal-vcd"> | 4876 <sect3 id="menc-feat-vcd-dvd-all-pal-vcd"> |
4737 <title>PAL VCD</title> | 4877 <title>PAL VCD</title> |
4738 <para> | 4878 |
4739 <screen> | 4879 <para> |
4740 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ | 4880 <screen> |
4741 scale=352:288,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 4881 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ |
4742 vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:\ | 4882 scale=352:288,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
4743 vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 25 \ | 4883 vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:\ |
4744 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4884 vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 25 \ |
4745 </screen> | 4885 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
4886 </screen> | |
4746 </para> | 4887 </para> |
4747 </sect3> | 4888 </sect3> |
4889 | |
4748 | 4890 |
4749 <sect3 id="menc-feat-vcd-dvd-all-ntsc-vcd"> | 4891 <sect3 id="menc-feat-vcd-dvd-all-ntsc-vcd"> |
4750 <title>NTSC VCD</title> | 4892 <title>NTSC VCD</title> |
4751 <para> | 4893 |
4752 <screen> | 4894 <para> |
4753 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ | 4895 <screen> |
4754 scale=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ | 4896 mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd -vf \ |
4755 vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:\ | 4897 scale=352:240,harddup -srate 44100 -af lavcresample=44100 -lavcopts \ |
4756 vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 30000/1001 \ | 4898 vcodec=mpeg1video:keyint=18:vrc_buf_size=327:vrc_minrate=1152:\ |
4757 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> | 4899 vbitrate=1152:vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 30000/1001 \ |
4758 </screen> | 4900 -o <replaceable>movie.mpg</replaceable> <replaceable>movie.avi</replaceable> |
4901 </screen> | |
4759 </para> | 4902 </para> |
4760 </sect3> | 4903 </sect3> |
4761 | |
4762 </sect2> | 4904 </sect2> |
4763 | |
4764 </sect1> | 4905 </sect1> |
4765 | |
4766 </chapter> | 4906 </chapter> |