1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>10.3. Encoding with the libavcodec codec family</title><link rel="stylesheet" href="default.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="MPlayer - Il Visualizzatore di film"><link rel="up" href="encoding-guide.html" title="Capitolo 10. La codifica con MEncoder"><link rel="prev" href="menc-feat-telecine.html" title="10.2. Come trattare telecine e interlacciamento nei DVD NTSC"><link rel="next" href="menc-feat-xvid.html" title="10.4. Encoding with the Xvid codec"><link rel="preface" href="howtoread.html" title="Come leggere questa documentazione"><link rel="chapter" href="intro.html" title="Capitolo 1. Introduzione"><link rel="chapter" href="install.html" title="Capitolo 2. Installazione"><link rel="chapter" href="usage.html" title="Capitolo 3. Utilizzo"><link rel="chapter" href="cd-dvd.html" title="Capitolo 4. Utilizzo CD/DVD"><link rel="chapter" href="tv.html" title="Capitolo 5. TV"><link rel="chapter" href="radio.html" title="Capitolo 6. Radio"><link rel="chapter" href="video.html" title="Capitolo 7. Dispositivi di uscita video"><link rel="chapter" href="ports.html" title="Capitolo 8. Ports"><link rel="chapter" href="mencoder.html" title="Capitolo 9. Utilizzo base di MEncoder"><link rel="chapter" href="encoding-guide.html" title="Capitolo 10. La codifica con MEncoder"><link rel="chapter" href="faq.html" title="Capitolo 11. Frequently Asked Questions"><link rel="appendix" href="bugreports.html" title="Appendice A. Come segnalare i bug (errori)"><link rel="appendix" href="skin.html" title="Appendice B. MPlayer skin format"><link rel="subsection" href="menc-feat-enc-libavcodec.html#menc-feat-enc-libavcodec-video-codecs" title="10.3.1. libavcodec's video codecs"><link rel="subsection" href="menc-feat-enc-libavcodec.html#menc-feat-enc-libavcodec-audio-codecs" title="10.3.2. libavcodec's audio codecs"><link rel="subsection" href="menc-feat-enc-libavcodec.html#menc-feat-dvd-mpeg4-lavc-encoding-options" title="10.3.3. Encoding options of libavcodec"><link rel="subsection" href="menc-feat-enc-libavcodec.html#menc-feat-mpeg4-lavc-example-settings" title="10.3.4. Encoding setting examples"><link rel="subsection" href="menc-feat-enc-libavcodec.html#custommatrices" title="10.3.5. Custom inter/intra matrices"><link rel="subsection" href="menc-feat-enc-libavcodec.html#menc-feat-dvd-mpeg4-example" title="10.3.6. Example"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">10.3. Encoding with the <code class="systemitem">libavcodec</code>
2
codec family</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="menc-feat-telecine.html">Indietro</a> </td><th width="60%" align="center">Capitolo 10. La codifica con <span class="application">MEncoder</span></th><td width="20%" align="right"> <a accesskey="n" href="menc-feat-xvid.html">Avanti</a></td></tr></table><hr></div><div class="sect1" title="10.3. Encoding with the libavcodec codec family"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="menc-feat-enc-libavcodec"></a>10.3. Encoding with the <code class="systemitem">libavcodec</code>
3
codec family</h2></div></div></div><p>
4
<code class="systemitem">libavcodec</code>
5
provides simple encoding to a lot of interesting video and audio formats.
6
You can encode to the following codecs (more or less up to date):
7
</p><div class="sect2" title="10.3.1. libavcodec's video codecs"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-enc-libavcodec-video-codecs"></a>10.3.1. <code class="systemitem">libavcodec</code>'s
8
video codecs</h3></div></div></div><p>
9
</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th>Video codec name</th><th>Description</th></tr></thead><tbody><tr><td>mjpeg</td><td>Motion JPEG</td></tr><tr><td>ljpeg</td><td>lossless JPEG</td></tr><tr><td>jpegls</td><td>JPEG LS</td></tr><tr><td>targa</td><td>Targa image</td></tr><tr><td>gif</td><td>GIF image</td></tr><tr><td>bmp</td><td>BMP image</td></tr><tr><td>png</td><td>PNG image</td></tr><tr><td>h261</td><td>H.261</td></tr><tr><td>h263</td><td>H.263 </td></tr><tr><td>h263p</td><td>H.263+</td></tr><tr><td>mpeg4</td><td>ISO standard MPEG-4 (DivX, Xvid compatible)</td></tr><tr><td>msmpeg4</td><td>pre-standard MPEG-4 variant by MS, v3 (AKA DivX3)</td></tr><tr><td>msmpeg4v2</td><td>pre-standard MPEG-4 by MS, v2 (used in old ASF files)</td></tr><tr><td>wmv1</td><td>Windows Media Video, version 1 (AKA WMV7)</td></tr><tr><td>wmv2</td><td>Windows Media Video, version 2 (AKA WMV8)</td></tr><tr><td>rv10</td><td>RealVideo 1.0</td></tr><tr><td>rv20</td><td>RealVideo 2.0</td></tr><tr><td>mpeg1video</td><td>MPEG-1 video</td></tr><tr><td>mpeg2video</td><td>MPEG-2 video</td></tr><tr><td>huffyuv</td><td>lossless compression</td></tr><tr><td>ffvhuff</td><td>FFmpeg modified huffyuv lossless</td></tr><tr><td>asv1</td><td>ASUS Video v1</td></tr><tr><td>asv2</td><td>ASUS Video v2</td></tr><tr><td>ffv1</td><td>FFmpeg's lossless video codec</td></tr><tr><td>svq1</td><td>Sorenson video 1</td></tr><tr><td>flv</td><td>Sorenson H.263 used in Flash Video</td></tr><tr><td>flashsv</td><td>Flash Screen Video</td></tr><tr><td>dvvideo</td><td>Sony Digital Video</td></tr><tr><td>snow</td><td>FFmpeg's experimental wavelet-based codec</td></tr><tr><td>zbmv</td><td>Zip Blocks Motion Video</td></tr></tbody></table></div><p>
11
The first column contains the codec names that should be passed after the
12
<code class="literal">vcodec</code> config,
13
like: <tt class="option">-lavcopts vcodec=msmpeg4</tt>
14
</p><div class="informalexample"><p>
15
An example with MJPEG compression:
16
</p><pre class="screen">
17
mencoder dvd://2 -o <em class="replaceable"><code>title2.avi</code></em> -ovc lavc -lavcopts vcodec=mjpeg -oac copy
19
</p></div></div><div class="sect2" title="10.3.2. libavcodec's audio codecs"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-enc-libavcodec-audio-codecs"></a>10.3.2. <code class="systemitem">libavcodec</code>'s
20
audio codecs</h3></div></div></div><p>
21
</p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><thead><tr><th>Audio codec name</th><th>Description</th></tr></thead><tbody><tr><td>mp2</td><td>MPEG Layer 2</td></tr><tr><td>ac3</td><td>AC-3, AKA Dolby Digital</td></tr><tr><td>adpcm_ima_wav</td><td>IMA adaptive PCM (4 bits per sample, 4:1 compression)</td></tr><tr><td>sonic</td><td>experimental FFmpeg lossy codec</td></tr><tr><td>sonicls</td><td>experimental FFmpeg lossless codec</td></tr><tr><td>vorbis</td><td>Xiph Ogg Vorbis codec</td></tr><tr><td>wmav1</td><td>Windows Media Audio v1 codec</td></tr><tr><td>wmav2</td><td>Windows Media Audio v2 codec</td></tr></tbody></table></div><p>
23
The first column contains the codec names that should be passed after the
24
<code class="literal">acodec</code> option, like: <tt class="option">-lavcopts acodec=ac3</tt>
25
</p><div class="informalexample"><p>
26
An example with AC-3 compression:
27
</p><pre class="screen">
28
mencoder dvd://2 -o <em class="replaceable"><code>title2.avi</code></em> -oac lavc -lavcopts acodec=ac3 -ovc copy
31
Contrary to <code class="systemitem">libavcodec</code>'s video
32
codecs, its audio codecs do not make a wise usage of the bits they are
33
given as they lack some minimal psychoacoustic model (if at all)
34
which most other codec implementations feature.
35
However, note that all these audio codecs are very fast and work
36
out-of-the-box everywhere <span class="application">MEncoder</span> has been
37
compiled with <code class="systemitem">libavcodec</code> (which
38
is the case most of time), and do not depend on external libraries.
39
</p></div><div class="sect2" title="10.3.3. Encoding options of libavcodec"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-dvd-mpeg4-lavc-encoding-options"></a>10.3.3. Encoding options of libavcodec</h3></div></div></div><p>
40
Ideally, you would probably want to be able to just tell the encoder to switch
41
into "high quality" mode and move on.
42
That would probably be nice, but unfortunately hard to implement as different
43
encoding options yield different quality results depending on the source
44
material. That is because compression depends on the visual properties of the
46
For example, anime and live action have very different properties and
47
thus require different options to obtain optimum encoding.
48
The good news is that some options should never be left out, like
49
<tt class="option">mbd=2</tt>, <tt class="option">trell</tt>, and <tt class="option">v4mv</tt>.
50
See below for a detailed description of common encoding options.
51
</p><div class="itemizedlist" title="Options to adjust:"><p class="title"><b>Options to adjust:</b></p><ul class="itemizedlist" type="disc"><li class="listitem"><p>
52
<span class="bold"><strong>vmax_b_frames</strong></span>: 1 or 2 is good, depending on
54
Note that if you need to have your encode be decodable by DivX5, you
55
need to activate closed GOP support, using
56
<code class="systemitem">libavcodec</code>'s <tt class="option">cgop</tt>
57
option, but you need to deactivate scene detection, which
58
is not a good idea as it will hurt encode efficiency a bit.
59
</p></li><li class="listitem"><p>
60
<span class="bold"><strong>vb_strategy=1</strong></span>: helps in high-motion scenes.
61
On some videos, vmax_b_frames may hurt quality, but vmax_b_frames=2 along
62
with vb_strategy=1 helps.
63
</p></li><li class="listitem"><p>
64
<span class="bold"><strong>dia</strong></span>: motion search range. Bigger is better
66
Negative values are a completely different scale.
67
Good values are -1 for a fast encode, or 2-4 for slower.
68
</p></li><li class="listitem"><p>
69
<span class="bold"><strong>predia</strong></span>: motion search pre-pass.
70
Not as important as dia. Good values are 1 (default) to 4. Requires preme=2
72
</p></li><li class="listitem"><p>
73
<span class="bold"><strong>cmp, subcmp, precmp</strong></span>: Comparison function for
75
Experiment with values of 0 (default), 2 (hadamard), 3 (dct), and 6 (rate
77
0 is fastest, and sufficient for precmp.
78
For cmp and subcmp, 2 is good for anime, and 3 is good for live action.
79
6 may or may not be slightly better, but is slow.
80
</p></li><li class="listitem"><p>
81
<span class="bold"><strong>last_pred</strong></span>: Number of motion predictors to
82
take from the previous frame.
83
1-3 or so help at little speed cost.
84
Higher values are slow for no extra gain.
85
</p></li><li class="listitem"><p>
86
<span class="bold"><strong>cbp, mv0</strong></span>: Controls the selection of
87
macroblocks. Small speed cost for small quality gain.
88
</p></li><li class="listitem"><p>
89
<span class="bold"><strong>qprd</strong></span>: adaptive quantization based on the
90
macroblock's complexity.
91
May help or hurt depending on the video and other options.
92
This can cause artifacts unless you set vqmax to some reasonably small value
93
(6 is good, maybe as low as 4); vqmin=1 should also help.
94
</p></li><li class="listitem"><p>
95
<span class="bold"><strong>qns</strong></span>: very slow, especially when combined
97
This option will make the encoder minimize noise due to compression
98
artifacts instead of making the encoded video strictly match the source.
99
Do not use this unless you have already tweaked everything else as far as it
100
will go and the results still are not good enough.
101
</p></li><li class="listitem"><p>
102
<span class="bold"><strong>vqcomp</strong></span>: Tweak ratecontrol.
103
What values are good depends on the movie.
104
You can safely leave this alone if you want.
105
Reducing vqcomp puts more bits on low-complexity scenes, increasing it puts
106
them on high-complexity scenes (default: 0.5, range: 0-1. recommended range:
108
</p></li><li class="listitem"><p>
109
<span class="bold"><strong>vlelim, vcelim</strong></span>: Sets the single coefficient
110
elimination threshold for luminance and chroma planes.
111
These are encoded separately in all MPEG-like algorithms.
112
The idea behind these options is to use some good heuristics to determine
113
when the change in a block is less than the threshold you specify, and in
114
such a case, to just encode the block as "no change".
115
This saves bits and perhaps speeds up encoding. vlelim=-4 and vcelim=9
116
seem to be good for live movies, but seem not to help with anime;
117
when encoding animation, you should probably leave them unchanged.
118
</p></li><li class="listitem"><p>
119
<span class="bold"><strong>qpel</strong></span>: Quarter pixel motion estimation.
120
MPEG-4 uses half pixel precision for its motion search by default,
121
therefore this option comes with an overhead as more information will be
122
stored in the encoded file.
123
The compression gain/loss depends on the movie, but it is usually not very
125
qpel always incurs a significant cost in CPU decode time (+25% in
127
</p></li><li class="listitem"><p>
128
<span class="bold"><strong>psnr</strong></span>: does not affect the actual encoding,
129
but writes a log file giving the type/size/quality of each frame, and
130
prints a summary of PSNR (Peak Signal to Noise Ratio) at the end.
131
</p></li></ul></div><div class="itemizedlist" title="Options not recommended to play with:"><p class="title"><b>Options not recommended to play with:</b></p><ul class="itemizedlist" type="disc"><li class="listitem"><p>
132
<span class="bold"><strong>vme</strong></span>: The default is best.
133
</p></li><li class="listitem"><p>
134
<span class="bold"><strong>lumi_mask, dark_mask</strong></span>: Psychovisual adaptive
136
You do not want to play with those options if you care about quality.
137
Reasonable values may be effective in your case, but be warned this is very
139
</p></li><li class="listitem"><p>
140
<span class="bold"><strong>scplx_mask</strong></span>: Tries to prevent blocky
141
artifacts, but postprocessing is better.
142
</p></li></ul></div></div><div class="sect2" title="10.3.4. Encoding setting examples"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-mpeg4-lavc-example-settings"></a>10.3.4. Encoding setting examples</h3></div></div></div><p>
143
The following settings are examples of different encoding
144
option combinations that affect the speed vs quality tradeoff
145
at the same target bitrate.
147
All the encoding settings were tested on a 720x448 @30000/1001 fps
148
video sample, the target bitrate was 900kbps, and the machine was an
149
AMD-64 3400+ at 2400 MHz in 64 bits mode.
150
Each encoding setting features the measured encoding speed (in
151
frames per second) and the PSNR loss (in dB) compared to the "very
152
high quality" setting.
153
Please understand that depending on your source, your machine type
154
and development advancements, you may get very different results.
156
</p><div class="informaltable"><table border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Description</th><th>Encoding options</th><th>speed (in fps)</th><th>Relative PSNR loss (in dB)</th></tr></thead><tbody><tr><td>Very high quality</td><td><tt class="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</tt></td><td>6fps</td><td>0dB</td></tr><tr><td>High quality</td><td><tt class="option">vcodec=mpeg4:mbd=2:trell:v4mv:last_pred=2:dia=-1:vmax_b_frames=2:vb_strategy=1:cmp=3:subcmp=3:precmp=0:vqcomp=0.6:turbo</tt></td><td>15fps</td><td>-0.5dB</td></tr><tr><td>Fast</td><td><tt class="option">vcodec=mpeg4:mbd=2:trell:v4mv:turbo</tt></td><td>42fps</td><td>-0.74dB</td></tr><tr><td>Realtime</td><td><tt class="option">vcodec=mpeg4:mbd=2:turbo</tt></td><td>54fps</td><td>-1.21dB</td></tr></tbody></table></div><p>
157
</p></div><div class="sect2" title="10.3.5. Custom inter/intra matrices"><div class="titlepage"><div><div><h3 class="title"><a name="custommatrices"></a>10.3.5. Custom inter/intra matrices</h3></div></div></div><p>
159
<code class="systemitem">libavcodec</code>
160
you are able to set custom inter (I-frames/keyframes) and intra
161
(P-frames/predicted frames) matrices. It is supported by many of the codecs:
162
<code class="systemitem">mpeg1video</code> and <code class="systemitem">mpeg2video</code>
163
are reported as working.
165
A typical usage of this feature is to set the matrices preferred by the
166
<a class="ulink" href="http://www.kvcd.net/" target="_top">KVCD</a> specifications.
168
The <span class="bold"><strong>KVCD "Notch" Quantization Matrix:</strong></span>
171
</p><pre class="screen">
172
8 9 12 22 26 27 29 34
173
9 10 14 26 27 29 34 37
174
12 14 18 27 29 34 37 38
175
22 26 27 31 36 37 38 40
176
26 27 29 36 39 38 40 48
177
27 29 34 37 38 40 48 58
178
29 34 37 38 40 48 58 69
179
34 37 38 40 48 58 69 79
183
</p><pre class="screen">
184
16 18 20 22 24 26 28 30
185
18 20 22 24 26 28 30 32
186
20 22 24 26 28 30 32 34
187
22 24 26 30 32 32 34 36
188
24 26 28 32 34 34 36 38
189
26 28 30 32 34 36 38 40
190
28 30 32 34 36 38 42 42
191
30 32 34 36 38 40 42 44
195
</p><pre class="screen">
196
mencoder <em class="replaceable"><code>input.avi</code></em> -o <em class="replaceable"><code>output.avi</code></em> -oac copy -ovc lavc \
197
-lavcopts inter_matrix=...:intra_matrix=...
200
</p><pre class="screen">
201
mencoder <em class="replaceable"><code>input.avi</code></em> -ovc lavc -lavcopts \
202
vcodec=mpeg2video:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,\
203
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,\
204
29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79\
205
:inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,\
206
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,\
207
36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -oac copy -o svcd.mpg
209
</p></div><div class="sect2" title="10.3.6. Example"><div class="titlepage"><div><div><h3 class="title"><a name="menc-feat-dvd-mpeg4-example"></a>10.3.6. Example</h3></div></div></div><p>
210
So, you have just bought your shiny new copy of Harry Potter and the Chamber
211
of Secrets (widescreen edition, of course), and you want to rip this DVD
212
so that you can add it to your Home Theatre PC. This is a region 1 DVD,
213
so it is NTSC. The example below will still apply to PAL, except you will
214
omit <tt class="option">-ofps 24000/1001</tt> (because the output framerate is the
215
same as the input framerate), and of course the crop dimensions will be
218
After running <tt class="option">mplayer dvd://1</tt>, we follow the process
219
detailed in the section <a class="link" href="menc-feat-telecine.html" title="10.2. Come trattare telecine e interlacciamento nei DVD NTSC">How to deal
220
with telecine and interlacing in NTSC DVDs</a> and discover that it is
221
24000/1001 fps progressive video, which means that we need not use an inverse
222
telecine filter, such as <tt class="option">pullup</tt> or
223
<tt class="option">filmdint</tt>.
224
</p><p><a name="menc-feat-dvd-mpeg4-example-crop"></a>
225
Next, we want to determine the appropriate crop rectangle, so we use the
227
</p><pre class="screen">mplayer dvd://1 -vf cropdetect</pre><p>
228
Make sure you seek to a fully filled frame (such as a bright scene,
229
past the opening credits and logos), and
230
you will see in <span class="application">MPlayer</span>'s console output:
231
</p><pre class="screen">crop area: X: 0..719 Y: 57..419 (-vf crop=720:362:0:58)</pre><p>
232
We then play the movie back with this filter to test its correctness:
233
</p><pre class="screen">mplayer dvd://1 -vf crop=720:362:0:58</pre><p>
234
And we see that it looks perfectly fine. Next, we ensure the width and
235
height are a multiple of 16. The width is fine, however the height is
236
not. Since we did not fail 7th grade math, we know that the nearest
237
multiple of 16 lower than 362 is 352.
239
We could just use <tt class="option">crop=720:352:0:58</tt>, but it would be nice
240
to take a little off the top and a little off the bottom so that we
241
retain the center. We have shrunk the height by 10 pixels, but we do not
242
want to increase the y-offset by 5-pixels since that is an odd number and
243
will adversely affect quality. Instead, we will increase the y-offset by
245
</p><pre class="screen">mplayer dvd://1 -vf crop=720:352:0:62</pre><p>
246
Another reason to shave pixels from both the top and the bottom is that we
247
ensure we have eliminated any half-black pixels if they exist. Note that if
248
your video is telecined, make sure the <tt class="option">pullup</tt> filter (or
249
whichever inverse telecine filter you decide to use) appears in the filter
250
chain before you crop. If it is interlaced, deinterlace before cropping.
251
(If you choose to preserve the interlaced video, then make sure your
252
vertical crop offset is a multiple of 4.)
254
If you are really concerned about losing those 10 pixels, you might
255
prefer instead to scale the dimensions down to the nearest multiple of 16.
256
The filter chain would look like:
257
</p><pre class="screen">-vf crop=720:362:0:58,scale=720:352</pre><p>
258
Scaling the video down like this will mean that some small amount of
259
detail is lost, though it probably will not be perceptible. Scaling up will
260
result in lower quality (unless you increase the bitrate). Cropping
261
discards those pixels altogether. It is a tradeoff that you will want to
262
consider for each circumstance. For example, if the DVD video was made
263
for television, you might want to avoid vertical scaling, since the line
264
sampling corresponds to the way the content was originally recorded.
266
On inspection, we see that our movie has a fair bit of action and high
267
amounts of detail, so we pick 2400Kbit for our bitrate.
269
We are now ready to do the two pass encode. Pass one:
270
</p><pre class="screen">
271
mencoder dvd://1 -ofps 24000/1001 -oac copy -o <em class="replaceable"><code>Harry_Potter_2.avi</code></em> -ovc lavc \
272
-lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:autoaspect:vpass=1 \
273
-vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2
275
And pass two is the same, except that we specify <tt class="option">vpass=2</tt>:
276
</p><pre class="screen">
277
mencoder dvd://1 -ofps 24000/1001 -oac copy -o <em class="replaceable"><code>Harry_Potter_2.avi</code></em> -ovc lavc \
278
-lavcopts vcodec=mpeg4:vbitrate=2400:v4mv:mbd=2:trell:cmp=3:subcmp=3:autoaspect:vpass=2 \
279
-vf pullup,softskip,crop=720:352:0:62,hqdn3d=2:1:2
282
The options <tt class="option">v4mv:mbd=2:trell</tt> will greatly increase the
283
quality at the expense of encoding time. There is little reason to leave
284
these options out when the primary goal is quality. The options
285
<tt class="option">cmp=3:subcmp=3</tt> select a comparison function that
286
yields higher quality than the defaults. You might try experimenting with
287
this parameter (refer to the man page for the possible values) as
288
different functions can have a large impact on quality depending on the
289
source material. For example, if you find
290
<code class="systemitem">libavcodec</code> produces too much
291
blocky artifacting, you could try selecting the experimental NSSE as
292
comparison function via <tt class="option">*cmp=10</tt>.
294
For this movie, the resulting AVI will be 138 minutes long and nearly
295
3GB. And because you said that file size does not matter, this is a
296
perfectly acceptable size. However, if you had wanted it smaller, you
297
could try a lower bitrate. Increasing bitrates have diminishing
298
returns, so while we might clearly see an improvement from 1800Kbit to
299
2000Kbit, it might not be so noticeable above 2000Kbit. Feel
300
free to experiment until you are happy.
302
Because we passed the source video through a denoise filter, you may want
303
to add some of it back during playback. This, along with the
304
<tt class="option">spp</tt> post-processing filter, drastically improves the
305
perception of quality and helps eliminate blocky artifacts in the video.
306
With <span class="application">MPlayer</span>'s <tt class="option">autoq</tt> option,
307
you can vary the amount of post-processing done by the spp filter
308
depending on available CPU. Also, at this point, you may want to apply
309
gamma and/or color correction to best suit your display. For example:
310
</p><pre class="screen">
311
mplayer <em class="replaceable"><code>Harry_Potter_2.avi</code></em> -vf spp,noise=9ah:5ah,eq2=1.2 -autoq 3
313
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="menc-feat-telecine.html">Indietro</a> </td><td width="20%" align="center"><a accesskey="u" href="encoding-guide.html">Risali</a></td><td width="40%" align="right"> <a accesskey="n" href="menc-feat-xvid.html">Avanti</a></td></tr><tr><td width="40%" align="left" valign="top">10.2. Come trattare telecine e interlacciamento nei DVD NTSC </td><td width="20%" align="center"><a accesskey="h" href="index.html">Partenza</a></td><td width="40%" align="right" valign="top"> 10.4. Encoding with the <code class="systemitem">Xvid</code>
314
codec</td></tr></table></div></body></html>