[Libav-user] yadif example

Stefano Sabatini stefasab at gmail.com
Fri Oct 16 13:02:58 CEST 2015


In data Friday 2015-10-16 09:03:35 +0000, Fermín Ayuso ha scritto:
> Thank you Stefano,
> 
> After see filtering_video.c, I'm not sure how to continue with my code. I
> setup the filter with this function:
> 
> AVFilterGraph *filter_graph;
> AVFrame *src_frame;
> AVFrame *deint_frame;
> 
> int MyDecoder::setup_filters()
> {
> int ret = 0;
> // Register all built-in filters
> avfilter_register_all();
> 
> AVFilter *yadif = avfilter_get_by_name("yadif");
> 
> filter_graph = avfilter_graph_alloc();
> 
> if (ret = (avfilter_graph_alloc_filter(filter_graph, yadif,
> "my_yadif_filter")) < 0)
> {
> avfilter_graph_free(&filter_graph);
> return ret;
> }
>        /*Here, how can I deinterlace src_frame?*/
> return ret;
> }
> 
> But now, I don't know what can I do with filter_graph and my AVFrame. How
> to apply the yadif filter to my source frame to obtain a deinterlace frame?
> Any clue?

Check the rest of the code. As I said, it's not that simple. In order
to use a filtergraph, you need at least three filters, a source, a
sink and the actual filters doing the filtering work. Also you have to
setup the sink in order to support the pixel formats you want in
output.

Then you push frames to the source, and extract frames from the
sink. At the moment the only way to use the filtering code is to
create a filtergraph.

I'd suggest to modify the example editing the filter_descr variable,
then you can integrate that code into your project.

HTH, bye.


More information about the Libav-user mailing list