Log in

View Full Version : xvid parameters different under linux(?)


mikeX
3rd January 2004, 12:53
when i recently started experimenting with xvid under GNU/linux i found out that certain parameters of the XviD configuration appeared to be different.

is that really the case or do the same settings apply, but are just disguised to a different name and/or description?

to be more specific:

Edouard Gomez (http://ed.gomez.free.fr/), official xvid dev (if i'm not mistaken) releases on the above mentioned website modules for XviD support in the two most popular GNU/Linux encoding applications, mencoder & transcode (mencoder can also be used under windows --> http://www2.mplayerhq.hu/MPlayer/releases/win32-beta/


these modules support up to xvid 1 beta 2 as it seems from their changelog but appear to lack some of the configuration options available and introduce some new ones:
a sample configuration file for transcode (without most of ed's comments) for example looks like this:

# ----------------------------------------------------------------------------
#
# 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.
# ----------------------------------------------------------------------------
quant_type = h263
motion = 6
chromame = 0
vhq = 0
max_bframes = 0
bquant_ratio = 150
bquant_offset = 100
bframe_threshold = 0
quarterpel = 0
gmc = 0
trellis = 0
packed = 0
closed_gop = 1
interlaced = 0
cartoon = 0
hqacpred = 1
# Activates High Quality AC coefficient prediction from neighboor blocks.
#
# Values = 0 (no) | 1 (yes)
# Default = 1
frame_drop_ratio = 0
greyscale = 0
stats = 0

# ----------------------------------------------------------------------------
#
# Section: Quantizer
#
# This section allows you to tune quantizing process.
# ----------------------------------------------------------------------------
min_iquant = 2
max_iquant = 31
min_pquant = 2
max_pquant = 31
min_bquant = 2
max_bquant = 31
#quant_intra_matrix =
#quant_inter_matrix =

# ----------------------------------------------------------------------------
#
# Section: CBR
#
# This section allows you to tune the Constant Bitrate settings.
# ----------------------------------------------------------------------------
reaction_delay_factor = 16
averaging_period = 100
buffer = 100

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

curve_compression_high = 0
# Think of that setting like a shrinking factor for the upper part of the
# curve.

curve_compression_low = 0
# Think of that setting like a shrinking factor for the lower part of the
# curve.

overflow_control_strength = 0

max_overflow_improvement = 60
# 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

max_overflow_degradation = 60
# 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

kfreduction = 20
kfthreshold = 1
container_frame_overhead = 24
*********************************************************************

similar settings appear to apply for mencoder judging from certain variables in the export module source file (since there is no configuration file):

/*****************************************************************************
* Configuration options
****************************************************************************/

static int xvidenc_bitrate = 0;
static int xvidenc_pass = 0;
static float xvidenc_quantizer = 0;

static int xvidenc_packed = 0;
static int xvidenc_closed_gop = 1;
static int xvidenc_interlaced = 0;
static int xvidenc_quarterpel = 0;
static int xvidenc_gmc = 0;
static int xvidenc_trellis = 0;
static int xvidenc_cartoon = 0;
static int xvidenc_hqacpred = 1;
static int xvidenc_chromame = 0;
static int xvidenc_vhq = 0;
static int xvidenc_motion = 6;
static int xvidenc_stats = 0;
static int xvidenc_max_key_interval = 0;
static int xvidenc_frame_drop_ratio = 0;
static int xvidenc_greyscale = 0;

static int xvidenc_max_bframes = 0;
static int xvidenc_bquant_ratio = 150;
static int xvidenc_bquant_offset = 100;
static int xvidenc_bframe_threshold = 0;

static int xvidenc_min_quant[3] = {2, 2, 2};
static int xvidenc_max_quant[3] = {31, 31, 31};
static char *xvidenc_intra_matrix_file = NULL;
static char *xvidenc_inter_matrix_file = NULL;
static char *xvidenc_quant_method = NULL;

static int xvidenc_cbr_reaction_delay_factor = 0;
static int xvidenc_cbr_averaging_period = 0;
static int xvidenc_cbr_buffer = 0;

static int xvidenc_vbr_keyframe_boost = 0;
static int xvidenc_vbr_overflow_control_strength = 0;
static int xvidenc_vbr_curve_compression_high = 0;
static int xvidenc_vbr_curve_compression_low = 0;
static int xvidenc_vbr_max_overflow_improvement = 0;
static int xvidenc_vbr_max_overflow_degradation = 0;
static int xvidenc_vbr_kfreduction = 0;
static int xvidenc_vbr_kfthreshold = 0;
static int xvidenc_vbr_container_frame_overhead = 0;

static char *xvidenc_par = NULL;
static int xvidenc_par_width = 0;
static int xvidenc_par_height = 0;
*********************************************************************

one can easily notice that 'zone configuration' is missing but i found out that it has a 'TODO?' flag in the 'export_xvid4.c' file for transcode which states(?) that it's not an xvid problem actually

a more careful look reveals that setting the max key frame interval does not seem to be an option for transcode -- probably another transcode feature missing??

what really troubles me though is the "hqacpred" feature (which is present on both modules): what does it translate too??
and how about the container overhead option??

also adaptive quant seems to be missing (& reduced resolution too)

and what about the max_overflow_improvement/degradation explanations given?? they seem to be different from the pop-up ones in the windows gui!

same goes for the high/low_curve_compression parameter: the gui says it shrinks large frames and/or helps small ones where ed's(?) comments state that it always shrinks something, large and/or small frames

i haven't mentioned the new features of the beta 3 since the changelog states that the project is still synced to beta 2, although the 'new' AR features seem present (in the mencoder module as well as in the xvid header file for transcode)

some help would be greatly appreciated

(or should i just mail ed??)

Koepi
3rd January 2004, 13:42
The parameters are exactly the same. the Aspect ratio stuff gets translated to the PAR stuff on the bottom (hehe. now you're on linux, you have to do all the stuff yourself).

HQACPRED is fixed in windows (switched to on).

The default values aren't adopted yet, you should do that.

Container frame overhead is fixed to 24 in windows (avi frame overhead).


Really, I don't understand why you're not able to understand max keyframe value - it's 300 in windows.

Possibly some flags are missing, sure - but you have the source code, look into that. Some values simply aren't set in the example.

Welcome to linux world.

Regards
Koepi

sysKin
3rd January 2004, 13:45
Max keyframe value of 0 means 'default' which is 300.

max_overflow_improvement/degradation used to be 60 in windows too, now it's 5.

Koepi is right about what he said.

Radek

Koepi
3rd January 2004, 14:58
(@GomGom): Koepi: can you answer the guy, that for transcode there is no max_key_frame interval because it's part of the command
line options
(@GomGom): Koepi: and that the 0 values he is seeing in the mplayer module, just tells him it's up to the xvidcore to set its own
default
(@GomGom): Koepi: for the rest of the settings, i'm updating them right now
(@GomGom): adding turbo mode, and updating other settings (overflow)
(@GomGom): Koepi: ah i forgot, no lumimasking, because at the time i wrote the frontends, lumimasking was terribly buggy and was not worth being proposed to users
[...]
(@GomGom): ah, these hints cost him 5€ each :)
[...]
*g*

Thanks GomGom,

regards
Koepi

mikeX
3rd January 2004, 15:11
Really, I don't understand why you're not able to understand max keyframe value - it's 300 in windows.

i just meant that it's missing (in transcode configuration) but GomGom's answer clears things up (i had seen it somewhere in the man page but wasn't sure it was the same)

max_overflow_improvement/degradation used to be 60 in windows too, now it's 5.

that's not was i was asking actually, i meant that the explanations appeared different to me, that is the explanation Ed Gomez gives seemed to be different than the one given by the popup description of the vfw gui.
Now, after REALLY careful reading i found out that the gui gives the same explanation as Ed but in a really weird and hard to understand way (at least for me), so it would be great if you could just make a note about that for whenever you plan to give the gui a makeover, cause i realise now that the settings i was using (in windows) were actually doing the exact opposite of what i wanted!


and how about the curve compression thing?
as i wrote, according to Ed it seems that it's a measure of how much more one can compress the upper and/or the lower part of the bitrate curve whereas the gui clearly(?) states that it's a way to:

either apply more compression to the upper part of the curve:
High bitrate scenes % "The higher this value, the more bits get taken from frames larger than the average size, and redistributed to others"

and/or apply less compression to the lower part of the curve:
Low bitrate scenes: "The higher this value, the more bits get assigned to frames below the average frame size"

It would be nice to know which explanation is the correct one :)

also: thanks a lot for the rest of the clarifications, i guess the force is in the source, so i will be looking some more into it :D

ps: sorry for saying some things twice but i thought i 'd try being more clear as to what i really meant

(edit) keep up the good work GomGom ;)

Alestrix
3rd January 2004, 18:45
about the curve compression:
IIRC, both explanations are correct in a way. Compressing the curve
means compressing it toward the average bitrate (the appearance is
"squeezed"), so values that are beneath the avg bitrate are increased,
thus compressing the height (i.e. min-max-distance) of the curve. For
bitrates higher than the average, decreasing the bitrate will
compress the apperance of the curve.

(But better wait for a "go" from one of the more knowledgeable guys in
here whether this explanation is correct)

Greets,
aL

mikeX
4th January 2004, 05:38
Ed answered my question by correcting his comments in the xvid4.cfg file:
curve_compression_low
# Think of that setting like a growing factor for the lower part of the
# curve.

i guess the vfw gui was right after all :rolleyes:

again thanks for the clarifications and for the new export modules for linux ;)