FFmpeg Change audio filter parameters during runtime

I am making a music app where the user can add FX to playing music through a pad. I am using FFmpeg in C++ to dsp. In FFmpeg you can create an audio filter and set it parameters just like the following:

    beat_fx = avfilter_get_by_name("aecho");
    beat_fx_ctx = avfilter_graph_alloc_filter(filterGraph, beat_fx, "echo");
    av_opt_set(beat_fx_ctx, "decays", std::to_string(std::max(0.00001, (beatFX.xSoundPerc + 1) / (double)2)).c_str(), AV_OPT_SEARCH_CHILDREN);
    av_opt_set(beat_fx_ctx, "delays",   std::to_string(beatFX.ms).c_str(), AV_OPT_SEARCH_CHILDREN);
    av_opt_set_double(beat_fx_ctx, "in_gain", 1.0, AV_OPT_SEARCH_CHILDREN);
    av_opt_set_double(beat_fx_ctx, "out_gain", 1.0, AV_OPT_SEARCH_CHILDREN);

    if (avfilter_init_str(beat_fx_ctx, nullptr) < 0) {
        LOGE("FXProcessor::FXProcessor Could not initialize the beat_fx_ctx filter!");
        isOff = true;
        return;
    }

My problem is since the user will use a FX pad to change these parameters I need to be able to modify these parameters during runtime.

Looking at ffmpeg filter documentation:

Some options can be changed during the operation of the filter using a command. These options are marked ’T’ on the output of ffmpeg -h filter=. The name of the command is the name of the option and the argument is the new value.

I looked at aecho, agate, acrusher and more but nearly all the effects I want have 0 modifiable option which makes my FX pad nonadjustable. I am not using command line to process my effects, so maybe the link above is irrelevant.

Is there a way to make ffmpeg audio filters change their parameters during runtime?



from Recent Questions - Stack Overflow https://ift.tt/3r4gjNc
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations