C ++ - ffmpeg yadif deinterlacing
I am trying to deinterlace a video with ffmpeg in my C ++ program. First of all I used avpicture_deinterlace
but is deprecated.
Look for more info, I've tried avfilter_get_by_name("yadif")
after avfilter_register_all()
but always return NULL
. I tried the following code too but still didn't work. I tried different parameters in avfilter_init_str
but err
always less than 0, it means there is an error.
int err;
// Register all built-in filters
avfilter_register_all();
// Find the yadif filter
AVFilter *yadif_filter = avfilter_get_by_name("buffer");
AVFilterContext *filter_ctx;
// Create the filter context with yadif filter
avfilter_open(&filter_ctx, yadif_filter, NULL);
// Init the yadif context with "1:-1" option
err = avfilter_init_str(filter_ctx, "\"yadif=1:-1\"");
I know the file filtering_video.c
is a good starting point for understanding how to create a filter, but I don't want to build it, I need to use the yadif deinterlacing filter. I have AVFrame
, but I don't know how to apply a yadif filter to it.
Any help is greatly appreciated.
source to share