[Scummvm-devel] Changing compression tools flag for MP3 encoding
Thierry Crozat
criezy at scummvm.org
Sun May 2 13:42:34 CEST 2010
Hi all,
I would like to change the flags for MP3 encoding in the CLI
compression tools. But before doing so I want to see it somebody will
raise objections or point out something I might have overlooked.
This email is a bit long since I summarise the behaviour of both lame
and our compression tools (for those who are not familiar with them)
before laying out my proposed changes.
Lame can encode in three different modes: CBR (the default), ABR and
VBR.
CBR encoding: lame [--cbr] -b r
--cbr can be omitted since this is the default.
r is the constant bitrate (should be a multiple of 8 up to 64 or a
multiple of 16 between 64 and 160).
ABR encoding: lame --abr r [-b rmin] -B [rmax]
r is the target bitrate and can be anything between 8 and 310
rmin and rmax are optional minimum and maximum bitrate. It is not
recommended to give a maximum bitrate.
VBR encoding: lame --vbr-new -V n [-b rmin] [-B rmax]
q is a quality between 0 (best) and 9 (lowest). Default is 4. It is
not recommended to use 6 or above.
rmin and rmax are optional minimum and maximum bitrate. Again, it is
not recommended to give a maximum bitrate.
Additionally for all of them we can pass -q qual, which is the noise
shaping & psycho acoustic algorithms. Default is 5, but the
documentation recommend using 2.
Our compression tools do not support CBR and VBR is the default.
ABR flags: scummvm-tools --mp3 --abr [-b r] [-q qual]
The argument to -b gives the target bitrate. So the behaviour there
is different to lame. Default is 32
Default value of qual is 2 (so different from the lame default value
of 5)
VBR flags: scummvm-tools --mp3 [-b rmin] [-B rmax] [-V n] [-q qual]
All flags are optional and all have a default value. So lame is
always called with a minimum and maximum bitrate, even if none was
given by the user. The default are 24 for rmin and 64 for rmax. It
enforces multiple of 8, but not multiple of 16 above 64 (so it
accepts 72 while it is not valid for lame).
Default value for n is 4 (the same as lame).
Default value of qual is 2 (so different from the lame default value
of 5)
Until a change I made last week, the maximum bitrate was also
systematically passed to lame for ABR encoding.
Here are my proposed changes:
1) Enforce multiple of 16 above for minimum and maximum bitrates.
2) Make minimum and maximum bitrate optional (i.e. default is unset,
and if not given by the user then they are not passed to lame).
3) Pass the target bit rate as an argument to abr (as lame does) and
not using -b flag. Also make it possible to give minimum and maximum
bitrates for abr (using -b and -B). But that means that we force the
user to give the target bitrate if he wants to use ABR. Or maybe we
could make the argument to --abr optional (with a default at 32 as we
currently have).
4) Add --cbr option (but keep VBR as the default).
This means we mimic the behaviour of lame with these arguments and
give more flexibility to the user, but some default values are
different (vbr is default instead of cbr and -q has a default value
of 2 instead of 5).
Also the default when not giving any argument to the compression tool
was:
lame --vbr-new -b 24 -B 64 -q 2 -V 4
After those changes it would be:
lame --vbr-new -q 2 -V 4
Any objections to those changes? Or other suggestions?
Thierry
More information about the Scummvm-devel
mailing list