diff --git a/.github/scripts/Linux/ffmpeg-patches/0001-NVENC-set-idrPeriod-to-gop_size.patch b/.github/scripts/Linux/ffmpeg-patches/0001-NVENC-set-idrPeriod-to-gop_size.patch deleted file mode 100644 index fd0c13cd1..000000000 --- a/.github/scripts/Linux/ffmpeg-patches/0001-NVENC-set-idrPeriod-to-gop_size.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 64f7b0960e3d2ee3855492d518813f4ad53459ef Mon Sep 17 00:00:00 2001 -From: Martin Pulec -Date: Fri, 22 Apr 2022 09:50:14 +0200 -Subject: [PATCH] NVENC: set idrPeriod to gop_size - -NVENC_INFINITE_GOPLENGTH is useless for UltraGrid ---- - libavcodec/avcodec.h | 3 +++ - libavcodec/nvenc.c | 8 ++------ - 2 files changed, 5 insertions(+), 6 deletions(-) - -diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h -index 4dae23d06e..31f9898731 100644 ---- a/libavcodec/avcodec.h -+++ b/libavcodec/avcodec.h -@@ -3167,4 +3167,7 @@ int avcodec_is_open(AVCodecContext *s); - * @} - */ - -+// UltraGrid patch -+#define PATCHED_FF_NVENC_NO_INFINITE_GOP 1 -+ - #endif /* AVCODEC_AVCODEC_H */ -diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c -index b6bcec8246..8bdada1598 100644 ---- a/libavcodec/nvenc.c -+++ b/libavcodec/nvenc.c -@@ -1130,9 +1130,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) - h264->maxNumRefFrames = ctx->dpb_size; - } - -- if (ctx->intra_refresh) { -- h264->idrPeriod = NVENC_INFINITE_GOPLENGTH; -- } else if (avctx->gop_size >= 0) { -+ if (avctx->gop_size >= 0) { - h264->idrPeriod = avctx->gop_size; - } - -@@ -1244,9 +1242,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) - hevc->maxNumRefFramesInDPB = ctx->dpb_size; - } - -- if (ctx->intra_refresh) { -- hevc->idrPeriod = NVENC_INFINITE_GOPLENGTH; -- } else if (avctx->gop_size >= 0) { -+ if (avctx->gop_size >= 0) { - hevc->idrPeriod = avctx->gop_size; - } - --- -2.36.0 - diff --git a/src/video_compress/libavcodec.cpp b/src/video_compress/libavcodec.cpp index f616686fa..14b3203dc 100644 --- a/src/video_compress/libavcodec.cpp +++ b/src/video_compress/libavcodec.cpp @@ -1539,16 +1539,19 @@ static void configure_nvenc(AVCodecContext *codec_ctx, struct setparam_param *pa } set_forced_idr(codec_ctx, 1); -#ifdef PATCHED_FF_NVENC_NO_INFINITE_GOP - const bool patched_ff = true; +#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(60, 22, 100) + const bool new_ff = true; #else - const bool patched_ff = false; + const bool new_ff = false; if (param->periodic_intra != 0) { - LOG(LOG_LEVEL_WARNING) << MOD_NAME "FFmpeg not patched, " << (param->periodic_intra != 1 ? "not " : "") << "enabling Intra Refresh.\n"; + LOG(LOG_LEVEL_WARNING) << MOD_NAME + "Old FFmpeg, " << (param->periodic_intra != 1 ? "not " : "") + << "enabling Intra Refresh.\n"; } #endif - if ((patched_ff && param->periodic_intra != 0) || param->periodic_intra == 1) { + if ((new_ff && param->periodic_intra != 0) || + param->periodic_intra == 1) { check_av_opt_set(codec_ctx->priv_data, "intra-refresh", 1); }