c++ - ffmpeg yadif 去隔行

c++ - ffmpeg yadif deinterlacing

我正在尝试在我的 C++ 程序中使用 ffmpeg 去隔行扫描视频。 首先,我使用了 avpicture_deinterlace 但已弃用。

寻找更多信息,我在 avfilter_register_all() 之后 avfilter_get_by_name("yadif") 尝试过,但总是 return NULL。我也尝试了下一个代码,但仍然无法正常工作。我在 avfilter_init_str 函数中尝试了不同的参数,但 err 总是小于 0,这意味着有错误。

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\"");

我知道 filtering_video.c 文件是了解如何构建过滤器的良好起点,但我不想构建一个,我只需要使用 yadif 去隔行过滤器。我有 AVFrame 但我不知道如何对其应用 de yadif 过滤器

欢迎任何帮助。

在较旧的 FFmpeg 版本中,yadif 仅在使用 --enable-gpl 配置选项时才编译。您可能需要更新到更高版本或使用 --enable-gpl 重新编译旧版本。