[Libav-user] creating a new filter...

Paul B Mahol onemda at gmail.com
Wed Mar 27 13:22:04 CET 2013

On 3/26/13, Richard Schilling <coderroadie at gmail.com> wrote:
> Greetings.
> This is my first post.  I looked in the listserv archives but didn't find
> anyone talking about this, so here it goes.
> I need to implement a new audio (audio only) filter.  I see the example code
> in filtering_audio.c that uses a buffer sink.  But, I'm having a hard time
> finding particulars on what everything means.  So, I'm hoping someone on
> this list can help.
> My goal: I have an application that uses the FFMPG library.  I need to
> create a new custom audio  filter, say my_filter.c.
> filtering_audio.c looks like the place to start. Is that correct?

IIRC currently the only way to implement new filters is in libavfilter itself.

> In filtering_audio.c:
> * Can I get a basic walk-through of the code in the function init_filters?
> it looks like there is a source (AVFilter *abuffersrc) and sink buffer
> (AVFilter *abuffersing).   This looks like two filters.  How do I install
> just one filter?  I'm looking for a basic checklist here so I know that my
> calls to avfilter_graph_create_filter, av_filtergraph_parse, etc ... are
> correct ... .basically a walk-through of the example code.
> * In avfilter_asink_abuffer (buffersink.c) I see .inputs and .outputs
> defined.  .inputs defines an AVFilterPad called "default".  .outputs defines
> no (NULL) filter pads.  How does this relate to this code in
> filtering_audio.c?
>     /* Endpoints for the filter graph. */
>     outputs->name       = av_strdup("in");
>     outputs->filter_ctx = buffersrc_ctx;
>     outputs->pad_idx    = 0;
>     outputs->next       = NULL;
>     inputs->name       = av_strdup("out");
>     inputs->filter_ctx = buffersink_ctx;
>     inputs->pad_idx    = 0;
>     inputs->next       = NULL;
> Thank you in advance.
> Cheers,
> Richard Schilling

More information about the Libav-user mailing list