I'm trying to deinterlace a frame using ffmpeg (latest release). Related with this question, I can get the filter I want using this sentence:
AVFilter *filter = avfilter_get_by_name("yadif");
After that, I open the filter context as:
AVFilterContext *filter_ctx;
avfilter_open(&filter_ctx, filter, NULL);
My first question is about this function. Visual Studio warns me about avfilter_open
is deprecated. Which is the alternative?
After that, I do:
avfilter_init_str(filter_ctx, "yadif=1:-1");
And always fails. I've tried "1:-1
" instead "yadif=1:-1
", but always fails too, what parameter I should use?
EDIT: A value of "1
" or "2
", for example, it works. Debuging it, I found that with one of this values, the function uses mode=1
or mode=2
. The explanation of those values is in this link.
Then, I have a AVFrame *frame
that is the frame I want to deinterlace. When the last sentence work, I'll have the filter and his context init. How do I apply this filter to my frame?
Thanks for your help.
I undertsnad your question is over a year now but recently I had to work with interlaced DVB-TS streams so I might be able to help anybody else coming across this subject.
These snippets are from a finished player I've written
Initialise the filter graph:
When processing the video packets from the stream, check if it is an interlaced frame and send the frame off to the filter. The filter will then return the de-interlaced frames back to you.
Hope this helps anyone because finding information about ffmpeg is tough going.