[Libav-user] How to set priv data options like VBR for ie libfdk_aac, or abr vor libmp3lame
Jaka Bac
jakabac at gmail.com
Mon Apr 2 22:37:02 EEST 2018
On 1 April 2018 at 12:16, Henri Zikken <zikken at xs4all.nl> wrote:
> Dear all,
>
>
>
> I am trying to control the settings for encoding to several formats,
> amongst which libfdk_aac. Now I’m trying to set an option like the VBR
> settings, to no avail.
>
>
>
> The option can be between 0 and 5. I have tried like 20 ways to set it
> now, to no avail.
>
>
>
> For instance:
>
>
>
> int ret = av_opt_set(_codecContext, "vbr", 0, 0);
>
>
>
> returns ‘option not found’.
>
>
>
> int ret = av_opt_set(_codecContext->priv_data, "vbr", 0, 0);
>
>
>
> returns ‘invalid argument’.
>
>
>
> Same goes for av_opt_set(_codec, “vbr”,0,0); and the variant with
> priv_data.
>
>
>
> setting an AVDictionary also does not work:
>
>
>
> AVDictionary * opts = NULL;
>
> av_dict_set_int(&opts,"vbr",0,0)
>
>
>
> int ret = av_opt_set_dict(_codecContext->priv_data, &opts);
>
> int ret = av_opt_set_dict(_codecContext, &opts);
>
> int ret = av_opt_set_dict(_codec, &opts);
>
> int ret = av_opt_set_dict(_codec->priv_data, &opts);
>
>
>
> al does exactly nothing.
>
>
>
> So how do I set this blasted option?!?! :P
>
>
>
> I know the option is present in the aac_enc_options struct:
>
>
>
> static const AVOption aac_enc_options[] = {
>
> [..]
>
> { "vbr", "VBR mode (1-5)", offsetof(AACContext, vbr), AV_OPT_TYPE_INT, {
> .i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
>
>
>
> This ends up in aac_enc_class:
>
>
>
> static const AVClass aac_enc_class = {
>
> [..]
>
> .option = aac_enc_options,
>
>
>
> Which in turn ends up as the .priv_class for the codec:
>
>
>
> AVCodec ff_libfdk_aac_encoder = {
>
> [..]
>
> .priv_class = &aac_enc_class,
>
>
>
> Any help would be appriciated.
>
>
>
> Regards,
>
>
>
> Henri Zikken
>
>
>
>
Hi Henri
Try this:
av_opt_set(_codecContext, "vbr", "0", AV_OPT_SEARCH_CHILDREN);
or if you want to set the integer value:
av_opt_set_int(_codecContext, "vbr", 0, AV_OPT_SEARCH_CHILDREN);
Please bear in mind that this is out of my head and untested
Jaka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180402/3acccf07/attachment.html>
More information about the Libav-user
mailing list