ffmpeg yadif deinterlacing

ffmpeg yadif deinterlacing

本文关键字:deinterlacing yadif ffmpeg      更新时间:2023-10-16

我正在尝试在我的c++程序中使用ffmpeg去隔行视频。首先,我使用了avpicture_deinterlace,但是不推荐使用。

寻找更多信息,我在avfilter_register_all()之后尝试了avfilter_get_by_name("yadif"),但总是返回 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版本中,只有在使用——enable-gpl configure选项时才编译yadif。您可能需要更新到较晚的版本或使用——enable-gpl重新编译旧版本。