# ############################################################################
# XviD 1.0 configuration file for transcode
# ############################################################################


# ----------------------------------------------------------------------------
#
# Section: Features
#
# The fist section of this configuration file concerns what is labeled as
# "features". This allows you to turn on/off some options to adapt XviD to
# your needs.
# ----------------------------------------------------------------------------

[features]

# MPEG4 allows two methods to compress the image, the first one is derived
# from h263, the other one is inspired by the MPEG2 matrix quantization.
#
# NB: defaults to h263 if a typing mistake is done.
#     defaults to mpeg if custom matrices filenames are specified.
#
# Values = h263 | mpeg

quant_type = h263


# This option controls the motion estimation subsystem. The higher the value,
# the more precise the estimation should be. The more precise the motion
# estimation is, the more bits can be saved. Precision is gained at the
# expense of CPU time so decrease this setting if you need realtime encoding. 
#
# Values = [0..6]
#
#   0 None
#   1 Very Low
#   2 Low
#   3 Medium
#   4 High
#   5 Very High
#   6 Ultra High
#
# Default = 6

motion = 6

# Motion estimation involves lot of refinement steps. Usually these steps help
# reaching better quality, but not by much, and they use a fair amount of CPU.
# So if you want to speedup Motion Estimation by skipping some refinement steps
# and using simplified ME functions, you can activate the turbo mode.
#
# This setting turns on the ME turbo mode.
#
# Values = 0 (no) | 1 (yes)
# Default = 0

turbo = 0

# The usual motion estimation algorithm uses only the luminance information
# to find the best motion vector. However for some video material, using
# the chromatic planes can help find better vectors.
#
# This setting turns on/off the use of chroma planes for Motion Estimation
#
# Values = 0 (no) | 1 (yes)
# Default = 1

chromame = 1


# The motion search algorithm is based on a search in the usual color domain
# and tries to find a motion vector that minimizes the difference between
# the reference frame and the encoded frame.
#
# Activating this setting, XviD will also use the frequency domain (DCT) to
# search a motion vector that minimizes not only the spatial difference but
# also the encoding length of the block. The higher, the more precise and more
# CPU intensive
#
# Values = [0..4]
#
#   0 Disabled
#   1 Mode decision
#   2 Limited search
#   3 Medium search
#   4 Wide search
#
# Default = 1

vhq = 1


# BFrames are the third type of frames available in MPEG4, they are predicted
# thanks to 2 reference frames. Thus, bframes help usually in two cases:
#   1/ saving bitrate w/o loss of quality
#   2/ increasing the quality for a same bitrate
#
# This setting controls how many bframes the xvid encoder can output in a row.
#
# You must be aware that the higher max_bframes is, the more distant reference
# frames are from each other. Thus prediction of reference frames become hard
# and results in poor quality. If the reference frames have poor quality, so
# the bframes will have. So as a rule of thumb, this setting has to be tuned
# according to your exact needs. CVommon values are [0..2] for "natural movies
# and a bit higher values for anime/cartoons with great amounts of constant color
# areas.
#
# Values = >=0 (0 disables bframes usage)
# Default = 1

max_bframes = 1


# As explained before, BFrames are highly correlated to its reference frames
# Thus XviD computes their quantizer to its reference's quantizers.
#
# This two settings allow you to tune the formula:
#
# Values = [0..200]
# Default = ratio 150 & offset 100

bquant_ratio = 150
bquant_offset = 100


# Sometimes BFrames do not look good, and introduce artefacts when most of the
# frame is static and some small zones have high motion (a static scene with a
# man talking, his mouth will probably look bad if what is surrounding the man
# and his mouth is completly static)
#
# This setting allow you to favorize or not, the use of bframes. The higher the
# value, the more a bframe has chance to be used.
#
# Values [-255..255]
# Default = 0

bframe_threshold = 0


# MPEG4 uses a half pixel precision for its motion search by default. The
# standard proposes a mode where encoders are allowed to use quarter pixel
# precision.
#
# This option usually results in sharper image. But it has great impact on
# bitrate and sometimes the higher use of bitrate will prevent it from giving
# a better image quality at a fixed bitrate. The better is to test w and w/o it
# and choose after this test, if it's worth activting it.
#
# Values = 0 (no) | 1 (yes)
# Default = 0

quarterpel = 0


# Makes XviD generates Sprite Frame which describe best Pan/Zoom/Rotating
# images. Deciding wether or not you must activate it depends highly on the
# video material
#
# Values = 0 (no) | 1 (yes)
# Default = 0

gmc = 0


# Trellis Quantization is a kind of adaptive quantization method that saves
# bits modifying quantized coefficients to make them more compressable by the
# entropy encoder.
#
# Its impact on quality is good, and if VHQ uses too much CPU for you, this
# setting can be a good alternative to save a few bits (and gain quality at
# fixed bitrate) at a minimum expense.
# than VHQ
#
# Values = 0 (no) | 1 (yes)
# Default = 0

trellis = 0


# Depending on the container and frontend API, sometimes it is good to ask XviD
# to group the first bframe of a group with its forward reference frame, that
# prevents A/V desync
#
# This setting would be useful if it was used with VFW 1.1 encoders (Windows)
# because this API does not allow audio contention when no video frames are
# output.
#
# But transcode does not suffer from that API problem and the xvid4 module
# informs transcode to delay frames when needed, so this option is mostly not
# needed with transcode.
#
# Values = 0 (no) | 1 (yes)
# Default = 0

packed = 0


# A GOP is a Group Of Pictures. Its bounded by two Intra Frames.
#
# This option controls if XviD must close a GOP, which means that a GOP is
# independent from the next GOP. This implies just that the last frame of
# the GOP is eiter a PFrame or a SFrame but not a BFrame. This is usually
# a good idea to turn on the option
#
# Values = 0 (no) | 1 (yes)
# Default = 1

closed_gop = 1


# For interlaced video material, turn this option to on.
#
# Values = 0 (no) | 1 (yes)
# Default = 0

interlaced = 0


# Activate this if your encoded sequence is an Anime/Cartoon. It modifies some
# XviD internal thresholds so XviD takes better decisions on frame types and
# motion vectors for flat looking cartoons.
#
# Values = 0 (no) | 1 (yes)
# Default = 0

cartoon = 0


# Activates High Quality AC coefficient prediction from neighboor blocks.
#
# Values = 0 (no) | 1 (yes)
# Default = 1

hqacpred = 1


# XviD keeps track of block coding type (skipped, predicted, intra). The skipped
# block counter can be used to choose wether a frame is so close to its reference
# that it can be _completly_ skipped.
#
# This setting allows you to choose the (100 - value) threshold for skipping a
# frame.
#
# Values = [0..100] (0 -> never skip a frame, 100 -> skip all frames)
# Default = 0

frame_drop_ratio = 0

# XviD discard chroma planes bitstream so the encoded video is greyscale only.
# Note that this does not speed up encoding, that just prevent chroma data
# from being written in the last stage of encoding.
#
# This setting enable Chroma color discarding.
#
# Values = 0 (no) | 1 (yes)
# Default = 0

greyscale = 0

# For testing purposes, or quality measurement, XviD can return some stats
# about the encoded frames.
#
# This option activates PSNR measurement, the average PSNR is displayed at the
# end of the encoding session. This option is probably something a Joe user
# does not really care. This option makes the encoding a bit slower.
#
# Values = 0 (no) | 1 (yes)
# Default = 0

stats = 0

# ----------------------------------------------------------------------------
#
# Section: Quantizer
#
# This section allows you to tune quantizing process.
# ----------------------------------------------------------------------------

[quantizer]

# The next 6 settings control the valid range of quantizers for a specific frame
# type
#
# a [2..31] range is probably good for all sequences, you can decrease the higher
# bound limit if you notice some scenes with artefacts. However, restricting the
# valid range can make the bitrate controller fails to achieve the desired bitrate
#
# Use this ranges with MUCH care
#
# Values = [0..31]
#  1-> small quantizer -> better quality
# 31-> high quantizer -> bad quality
#  0 has a special meaning, it lets XviD uses its own default values

min_iquant = 2
max_iquant = 31
min_pquant = 2
max_pquant = 31
min_bquant = 2
max_bquant = 31

# With the MPEG quantization method you can provide custom matrices optimized 
# your video material.
#
# A matrix file is just a file where 64 decimal values ranged in 1..255 are
# specified separated by  space chars (newline, space, tabs)
#
# The 8x8 matrix is then rebuilt like that
#
# [ first coeff, second coeff, ... eighth coeff]
# [ ninth coeff, ...                           ]
# [ ...                                        ]
# [                                            ]
# [                                            ]
# [                                            ]
# [                                            ]
# [                                            ]
#
# Value = filename of the matrix
# Default : none (no custom matrix)

#quant_intra_matrix =
#quant_inter_matrix =


# ----------------------------------------------------------------------------
#
# Section: CBR
#
# This section allows you to tune the Constant Bitrate settings.
# ----------------------------------------------------------------------------

[cbr]

# This parameter controls the delay in frames before the CBR rate controller
# will react to bitrate changes and will try to compensate the change to obtain
# a constant bitrate over an averaging range of frames (see below).
#
# Value = >=0
# Default = 16
# 0 has a special meaning, it lets XviD uses its own default values

reaction_delay_factor = 16


# Real CBR is hard to achieve. Depending on the video material, bitrate can be
# variable, and hard to predict. That's why XviD uses an averaging period for
# which it guarantees a given amount of bits (minus a small variation).
#
# This settings express the "number of frames" for which XviD averages bitrate 
# and tries to achieve CBR.
#
# Value = >=0
# Default = 100
# 0 has a special meaning, it lets XviD uses its own default values

averaging_period = 100


# Todo: find its exact meaning
#
# Value = >=0
# Default = 100
# 0 has a special meaning, it lets XviD uses its own default values

buffer = 100

# ----------------------------------------------------------------------------
#
# Section: VBR
#
# This section allows you to tune the Variable Bitrate controller settings.
# (2nd pass control in simpler words)
# ----------------------------------------------------------------------------

[vbr]

# The two pass algorithm scales the initial bitrate curve to obtain one that
# respect both the user target bitrate and the natural shape of the first pass
# curve. However it is possible to give an additionnal amount of bits for Intra
# frames.
#
# This setting tells how many additional amount of bits, Intra Frames are
# supposed to be given (this "bossting" amount of bits is compensated by
# subtracting the same amount of bits from other frame types pool)
#
# Value = [0..100]
# Default = 0

keyframe_boost = 0


# This settigs control how much the upper part of the curve has to get closer
# to the average bitrate value. The upper part of the curve is the set of values
# that are higher than the curve average. It is expressed in %.
#
# Think of that setting like a shrinking factor for the upper part of the
# curve.
#
# Value = [0..100]
# Default = 0

curve_compression_high = 0


# This settigs control how much the lower part of the curve has to get closer
# to the average bitrate value. The lower part of the curve is the set of values
# that are lower than the curve average. It is expressed in %.
#
# Think of that setting like a growing factor for the lower part of the
# curve.
#
# Value = [0..100]
# Default = 0

curve_compression_low = 0


# During two pass, a scaled bitrate curve is computed. The difference between
# that expected curve and the result obtained during encoding is called
# overflow. Obviously, the two pass Rate Controller tries to compensate
# that overflow distributing it over next frames to be encoded.
#
# This setting controls how much overflow is distributed at each new frame.
# Low values allow lazy overflow control, big rate bursts are compensated more
# slowly (could lead to lack of precision for small clips). High values
# make RC compensate very hard the overflow, this can have a very bad impact on
# quality during rate bursts.
#
# NB: This setting impacts quality a lot, play with it carefully !
#
# Value = [0..100]
# Default = 0
# 0 has a special meaning, it lets XviD uses its own default values

overflow_control_strength = 5

# During the frame bit allocation, overflow control may increase the frame
# size. This parameter controls how much the overflow control is allowed
# to increase the frame size in percent compared to the ideal curve allocation
#
# Value = >=0
# Default = 60
# 0 has a special meaning, it lets XviD uses its own default values

max_overflow_improvement = 5


# During the frame bit allocation, overflow control may decrease the frame
# size. This parameter controls how much the overflow control is allowed
# to decrease the frame size in percent compared to the ideal curve allocation
#
# Value = >=0
# Default = 60
# 0 has a special meaning, it lets XviD uses its own default values

max_overflow_degradation = 5


# This reduction factor is the maximum allowed keyframe penalty applied to
# a frame in a ivop sequence. The more the frame is distant from the last
# ivop in the consecutive ivop sequence, the more penalty it is applied.
# This ensures a maximum bitrate allocation to the last ivop, thus favorizing
# a good reference frame for following p/s/b vops.
#
# Value = >=0
# Default = 20
# 0 has a special meaning, it lets XviD uses its own default values

kfreduction = 20


# Distance between two ivops so that it is not decresed its bit allocation by
# the ivop reduction mechanism.
#
# Value = >=0
# Default = 1
# 0 has a special meaning, it lets XviD uses its own default values

kfthreshold = 1


# Most of the time users express their target bitrate for video w/o taking care
# of the video container overhead. This small but (mostly) constant overhead
# can make the target file size is not respected (oversized result). We decided
# to allow users to set the amount of overhead per frame the container generates
# (give only an average per frame)
#
# Value = >=0
# Default = 24 (AVI frame average overhead per frame in bytes)
# 0 has a special meaning, it lets XviD uses its own default values

container_frame_overhead = 24

##############################################################################
# Do not modify this tag comment
# arch-tag: bb7970c1-33fb-4c8c-8d1b-742ff2e53336 xvid config file
