[Ffmpeg-devel] OptionDef to AVOption migration problems

Michael Niedermayer michaelni
Fri Sep 22 17:50:31 CEST 2006


On Fri, Sep 22, 2006 at 05:18:39PM +0200, Panagiotis Issaris wrote:
> Hi,
> I've run into several issues now regarding the migration of the OptionDef 
> options to AVOptions. 
> One of them is that the defaults for the AVOptions are being stored 
> in "avctx_opts". The problem with this is that AVCodecContext contains one 
> field "bit_rate" which is used for both audio and video bitrates. When the 
> parameters are set in the per-stream AVCodecContext,
> it isn't an issue, but for the defaults it is as there is only one for both 
> video and audio related defaults.

there where also some people who wanted per codec defaults and limits for
example x264 encoding doesnt work too well with the mpeg4 defaults ...

> Another problem occurs with some parameters which have units which are not 
> common, such as lmax, which scales the parameter with 112:
>  1508 #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
>  ...
>  2322 static void opt_lmax(const char *arg)
>  2323 {
>  2324     video_lmax = atof(arg)*FF_QP2LAMBDA;
>  2325 }

the ideas i have for this one are
A. store a scaling factor
B. store a conversation equation as char * and use eval.c
C. a parse() function pointer
D. ignore it / change the units
E. use eval.c instead of av_strtod() to parse, that way the user could use 
   things like "-lmax 15*QP2LAMBDA"

iam not sure which is best but somehow D./E. seems the most natural solution

> Other parameters have range checks which can't be done using AVOptions for the 
> moment. In an AVOption you specify a maximum and a minimum. It can't be 
> specified whether the boudaries are inclusive or not.
>  2315     if (video_qscale <= 0 ||
>  2316         video_qscale > 255) {
>  2317         fprintf(stderr, "qscale must be > 0.0 and <= 255\n");

well this is trivial just find the largest/smallest double which is 
smaller/larger then the value you want as limit

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list