2002-06-02 18:38:01 +00:00
|
|
|
Description of what all those libavcodec options do ...
|
|
|
|
WARNING: I am no encoding expert so the recommendations might be bad ...
|
|
|
|
if you find any errors, missing stuff, ... send a patch or cvs commit if you
|
|
|
|
have an cvs account :)
|
|
|
|
|
|
|
|
lavcopts: (encoder options)
|
|
|
|
---------------------------
|
2002-05-17 11:50:23 +00:00
|
|
|
|
2002-07-10 13:58:54 +00:00
|
|
|
vqmin 2-31 (minimum quantizer) for pass1/2
|
|
|
|
1 is not recommended (much larger file, little quality difference (if u are lucky)
|
|
|
|
and other weird things (if u are less lucky))
|
|
|
|
weird things: msmpeg4, h263 will be very low quality
|
|
|
|
ratecontrol will be confused -> lower quality
|
|
|
|
some decoders will not be able to decode it
|
2002-08-25 21:43:22 +00:00
|
|
|
2 is recommended for normal mpeg4/mpeg1video encoding (default)
|
|
|
|
3 is recommended for h263(p)/msmpeg4
|
2002-06-02 18:38:01 +00:00
|
|
|
the reason for 3 instead of 2 is that 2 could lead to overflows
|
|
|
|
(this will be fixed for h263(p) by changing the quanizer per MB in
|
|
|
|
the future, but msmpeg4 doesnt support that so it cant be fixed for
|
|
|
|
that)
|
|
|
|
|
|
|
|
vqscale 1-31 quantizer for constant quantizer / constant quality encoding
|
|
|
|
1 is not recommended (much larger file, little quality difference and
|
|
|
|
possible other weird things)
|
2002-05-17 11:50:23 +00:00
|
|
|
lower means better quality but larger files
|
|
|
|
see vqmin
|
|
|
|
|
|
|
|
vqmax 1-31 (maximum quantizer) for pass1/2
|
2002-08-25 21:43:22 +00:00
|
|
|
31 default
|
2002-05-17 11:50:23 +00:00
|
|
|
10-31 should be a sane range
|
|
|
|
|
|
|
|
vqdiff 1-31 (maximum quantizer difference between I or P frames) for pass1/2
|
|
|
|
3 default
|
|
|
|
|
2002-06-02 18:38:01 +00:00
|
|
|
vmax_b_frames 0-4 (maximum number of B frames between non B frames)
|
2002-05-17 11:50:23 +00:00
|
|
|
0 no b frames (default)
|
2002-08-25 21:43:22 +00:00
|
|
|
0-2 is a sane range for mpeg4
|
2002-05-17 11:50:23 +00:00
|
|
|
|
|
|
|
vme 0-5 (motion estimation)
|
|
|
|
0 none (not recommanded, very lq)
|
|
|
|
1 full (not recommanded, too slow)
|
|
|
|
2 log (not recommanded, lq)
|
|
|
|
3 phods (not recommanded, lq)
|
|
|
|
4 EPZS (default)
|
|
|
|
5 X1
|
|
|
|
|
|
|
|
vhq (high quality mode)
|
2002-06-02 18:38:01 +00:00
|
|
|
encode each MB as in all modes and choose the best (this is slow but
|
|
|
|
better filesize/quality)
|
2002-05-17 11:50:23 +00:00
|
|
|
disabled by default
|
|
|
|
|
|
|
|
v4mv
|
|
|
|
allow 4 MV per MB (little difference in filesize/quality)
|
|
|
|
disabled by default
|
2002-06-02 18:38:01 +00:00
|
|
|
cannot be used with B frames (should now work in lq mode)
|
2002-05-17 11:50:23 +00:00
|
|
|
|
|
|
|
keyint 0-300 (maximum interval between keyframes)
|
2002-06-02 18:38:01 +00:00
|
|
|
keyframes are needed for seeking as seeking is only possible to a
|
|
|
|
keyframe but they need more space than non-keyframes so larger numbers here
|
|
|
|
mean slightly smaller files, but less precise seeking
|
2002-05-17 11:50:23 +00:00
|
|
|
0 no keyframes
|
2002-06-02 18:38:01 +00:00
|
|
|
>300 is not recommended as the quality might be bad (depends upon
|
|
|
|
decoder, encoder and luck)
|
2002-08-25 21:43:22 +00:00
|
|
|
for strict mpeg1/2/4 compliance this would have to be <=132
|
2002-05-17 11:50:23 +00:00
|
|
|
|
|
|
|
vb_strategy 0-1 for pass 2
|
2002-06-02 18:38:01 +00:00
|
|
|
0 allways use the max number of B frames (default)
|
|
|
|
1 avoid B frames in high motion scenes (this will cause bitrate
|
|
|
|
misprediction)
|
2002-05-17 11:50:23 +00:00
|
|
|
|
|
|
|
vpass
|
|
|
|
1 first pass
|
|
|
|
2 second pass
|
2002-06-02 18:38:01 +00:00
|
|
|
(only need to specify if two-pass encoding is used)
|
2002-09-24 11:23:23 +00:00
|
|
|
Tip: u can try to use constant quantizer mode for pass1 (vqscale=<quantizer>)
|
2002-11-14 19:33:19 +00:00
|
|
|
for huffyuv:
|
|
|
|
pass 1 saves statistics
|
|
|
|
pass 2 encodes with a optimal huffman table based upon the pass 1 stats
|
2002-05-17 11:50:23 +00:00
|
|
|
|
2002-06-02 18:38:01 +00:00
|
|
|
vbitrate (kbits per second) for pass1/2
|
2002-05-17 11:50:23 +00:00
|
|
|
800 is default
|
2002-06-02 18:38:01 +00:00
|
|
|
(if value is bigger then 16000 it is interpreted as bit not kbit!)
|
2002-05-17 11:50:23 +00:00
|
|
|
|
|
|
|
vratetol (filesize tolerance in kbit) for pass1/2
|
2002-06-02 18:38:01 +00:00
|
|
|
this is just an approximation, the real difference can be much smaller
|
|
|
|
or larger
|
|
|
|
1000-100000 is a sane range
|
2002-05-17 11:50:23 +00:00
|
|
|
8000 is default
|
|
|
|
|
2002-08-25 21:43:22 +00:00
|
|
|
vrc_maxrate (maximum bitrate in kbit/sec) for pass1/2
|
|
|
|
vrc_minrate (minimum bitrate in kbit/sec) for pass1/2
|
|
|
|
vrc_buf_size (buffer size in kbit) for pass1/2
|
|
|
|
this is for stuff like VCD
|
|
|
|
VCD: FIXME
|
|
|
|
SVCD: ...
|
|
|
|
DVD: ...
|
|
|
|
Note: vratetol should not be too large during the 2.pass or there might
|
|
|
|
be problems if vrc_(min|max)rate is used
|
|
|
|
|
|
|
|
vb_qfactor (-31.0-31.0) for pass1/2
|
|
|
|
1.25 is default
|
|
|
|
vi_qfactor (-31.0-31.0) for pass1/2
|
|
|
|
0.8 is default
|
|
|
|
vb_qoffset (-31.0-31.0) for pass1/2
|
|
|
|
1.25 is default
|
|
|
|
vi_qoffset (-31.0-31.0) for pass1/2
|
|
|
|
0.0 is default
|
|
|
|
if v{b|i}_qfactor > 0
|
|
|
|
I/B-Frame quantizer = P-Frame quantizer * v{b|i}_qfactor + v{b|i}_qoffset
|
|
|
|
else
|
|
|
|
do normal ratecontrol (dont lock to next P frame quantizer) and
|
|
|
|
set q= -q * v{b|i}_qfactor + v{b|i}_qoffset
|
2002-06-02 18:38:01 +00:00
|
|
|
tip: to do constant quantizer encoding with different quantizers for
|
|
|
|
I/P and B frames you can use:
|
|
|
|
vqmin=<ip_quant>:vqmax=<ip_quant>:vb_qfactor=<b_quant/ip_quant>
|
2002-05-17 11:50:23 +00:00
|
|
|
|
2002-08-25 21:43:22 +00:00
|
|
|
vqblur (0.0-1.0) quantizer blur (pass1)
|
2002-05-17 11:50:23 +00:00
|
|
|
0.0 qblur disabled
|
|
|
|
0.5 is the default
|
|
|
|
1.0 average the quantizer over all previous frames
|
2002-06-02 18:38:01 +00:00
|
|
|
larger values will average the quantizer more over time so that it will
|
|
|
|
be changed slower
|
2002-08-25 21:43:22 +00:00
|
|
|
vqblur (0.0-99.0) quantizer blur (pass2)
|
|
|
|
gaussian blur (gaussian blur cant be done during pass 1 as the future quantizers arent known)
|
|
|
|
0.5 is the default
|
|
|
|
larger values will average the quantizer more over time so that it will
|
|
|
|
be changed slower
|
2002-05-17 11:50:23 +00:00
|
|
|
|
2002-08-25 21:43:22 +00:00
|
|
|
vqcomp quantizer compression (for pass1/2)
|
|
|
|
depends upon vrc_eq
|
|
|
|
|
|
|
|
vrc_eq the main ratecontrol equation (for pass1/2)
|
|
|
|
1 constant bitrate
|
|
|
|
tex constant quality
|
|
|
|
1+(tex/avgTex-1)*qComp approximately the equation of the old ratecontrol code
|
|
|
|
tex^qComp with qcomp 0.5 or something like that (default)
|
|
|
|
|
|
|
|
infix operators: +,-,*,/,^
|
|
|
|
variables:
|
|
|
|
tex texture complexity
|
|
|
|
iTex,pTex intra, non intra texture complexity
|
|
|
|
avgTex average texture complexity
|
|
|
|
avgIITex average intra texture complexity in I frames
|
|
|
|
avgPITex average intra texture complexity in P frames
|
|
|
|
avgPPTex average non intra texture complexity in P frames
|
|
|
|
avgBPTex average non intra texture complexity in B frames
|
|
|
|
mv bits used for MVs
|
|
|
|
fCode maximum length of MV in log2 scale
|
|
|
|
iCount number of intra MBs / number of MBs
|
|
|
|
var spatial complexity
|
|
|
|
mcVar temporal complexity
|
|
|
|
qComp qcomp from the command line
|
|
|
|
isI, isP, isB is 1 if picture type is I/P/B else 0
|
|
|
|
Pi,E see ur favorite math book
|
|
|
|
|
|
|
|
functions:
|
|
|
|
max(a,b),min(a,b) maximum / minimum
|
|
|
|
gt(a,b) is 1 if a>b, 0 otherwise
|
|
|
|
lt(a,b) is 1 if a<b, 0 otherwise
|
|
|
|
eq(a,b) is 1 if a==b,0 otherwise
|
|
|
|
sin,cos,tan,sinh,cosh,tanh,exp,log,abs
|
|
|
|
|
|
|
|
vrc_override user specified quality for specific parts (ending credits ...) (for pass1/2)
|
|
|
|
<start-frame>,<end-frame>,<quality>[/<start-frame>,<end-frame>,<quality>[/...]]
|
|
|
|
quality 2..31 -> quantizer
|
|
|
|
quality -500..0 -> quality correcture in %
|
|
|
|
|
|
|
|
vrc_init_cplx (0-1000) initial complexity for pass1
|
|
|
|
|
|
|
|
vqsquish (0 or 1) for pass1/2 how to keep the quantizer between qmin & qmax
|
|
|
|
0 use cliping
|
|
|
|
1 use a nice differentiable function (default)
|
2002-05-17 11:50:23 +00:00
|
|
|
|
2002-08-18 01:07:37 +00:00
|
|
|
vlelim (-1000-1000) single coefficient elimination threshold for luminance
|
2002-06-01 02:37:24 +00:00
|
|
|
0 disabled (default)
|
2002-08-18 01:07:37 +00:00
|
|
|
-4 (JVT recommendation)
|
|
|
|
negative values will allso consider the dc coefficient
|
|
|
|
should be at least -4 or lower for encoding at quant=1
|
2002-06-01 02:37:24 +00:00
|
|
|
|
2002-08-18 01:07:37 +00:00
|
|
|
vcelim (-1000-1000) single coefficient elimination threshold for chrominance
|
2002-06-01 02:37:24 +00:00
|
|
|
0 disabled (default)
|
2002-06-02 18:38:01 +00:00
|
|
|
7 (JVT recommendation)
|
2002-08-18 01:07:37 +00:00
|
|
|
negative values will allso consider the dc coefficient
|
|
|
|
should be at least -4 or lower for encoding at quant=1
|
2002-06-01 02:37:24 +00:00
|
|
|
|
2002-06-02 18:38:01 +00:00
|
|
|
vstrict strict standard compliance
|
|
|
|
only recommended if you want to feed the output into the mpeg4 reference
|
|
|
|
decoder
|
2002-06-01 02:37:24 +00:00
|
|
|
|
|
|
|
vdpart data partitioning
|
2002-06-02 18:38:01 +00:00
|
|
|
adds 2 byte per video packet
|
2002-10-13 18:35:15 +00:00
|
|
|
each videopacket will be encoded in 3 seperate partitions:
|
|
|
|
1. MVs (=movement)
|
|
|
|
2. DC coefficients (=low res picture)
|
|
|
|
3. AC coefficients (=details)
|
|
|
|
the MV & DC are most important, loosing them looks far worse than
|
|
|
|
loosing the AC and the 1. & 2. partition (MV&DC) are far smaller than
|
|
|
|
the 3. partition (AC) -> errors will hit the AC partition much more
|
|
|
|
often than the MV&DC -> the picture will look better with partitioning
|
|
|
|
than without, as without partitining an error will trash AC/DC/MV
|
|
|
|
equally
|
2002-06-02 18:38:01 +00:00
|
|
|
improves error-resistance when transfering over unreliable channels (eg.
|
2002-06-07 01:19:04 +00:00
|
|
|
streaming over the internet)
|
2002-06-01 02:58:55 +00:00
|
|
|
|
|
|
|
vpsize (0-10000) video packet size
|
|
|
|
0 disabled (default)
|
2002-10-13 18:35:15 +00:00
|
|
|
100-1000 good choice
|
2002-06-02 18:38:01 +00:00
|
|
|
improves error-resistance (see vdpart for more info)
|
2002-06-01 02:37:24 +00:00
|
|
|
|
2002-06-24 14:55:52 +00:00
|
|
|
gray grayscale only encoding (a bit faster than with color ...)
|
|
|
|
|
2002-09-01 21:16:45 +00:00
|
|
|
vfdct (0-99) dct algorithm
|
2002-08-30 21:30:59 +00:00
|
|
|
0 automatically select a good one (default)
|
|
|
|
1 fast integer
|
|
|
|
2 accurate integer
|
|
|
|
3 mmx
|
|
|
|
4 mlib
|
2002-10-06 16:01:54 +00:00
|
|
|
|
|
|
|
idct (0-99) idct algorithm
|
|
|
|
0 automatically select a good one (default)
|
|
|
|
1 jpeg reference integer
|
|
|
|
2 simple
|
|
|
|
3 simplemmx
|
|
|
|
4 libmpeg2mmx (inaccurate, DONT USE for encoding with keyint >100)
|
|
|
|
5 ps2
|
|
|
|
6 mlib
|
|
|
|
7 arm
|
2002-10-06 16:50:35 +00:00
|
|
|
note: all these IDCTs do pass the IEEE1180 tests AFAIK
|
2002-08-30 21:30:59 +00:00
|
|
|
|
2002-09-24 11:23:23 +00:00
|
|
|
lumi_mask (0.0-1.0) luminance masking
|
|
|
|
0.0 disabled (default)
|
2002-10-06 16:01:54 +00:00
|
|
|
0.0-0.3 should be a sane range
|
2002-09-24 11:23:23 +00:00
|
|
|
warning: be carefull, too large values can cause disasterous things
|
|
|
|
warning2: large values might look good on some monitors but may look horrible
|
|
|
|
on other monitors
|
|
|
|
|
|
|
|
dark_mask (0.0-1.0) darkness masking
|
|
|
|
0.0 disabled (default)
|
|
|
|
0.0-0.3 should be a sane range
|
|
|
|
warning: be carefull, too large values can cause disasterous things
|
|
|
|
warning2: large values might look good on some monitors but may look horrible
|
|
|
|
on other monitors / TV / TFT
|
|
|
|
|
|
|
|
tcplx_mask (0.0-1.0) temporal complexity masking
|
|
|
|
0.0 disabled (default)
|
|
|
|
|
|
|
|
scplx_mask (0.0-1.0) spatial complexity masking
|
|
|
|
0.0 disabled (default)
|
|
|
|
0.0-0.5 should be a sane range
|
|
|
|
larger values help against blockiness, if no deblocking filter is used
|
|
|
|
for decoding
|
|
|
|
Tip: crop any black borders completly away as they will reduce the quality
|
|
|
|
of the MBs there, this is true if scplx_mask isnt used at all too
|
|
|
|
|
|
|
|
naq normalize adaptive quantization
|
|
|
|
experimental
|
2002-10-06 16:01:54 +00:00
|
|
|
|
|
|
|
ildct use interlaced dct
|
2002-09-24 11:23:23 +00:00
|
|
|
|
2002-11-14 19:33:19 +00:00
|
|
|
format
|
|
|
|
YV12 (default)
|
|
|
|
422P (for huffyuv)
|
|
|
|
|
|
|
|
pred (for huffyuv)
|
|
|
|
0 left prediction
|
|
|
|
1 plane/gradient prediction
|
|
|
|
2 median prediction
|
|
|
|
|
2002-06-01 02:37:24 +00:00
|
|
|
lavdopts: (decoder options)
|
2002-06-02 18:38:01 +00:00
|
|
|
---------------------------
|
|
|
|
|
2002-10-13 13:49:24 +00:00
|
|
|
ec error concealment
|
|
|
|
1 use strong deblock filter for damaged MBs
|
|
|
|
2 iterative MV search (slow)
|
|
|
|
3 all (default)
|
|
|
|
Note: just add the ones u want to enable
|
|
|
|
|
|
|
|
er error resilience
|
|
|
|
0 disabled
|
|
|
|
1 carefull (should work with broken encoders)
|
|
|
|
2 normal (default) (works with compliant encoders)
|
|
|
|
3 agressive (more checks but might cause problems even for valid bitstreams)
|
|
|
|
4 very agressive
|
|
|
|
|
|
|
|
bug manual workaround encoder bugs (autodetection isnt foolproof for these)
|
|
|
|
0 nothing
|
|
|
|
1 autodetect bugs (default)
|
|
|
|
2 for msmpeg4v3 some old lavc generated msmpeg4v3 files (no autodetect)
|
|
|
|
4 for mpeg4 xvid interlacing bug (autodetected if fourcc==XVIX)
|
|
|
|
8 for mpeg4 UMP4 (autodetected if fourcc==UMP4)
|
|
|
|
16for mpeg4 padding bug
|
|
|
|
32for mpeg4 illegal vlc bug (autodetected per fourcc)
|
2002-11-14 19:33:19 +00:00
|
|
|
64for mpeg4 XVID&DIVX qpel bug (autodetected)
|
2002-10-13 13:49:24 +00:00
|
|
|
Note: just add the ones u want to enable
|
2002-06-01 02:37:24 +00:00
|
|
|
|
2002-06-24 11:07:58 +00:00
|
|
|
gray grayscale only decoding (a bit faster than with color ...)
|
|
|
|
|
2002-10-06 16:01:54 +00:00
|
|
|
idct see lavcopts
|
|
|
|
note: the decoding quality is highest if the same idct algorithm is used
|
|
|
|
for decoding as for encoding, this is often not the most accurate though
|
|
|
|
|
2002-06-01 02:37:24 +00:00
|
|
|
|
2002-06-02 18:38:01 +00:00
|
|
|
Notes: 1. lavc will strictly follow the quantizer limits vqmin, vqmax, vqdiff
|
|
|
|
even if it violates the bitrate / bitrate tolerance
|
2002-05-17 11:50:23 +00:00
|
|
|
2. changing some options between pass1 & 2 can reduce the quality
|
|
|
|
|
2002-06-02 18:38:01 +00:00
|
|
|
FAQ: Q: Why is the filesize much too small?
|
|
|
|
A: Try to increase vqmin=2 or 1 (be carefull with 1, it could cause
|
|
|
|
strange things to happen).
|
|
|
|
Q: Can I use -pass 1 & -pass 2 with vmax_b_frames>0 ?
|
2002-06-07 01:19:04 +00:00
|
|
|
A: -pass x uses the divx4 twopass-encoding codem which is incompatible
|
|
|
|
with the libavcodec encode.
|
|
|
|
If you want to fix it read DOCS/tech/patches.txt and send a patch.
|
2002-06-02 18:38:01 +00:00
|
|
|
Q: What provides better error recovery while keeping the filesize low?
|
2002-08-25 21:43:22 +00:00
|
|
|
Should I use data partitioning or increase the number of video packets?
|
2002-06-02 18:38:01 +00:00
|
|
|
A: Data partitioning is better in this case.
|
|
|
|
|
|
|
|
Glossary:
|
|
|
|
MB Macroblock (16x16 luminance and 8x8 chrominance samples)
|
2002-05-17 11:50:23 +00:00
|
|
|
MV Motion vector
|
|
|
|
ME Motion estimation
|
|
|
|
MC Motion compensation
|
2002-08-25 21:43:22 +00:00
|
|
|
RC Rate control
|
|
|
|
DCT Discrete Cosine Transform
|
|
|
|
IDCT Inverse Discrete Cosine Transform
|
2002-06-02 18:38:01 +00:00
|
|
|
JVT Joint Video Team Standard -- http://www.itu.int/ITU-T/news/jvtpro.html
|
2002-05-17 11:50:23 +00:00
|
|
|
|
2002-06-02 18:38:01 +00:00
|
|
|
Examples:
|
2002-06-01 02:37:24 +00:00
|
|
|
mencoder foobar.avi -lavcopts vcodec=mpeg4:vhq:keyint=300:vqscale=2 -o new-foobar.avi
|
2002-06-24 11:03:04 +00:00
|
|
|
mplayer foobar.avi -lavdopts bug=1
|
2002-06-07 01:19:04 +00:00
|
|
|
|
2002-09-05 09:38:06 +00:00
|
|
|
Links:
|
|
|
|
short intro to mpeg coding:
|
|
|
|
http://www.eecs.umich.edu/~amarathe/mpeg.html
|
|
|
|
longer intro to jpeg/mpeg coding:
|
|
|
|
http://www.cs.sfu.ca/undergrad/CourseMaterials/CMPT479/material/notes/Chap4/Chap4.2/Chap4.2.html
|
|
|
|
|
2002-06-07 01:19:04 +00:00
|
|
|
--
|
|
|
|
Written 2002 by Michael Niedermayer and reviewed by Felix Buenemann.
|
|
|
|
Check the MPlayer documentation for contact-addresses.
|
|
|
|
|