[PR] Remove support for old ffnvcodec SDK versions and various long deprecated/legacy options (PR #23570)

Timo Rothenpieler via ffmpeg-devel <[email protected]>
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178225430079.59.1987742328411538696@29965ddac10e>
PR #23570 opened by Timo Rothenpieler (BtbN)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23570
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23570.patch

This is meant to go in with the 9.0 version bump, since removing all those options is very much a breaking change.


>From 2fea7425293d7f04e50884adf2fe30014a363b99 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Tue, 23 Jun 2026 23:36:14 +0200
Subject: [PATCH 1/7] avcodec/nvenc: remove support for SDK versions older than
 11.1

---
 configure               |   4 +-
 libavcodec/nvenc.c      | 160 +---------------------------------------
 libavcodec/nvenc.h      |  36 ---------
 libavcodec/nvenc_h264.c |  25 -------
 libavcodec/nvenc_hevc.c |  19 -----
 5 files changed, 4 insertions(+), 240 deletions(-)

diff --git a/configure b/configure
index 2bf25e9755..b992bada96 100755
--- a/configure
+++ b/configure
@@ -7223,9 +7223,7 @@ if ! disabled ffnvcodec; then
     ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h"
     check_pkg_config ffnvcodec "ffnvcodec >= 12.1.14.0" "$ffnv_hdr_list" "" || \
       check_pkg_config ffnvcodec "ffnvcodec >= 12.0.16.1 ffnvcodec < 12.1" "$ffnv_hdr_list" "" || \
-      check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.3 ffnvcodec < 12.0" "$ffnv_hdr_list" "" || \
-      check_pkg_config ffnvcodec "ffnvcodec >= 11.0.10.3 ffnvcodec < 11.1" "$ffnv_hdr_list" "" || \
-      check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.15 ffnvcodec < 8.2" "$ffnv_hdr_list" ""
+      check_pkg_config ffnvcodec "ffnvcodec >= 11.1.5.3 ffnvcodec < 12.0" "$ffnv_hdr_list" ""
 fi
 
 if enabled_all libglslang libshaderc; then
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 257b6d3892..5ef0ed572a 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -180,17 +180,14 @@ static int nvenc_map_error(NVENCSTATUS err, const char **desc)
 static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err,
                              const char *error_string)
 {
+    NvencContext *ctx = avctx->priv_data;
+    NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs;
     const char *desc;
     const char *details = "(no details)";
     int ret = nvenc_map_error(err, &desc);
 
-#ifdef NVENC_HAVE_GETLASTERRORSTRING
-    NvencContext *ctx = avctx->priv_data;
-    NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs;
-
     if (p_nvenc && ctx->nvencoder)
         details = p_nvenc->nvEncGetLastErrorString(ctx->nvencoder);
-#endif
 
     av_log(avctx, AV_LOG_ERROR, "%s: %s (%d): %s\n", error_string, desc, err, details);
 
@@ -210,7 +207,6 @@ typedef struct GUIDTuple {
 static void nvenc_map_preset(NvencContext *ctx)
 {
     GUIDTuple presets[] = {
-#ifdef NVENC_HAVE_NEW_PRESETS
         PRESET(P1),
         PRESET(P2),
         PRESET(P3),
@@ -231,20 +227,6 @@ static void nvenc_map_preset(NvencContext *ctx)
         PRESET_ALIAS(LOW_LATENCY_HQ,      P7, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
         PRESET_ALIAS(LOSSLESS_DEFAULT,    P4, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
         PRESET_ALIAS(LOSSLESS_HP,         P1, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
-#else
-        PRESET(DEFAULT),
-        PRESET(HP),
-        PRESET(HQ),
-        PRESET(BD),
-        PRESET_ALIAS(SLOW,   HQ,    NVENC_TWO_PASSES),
-        PRESET_ALIAS(MEDIUM, HQ,    NVENC_ONE_PASS),
-        PRESET_ALIAS(FAST,   HP,    NVENC_ONE_PASS),
-        PRESET(LOW_LATENCY_DEFAULT, NVENC_LOWLATENCY),
-        PRESET(LOW_LATENCY_HP,      NVENC_LOWLATENCY),
-        PRESET(LOW_LATENCY_HQ,      NVENC_LOWLATENCY),
-        PRESET(LOSSLESS_DEFAULT,    NVENC_LOSSLESS),
-        PRESET(LOSSLESS_HP,         NVENC_LOSSLESS),
-#endif
     };
 
     GUIDTuple *t = &presets[ctx->preset];
@@ -252,10 +234,8 @@ static void nvenc_map_preset(NvencContext *ctx)
     ctx->init_encode_params.presetGUID = t->guid;
     ctx->flags = t->flags;
 
-#ifdef NVENC_HAVE_NEW_PRESETS
     if (ctx->tuning_info == NV_ENC_TUNING_INFO_LOSSLESS)
         ctx->flags |= NVENC_LOSSLESS;
-#endif
 }
 
 #undef PRESET
@@ -287,54 +267,12 @@ static void nvenc_print_driver_requirement(AVCodecContext *avctx, int level)
 # else
     const char *minver = "520.56.06";
 # endif
-#elif NVENCAPI_CHECK_VERSION(11, 1)
+#else
 # if defined(_WIN32) || defined(__CYGWIN__)
     const char *minver = "471.41";
 # else
     const char *minver = "470.57.02";
 # endif
-#elif NVENCAPI_CHECK_VERSION(11, 0)
-# if defined(_WIN32) || defined(__CYGWIN__)
-    const char *minver = "456.71";
-# else
-    const char *minver = "455.28";
-# endif
-#elif NVENCAPI_CHECK_VERSION(10, 0)
-# if defined(_WIN32) || defined(__CYGWIN__)
-    const char *minver = "450.51";
-# else
-    const char *minver = "445.87";
-# endif
-#elif NVENCAPI_CHECK_VERSION(9, 1)
-# if defined(_WIN32) || defined(__CYGWIN__)
-    const char *minver = "436.15";
-# else
-    const char *minver = "435.21";
-# endif
-#elif NVENCAPI_CHECK_VERSION(9, 0)
-# if defined(_WIN32) || defined(__CYGWIN__)
-    const char *minver = "418.81";
-# else
-    const char *minver = "418.30";
-# endif
-#elif NVENCAPI_CHECK_VERSION(8, 2)
-# if defined(_WIN32) || defined(__CYGWIN__)
-    const char *minver = "397.93";
-# else
-    const char *minver = "396.24";
-#endif
-#elif NVENCAPI_CHECK_VERSION(8, 1)
-# if defined(_WIN32) || defined(__CYGWIN__)
-    const char *minver = "390.77";
-# else
-    const char *minver = "390.25";
-# endif
-#else
-# if defined(_WIN32) || defined(__CYGWIN__)
-    const char *minver = "378.66";
-# else
-    const char *minver = "378.13";
-# endif
 #endif
     av_log(avctx, level, "The minimum required Nvidia driver for nvenc is %s or newer\n", minver);
 }
@@ -588,7 +526,6 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
         return AVERROR(ENOSYS);
     }
 
-#ifdef NVENC_HAVE_BFRAME_REF_MODE
     tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED;
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE);
     switch (tmp) {
@@ -618,39 +555,18 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "Invalid b_ref_mode value %d\n", tmp);
         return AVERROR(EINVAL);
     }
-#else
-    tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0;
-    if (tmp > 0) {
-        av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n");
-        return AVERROR(ENOSYS);
-    }
-#endif
 
-#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_MULTIPLE_REF_FRAMES);
     if(avctx->refs != NV_ENC_NUM_REF_FRAMES_AUTOSELECT && ret <= 0) {
         av_log(avctx, AV_LOG_WARNING, "Multiple reference frames are not supported by the device\n");
         return AVERROR(ENOSYS);
     }
-#else
-    if(avctx->refs != 0) {
-        av_log(avctx, AV_LOG_WARNING, "Multiple reference frames need SDK 9.1 at build time\n");
-        return AVERROR(ENOSYS);
-    }
-#endif
 
-#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SINGLE_SLICE_INTRA_REFRESH);
     if(ctx->single_slice_intra_refresh && ret <= 0) {
         av_log(avctx, AV_LOG_WARNING, "Single slice intra refresh not supported by the device\n");
         return AVERROR(ENOSYS);
     }
-#else
-    if(ctx->single_slice_intra_refresh) {
-        av_log(avctx, AV_LOG_WARNING, "Single slice intra refresh needs SDK 11.1 at build time\n");
-        return AVERROR(ENOSYS);
-    }
-#endif
 
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_INTRA_REFRESH);
     if((ctx->intra_refresh || ctx->single_slice_intra_refresh) && ret <= 0) {
@@ -658,13 +574,6 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
         return AVERROR(ENOSYS);
     }
 
-#ifndef NVENC_HAVE_HEVC_CONSTRAINED_ENCODING
-    if (ctx->constrained_encoding && avctx->codec->id == AV_CODEC_ID_HEVC) {
-        av_log(avctx, AV_LOG_WARNING, "HEVC constrained encoding needs SDK 10.0 at build time\n");
-        return AVERROR(ENOSYS);
-    }
-#endif
-
     ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_CONSTRAINED_ENCODING);
     if(ctx->constrained_encoding && ret <= 0) {
         av_log(avctx, AV_LOG_WARNING, "Constrained encoding not supported by the device\n");
@@ -1130,7 +1039,6 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx)
     if (avctx->rc_max_rate > 0)
         ctx->encode_config.rcParams.maxBitRate = avctx->rc_max_rate;
 
-#ifdef NVENC_HAVE_MULTIPASS
     ctx->encode_config.rcParams.multiPass = ctx->multipass;
 
     if (ctx->flags & NVENC_ONE_PASS)
@@ -1147,32 +1055,6 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx)
             ctx->rc = NV_ENC_PARAMS_RC_VBR;
         }
     }
-#else
-    if (ctx->rc < 0) {
-        if (ctx->flags & NVENC_ONE_PASS)
-            ctx->twopass = 0;
-        if (ctx->flags & NVENC_TWO_PASSES)
-            ctx->twopass = 1;
-
-        if (ctx->twopass < 0)
-            ctx->twopass = (ctx->flags & NVENC_LOWLATENCY) != 0;
-
-        if (ctx->cbr) {
-            if (ctx->twopass) {
-                ctx->rc = NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ;
-            } else {
-                ctx->rc = NV_ENC_PARAMS_RC_CBR;
-            }
-        } else if (ctx->cqp >= 0) {
-            ctx->rc = NV_ENC_PARAMS_RC_CONSTQP;
-        } else if (ctx->twopass) {
-            ctx->rc = NV_ENC_PARAMS_RC_VBR_HQ;
-        } else if ((avctx->qmin >= 0 && avctx->qmax >= 0) ||
-                   (ctx->qmin >= 0 && ctx->qmax >= 0)) {
-            ctx->rc = NV_ENC_PARAMS_RC_VBR_MINQP;
-        }
-    }
-#endif
 
     if (ctx->rc >= 0 && ctx->rc & RC_MODE_DEPRECATED) {
         av_log(avctx, AV_LOG_WARNING, "Specified rc mode is deprecated.\n");
@@ -1181,7 +1063,6 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx)
         ctx->rc &= ~RC_MODE_DEPRECATED;
     }
 
-#ifdef NVENC_HAVE_QP_CHROMA_OFFSETS
     ctx->encode_config.rcParams.cbQPIndexOffset = ctx->qp_cb_offset;
     ctx->encode_config.rcParams.crQPIndexOffset = ctx->qp_cr_offset;
 
@@ -1191,15 +1072,9 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx)
                "av1_nvenc: qp_cr_offset is currently ignored by the NVENC driver "
                "(deltaQ_v_ac is forced equal to deltaQ_u_ac); only qp_cb_offset "
                "takes effect.\n");
-#else
-    if (ctx->qp_cb_offset || ctx->qp_cr_offset)
-        av_log(avctx, AV_LOG_WARNING, "Failed setting QP CB/CR offsets, SDK 11.1 or greater required at compile time.\n");
-#endif
 
-#ifdef NVENC_HAVE_LDKFS
     if (ctx->ldkfs)
          ctx->encode_config.rcParams.lowDelayKeyFrameScale = ctx->ldkfs;
-#endif
 
     if (ctx->flags & NVENC_LOSSLESS) {
         set_lossless(avctx);
@@ -1341,9 +1216,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
         h264->intraRefreshCnt = cc->gopLength - 1;
         cc->gopLength = NVENC_INFINITE_GOPLENGTH;
         h264->outputRecoveryPointSEI = 1;
-#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
         h264->singleSliceIntraRefresh = ctx->single_slice_intra_refresh;
-#endif
     }
 
     if (ctx->constrained_encoding)
@@ -1364,9 +1237,7 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
         /* Older SDKs use outputBufferingPeriodSEI to control filler data */
         h264->outputBufferingPeriodSEI = ctx->cbr_padding;
 
-#ifdef NVENC_HAVE_FILLER_DATA
         h264->enableFillerDataInsertion = ctx->cbr_padding;
-#endif
     }
 
     h264->outputPictureTimingSEI = 1;
@@ -1456,15 +1327,11 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
     if (ctx->coder >= 0)
         h264->entropyCodingMode = ctx->coder;
 
-#ifdef NVENC_HAVE_BFRAME_REF_MODE
     if (ctx->b_ref_mode >= 0)
         h264->useBFramesAsRef = ctx->b_ref_mode;
-#endif
 
-#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES
     h264->numRefL0 = avctx->refs;
     h264->numRefL1 = avctx->refs;
-#endif
 
 #ifdef NVENC_HAVE_H264_AND_AV1_TEMPORAL_FILTER
     if (ctx->tf_level >= 0) {
@@ -1539,9 +1406,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
 #ifdef NVENC_HAVE_HEVC_OUTPUT_RECOVERY_POINT_SEI
         hevc->outputRecoveryPointSEI = 1;
 #endif
-#ifdef NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
         hevc->singleSliceIntraRefresh = ctx->single_slice_intra_refresh;
-#endif
     }
 
 #ifdef NVENC_HAVE_HEVC_AND_AV1_MASTERING_METADATA
@@ -1553,10 +1418,8 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
                                                                        AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
 #endif
 
-#ifdef NVENC_HAVE_HEVC_CONSTRAINED_ENCODING
     if (ctx->constrained_encoding)
         hevc->enableConstrainedEncoding = 1;
-#endif
 
     hevc->disableSPSPPS = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 1 : 0;
     hevc->repeatSPSPPS  = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;
@@ -1573,9 +1436,7 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
         /* Older SDKs use outputBufferingPeriodSEI to control filler data */
         hevc->outputBufferingPeriodSEI = ctx->cbr_padding;
 
-#ifdef NVENC_HAVE_FILLER_DATA
         hevc->enableFillerDataInsertion = ctx->cbr_padding;
-#endif
     }
 
     hevc->outputPictureTimingSEI = 1;
@@ -1659,15 +1520,11 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx)
 
     hevc->tier = ctx->tier;
 
-#ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE
     if (ctx->b_ref_mode >= 0)
         hevc->useBFramesAsRef = ctx->b_ref_mode;
-#endif
 
-#ifdef NVENC_HAVE_MULTIPLE_REF_FRAMES
     hevc->numRefL0 = avctx->refs;
     hevc->numRefL1 = avctx->refs;
-#endif
 
 #ifdef NVENC_HAVE_TEMPORAL_FILTER
     if (ctx->tf_level >= 0) {
@@ -1876,7 +1733,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
     preset_config.version = NV_ENC_PRESET_CONFIG_VER;
     preset_config.presetCfg.version = NV_ENC_CONFIG_VER;
 
-#ifdef NVENC_HAVE_NEW_PRESETS
     ctx->init_encode_params.tuningInfo = ctx->tuning_info;
 
     if (ctx->flags & NVENC_LOSSLESS)
@@ -1889,12 +1745,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
         ctx->init_encode_params.presetGUID,
         ctx->init_encode_params.tuningInfo,
         &preset_config);
-#else
-    nv_status = p_nvenc->nvEncGetEncodePresetConfig(ctx->nvencoder,
-        ctx->init_encode_params.encodeGUID,
-        ctx->init_encode_params.presetGUID,
-        &preset_config);
-#endif
     if (nv_status != NV_ENC_SUCCESS)
         return nvenc_print_error(avctx, nv_status, "Cannot get the preset configuration");
 
@@ -1921,13 +1771,11 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
     ctx->init_encode_params.enableEncodeAsync = 0;
     ctx->init_encode_params.enablePTD = 1;
 
-#ifdef NVENC_HAVE_NEW_PRESETS
     /* If lookahead isn't set from CLI, use value from preset.
      * P6 & P7 presets may enable lookahead for better quality.
      * */
     if (ctx->rc_lookahead == 0 && ctx->encode_config.rcParams.enableLookahead)
         ctx->rc_lookahead = ctx->encode_config.rcParams.lookaheadDepth;
-#endif
 
     if (ctx->weighted_pred == 1)
         ctx->init_encode_params.enableWeightedPrediction = 1;
@@ -1999,7 +1847,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
         return nvenc_print_error(avctx, nv_status, "InitializeEncoder failed");
     }
 
-#ifdef NVENC_HAVE_CUSTREAM_PTR
     if (ctx->cu_context) {
         nv_status = p_nvenc->nvEncSetIOCudaStreams(ctx->nvencoder, &ctx->cu_stream, &ctx->cu_stream);
         if (nv_status != NV_ENC_SUCCESS) {
@@ -2007,7 +1854,6 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
             return nvenc_print_error(avctx, nv_status, "SetIOCudaStreams failed");
         }
     }
-#endif
 
     res = nvenc_pop_context(avctx);
     if (res < 0)
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 32d4648f75..2f309b0f68 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -45,40 +45,6 @@ typedef void ID3D11Device;
 #define NVENCAPI_CHECK_VERSION(major, minor) \
     ((major) < NVENCAPI_MAJOR_VERSION || ((major) == NVENCAPI_MAJOR_VERSION && (minor) <= NVENCAPI_MINOR_VERSION))
 
-// SDK 8.1 compile time feature checks
-#if NVENCAPI_CHECK_VERSION(8, 1)
-#define NVENC_HAVE_BFRAME_REF_MODE
-#define NVENC_HAVE_QP_MAP_MODE
-#endif
-
-// SDK 9.0 compile time feature checks
-#if NVENCAPI_CHECK_VERSION(9, 0)
-#define NVENC_HAVE_HEVC_BFRAME_REF_MODE
-#endif
-
-// SDK 9.1 compile time feature checks
-#if NVENCAPI_CHECK_VERSION(9, 1)
-#define NVENC_HAVE_MULTIPLE_REF_FRAMES
-#define NVENC_HAVE_CUSTREAM_PTR
-#define NVENC_HAVE_GETLASTERRORSTRING
-#define NVENC_HAVE_FILLER_DATA
-#endif
-
-// SDK 10.0 compile time feature checks
-#if NVENCAPI_CHECK_VERSION(10, 0)
-#define NVENC_HAVE_NEW_PRESETS
-#define NVENC_HAVE_MULTIPASS
-#define NVENC_HAVE_LDKFS
-#define NVENC_HAVE_H264_LVL6
-#define NVENC_HAVE_HEVC_CONSTRAINED_ENCODING
-#endif
-
-// SDK 11.1 compile time feature checks
-#if NVENCAPI_CHECK_VERSION(11, 1)
-#define NVENC_HAVE_QP_CHROMA_OFFSETS
-#define NVENC_HAVE_SINGLE_SLICE_INTRA_REFRESH
-#endif
-
 // SDK 12.0 compile time feature checks
 #if NVENCAPI_CHECK_VERSION(12, 0)
 #define NVENC_HAVE_HEVC_OUTPUT_RECOVERY_POINT_SEI
@@ -160,7 +126,6 @@ enum {
     PRESET_LOW_LATENCY_HP,
     PRESET_LOSSLESS_DEFAULT,
     PRESET_LOSSLESS_HP,
-#ifdef NVENC_HAVE_NEW_PRESETS
     PRESET_P1,
     PRESET_P2,
     PRESET_P3,
@@ -168,7 +133,6 @@ enum {
     PRESET_P5,
     PRESET_P6,
     PRESET_P7,
-#endif
 };
 
 enum {
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 6def749f2c..f5647c9dda 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -26,11 +26,7 @@
 #define OFFSET(x) offsetof(NvencContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-#ifdef NVENC_HAVE_NEW_PRESETS
     { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 },     PRESET_DEFAULT, PRESET_P7,          VE, .unit = "preset" },
-#else
-    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_MEDIUM }, PRESET_DEFAULT, PRESET_LOSSLESS_HP, VE, .unit = "preset" },
-#endif
     { "default",      "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_DEFAULT },             0, 0, VE, .unit = "preset" },
     { "slow",         "hq 2 passes",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_SLOW },                0, 0, VE, .unit = "preset" },
     { "medium",       "hq 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_MEDIUM },              0, 0, VE, .unit = "preset" },
@@ -43,7 +39,6 @@ static const AVOption options[] = {
     { "llhp",         "low latency hp",                     0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HP },      0, 0, VE, .unit = "preset" },
     { "lossless",     "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_DEFAULT },    0, 0, VE, .unit = "preset" },
     { "losslesshp",   "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_HP },         0, 0, VE, .unit = "preset" },
-#ifdef NVENC_HAVE_NEW_PRESETS
     { "p1",          "fastest (lowest quality)",            0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P1 },                  0, 0, VE, .unit = "preset" },
     { "p2",          "faster (lower quality)",              0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P2 },                  0, 0, VE, .unit = "preset" },
     { "p3",          "fast (low quality)",                  0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P3 },                  0, 0, VE, .unit = "preset" },
@@ -56,7 +51,6 @@ static const AVOption options[] = {
     { "ll",          "Low latency",                         0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOW_LATENCY },              0, 0, VE, .unit = "tune" },
     { "ull",         "Ultra low latency",                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY },        0, 0, VE, .unit = "tune" },
     { "lossless",    "Lossless",                            0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOSSLESS },                 0, 0, VE, .unit = "tune" },
-#endif
     { "profile",      "Set the encoding profile",           OFFSET(profile),      AV_OPT_TYPE_INT,   { .i64 = NV_ENC_H264_PROFILE_HIGH }, NV_ENC_H264_PROFILE_BASELINE, NV_ENC_H264_PROFILE_HIGH_444P, VE, .unit = "profile" },
     { "baseline",     "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_BASELINE },  0, 0, VE, .unit = "profile" },
     { "main",         "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_MAIN },      0, 0, VE, .unit = "profile" },
@@ -68,11 +62,7 @@ static const AVOption options[] = {
     { "high422",      "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_HIGH_422 },  0, 0, VE, .unit = "profile" },
 #endif
     { "high444p",     "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_PROFILE_HIGH_444P }, 0, 0, VE, .unit = "profile" },
-#ifdef NVENC_HAVE_H264_LVL6
     { "level",        "Set the encoding level restriction", OFFSET(level),        AV_OPT_TYPE_INT,   { .i64 = NV_ENC_LEVEL_AUTOSELECT }, NV_ENC_LEVEL_AUTOSELECT, NV_ENC_LEVEL_H264_62, VE, .unit = "level" },
-#else
-    { "level",        "Set the encoding level restriction", OFFSET(level),        AV_OPT_TYPE_INT,   { .i64 = NV_ENC_LEVEL_AUTOSELECT }, NV_ENC_LEVEL_AUTOSELECT, NV_ENC_LEVEL_H264_52, VE, .unit = "level" },
-#endif
     { "auto",         "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AUTOSELECT },    0, 0, VE, .unit = "level" },
     { "1",            "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_1 },        0, 0, VE, .unit = "level" },
     { "1.0",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_1 },        0, 0, VE, .unit = "level" },
@@ -97,11 +87,9 @@ static const AVOption options[] = {
     { "5.0",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_5 },        0, 0, VE, .unit = "level" },
     { "5.1",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_51 },       0, 0, VE, .unit = "level" },
     { "5.2",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_52 },       0, 0, VE, .unit = "level" },
-#ifdef NVENC_HAVE_H264_LVL6
     { "6.0",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_60 },       0, 0, VE, .unit = "level" },
     { "6.1",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_61 },       0, 0, VE, .unit = "level" },
     { "6.2",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_H264_62 },       0, 0, VE, .unit = "level" },
-#endif
     { "rc",           "Override the preset rate-control",   OFFSET(rc),           AV_OPT_TYPE_INT,   { .i64 = -1 },                                  -1, INT_MAX, VE, .unit = "rc" },
     { "constqp",      "Constant QP mode",                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP },                   0, 0, VE, .unit = "rc" },
     { "vbr",          "Variable bitrate mode",              0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR },                       0, 0, VE, .unit = "rc" },
@@ -187,38 +175,27 @@ static const AVOption options[] = {
     { "cavlc",        "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC      }, 0, 0, VE, .unit = "coder" },
     { "ac",           "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CABAC      }, 0, 0, VE, .unit = "coder" },
     { "vlc",          "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC      }, 0, 0, VE, .unit = "coder" },
-#ifdef NVENC_HAVE_BFRAME_REF_MODE
     { "b_ref_mode",   "Use B frames as references",         OFFSET(b_ref_mode),   AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, .unit = "b_ref_mode" },
     { "disabled",     "B frames will not be used for reference", 0,               AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0, VE, .unit = "b_ref_mode" },
     { "each",         "Each B frame will be used for reference", 0,               AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0, VE, .unit = "b_ref_mode" },
     { "middle",       "Only (number of B frames)/2 will be used for reference", 0,AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_MIDDLE }, 0, 0, VE, .unit = "b_ref_mode" },
-#else
-    { "b_ref_mode",   "(not supported)",                    OFFSET(b_ref_mode),   AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX, VE, .unit = "b_ref_mode" },
-    { "disabled",     "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0,         VE, .unit = "b_ref_mode" },
-    { "each",         "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0,         VE, .unit = "b_ref_mode" },
-    { "middle",       "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0,         VE, .unit = "b_ref_mode" },
-#endif
     { "a53cc",        "Use A53 Closed Captions (if available)", OFFSET(a53_cc),   AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1, VE },
 #ifdef NVENC_HAVE_TIME_CODE
     { "s12m_tc",      "Use timecode (if available)",        OFFSET(s12m_tc),      AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1, VE },
 #endif
     { "dpb_size",     "Specifies the DPB size used for encoding (0 means automatic)",
                                                             OFFSET(dpb_size),     AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
-#ifdef NVENC_HAVE_MULTIPASS
     { "multipass",    "Set the multipass encoding",         OFFSET(multipass),    AV_OPT_TYPE_INT,   { .i64 = NV_ENC_MULTI_PASS_DISABLED },         NV_ENC_MULTI_PASS_DISABLED, NV_ENC_TWO_PASS_FULL_RESOLUTION, VE, .unit = "multipass" },
     { "disabled",     "Single Pass",                        0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_MULTI_PASS_DISABLED },         0,                          0,                               VE, .unit = "multipass" },
     { "qres",         "Two Pass encoding is enabled where first Pass is quarter resolution",
                                                             0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_QUARTER_RESOLUTION }, 0,                          0,                               VE, .unit = "multipass" },
     { "fullres",      "Two Pass encoding is enabled where first Pass is full resolution",
                                                             0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_FULL_RESOLUTION },    0,                          0,                               VE, .unit = "multipass" },
-#endif
 #ifdef NVENC_HAVE_H264_10BIT_SUPPORT
     { "highbitdepth", "Enable 10 bit encode for 8 bit input",OFFSET(highbitdepth),AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
 #endif
-#ifdef NVENC_HAVE_LDKFS
     { "ldkfs",        "Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR",
                                                             OFFSET(ldkfs),        AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, UCHAR_MAX, VE },
-#endif
     { "extra_sei",    "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream",
                                                             OFFSET(extra_sei),    AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1, VE },
     { "udu_sei",      "Pass on user data unregistered SEI if available",
@@ -231,10 +208,8 @@ static const AVOption options[] = {
                                                             OFFSET(max_slice_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
     { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices",
                                                             OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
-#ifdef NVENC_HAVE_FILLER_DATA
     { "cbr_padding",  "Pad the bitstream to ensure bitrate does not drop below the target in CBR mode",
                                                             OFFSET(cbr_padding),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
-#endif
 #ifdef NVENC_HAVE_H264_AND_AV1_TEMPORAL_FILTER
     { "tf_level",     "Specifies the strength of the temporal filtering",
                                                             OFFSET(tf_level),     AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX, VE, .unit = "tf_level" },
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 31624f45b1..17f3f4f027 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -26,11 +26,7 @@
 #define OFFSET(x) offsetof(NvencContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-#ifdef NVENC_HAVE_NEW_PRESETS
     { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 },     PRESET_DEFAULT, PRESET_P7,          VE, .unit = "preset" },
-#else
-    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_MEDIUM }, PRESET_DEFAULT, PRESET_LOSSLESS_HP, VE, .unit = "preset" },
-#endif
     { "default",      "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_DEFAULT },             0, 0, VE, .unit = "preset" },
     { "slow",         "hq 2 passes",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_SLOW },                0, 0, VE, .unit = "preset" },
     { "medium",       "hq 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_MEDIUM },              0, 0, VE, .unit = "preset" },
@@ -43,7 +39,6 @@ static const AVOption options[] = {
     { "llhp",         "low latency hp",                     0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HP },      0, 0, VE, .unit = "preset" },
     { "lossless",     "lossless",                           0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_DEFAULT },    0, 0, VE, .unit = "preset" },
     { "losslesshp",   "lossless hp",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_HP },         0, 0, VE, .unit = "preset" },
-#ifdef NVENC_HAVE_NEW_PRESETS
     { "p1",          "fastest (lowest quality)",            0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P1 },                  0, 0, VE, .unit = "preset" },
     { "p2",          "faster (lower quality)",              0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P2 },                  0, 0, VE, .unit = "preset" },
     { "p3",          "fast (low quality)",                  0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P3 },                  0, 0, VE, .unit = "preset" },
@@ -59,7 +54,6 @@ static const AVOption options[] = {
     { "ll",          "Low latency",                         0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOW_LATENCY },              0, 0, VE, .unit = "tune" },
     { "ull",         "Ultra low latency",                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_ULTRA_LOW_LATENCY },        0, 0, VE, .unit = "tune" },
     { "lossless",    "Lossless",                            0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TUNING_INFO_LOSSLESS },                 0, 0, VE, .unit = "tune" },
-#endif
     { "profile",      "Set the encoding profile",           OFFSET(profile),      AV_OPT_TYPE_INT,   { .i64 = NV_ENC_HEVC_PROFILE_MAIN }, NV_ENC_HEVC_PROFILE_MAIN, NV_ENC_HEVC_PROFILE_COUNT - 1, VE, .unit = "profile" },
     { "main",         "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_HEVC_PROFILE_MAIN },    0, 0, VE, .unit = "profile" },
     { "main10",       "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_HEVC_PROFILE_MAIN_10 }, 0, 0, VE, .unit = "profile" },
@@ -169,36 +163,25 @@ static const AVOption options[] = {
                                                             OFFSET(qmax),         AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 51, VE },
     { "weighted_pred","Set 1 to enable weighted prediction",
                                                             OFFSET(weighted_pred),AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, 1, VE },
-#ifdef NVENC_HAVE_HEVC_BFRAME_REF_MODE
     { "b_ref_mode",   "Use B frames as references",         OFFSET(b_ref_mode),   AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, NV_ENC_BFRAME_REF_MODE_MIDDLE, VE, .unit = "b_ref_mode" },
     { "disabled",     "B frames will not be used for reference", 0,               AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_DISABLED }, 0, 0, VE, .unit = "b_ref_mode" },
     { "each",         "Each B frame will be used for reference", 0,               AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_EACH }, 0, 0, VE, .unit = "b_ref_mode" },
     { "middle",       "Only (number of B frames)/2 will be used for reference", 0,AV_OPT_TYPE_CONST, { .i64 = NV_ENC_BFRAME_REF_MODE_MIDDLE }, 0, 0, VE, .unit = "b_ref_mode" },
-#else
-    { "b_ref_mode",   "(not supported)",                    OFFSET(b_ref_mode),   AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX, VE, .unit = "b_ref_mode" },
-    { "disabled",     "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0,         VE, .unit = "b_ref_mode" },
-    { "each",         "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0,         VE, .unit = "b_ref_mode" },
-    { "middle",       "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0,         VE, .unit = "b_ref_mode" },
-#endif
     { "a53cc",        "Use A53 Closed Captions (if available)", OFFSET(a53_cc),   AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1,       VE },
     { "s12m_tc",      "Use timecode (if available)",        OFFSET(s12m_tc),      AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1,       VE },
     { "dpb_size",     "Specifies the DPB size used for encoding (0 means automatic)",
                                                             OFFSET(dpb_size),     AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
-#ifdef NVENC_HAVE_MULTIPASS
     { "multipass",    "Set the multipass encoding",         OFFSET(multipass),    AV_OPT_TYPE_INT,   { .i64 = NV_ENC_MULTI_PASS_DISABLED },         NV_ENC_MULTI_PASS_DISABLED, NV_ENC_TWO_PASS_FULL_RESOLUTION, VE, .unit = "multipass" },
     { "disabled",     "Single Pass",                        0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_MULTI_PASS_DISABLED },         0,                          0,                               VE, .unit = "multipass" },
     { "qres",         "Two Pass encoding is enabled where first Pass is quarter resolution",
                                                             0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_QUARTER_RESOLUTION }, 0,                          0,                               VE, .unit = "multipass" },
     { "fullres",      "Two Pass encoding is enabled where first Pass is full resolution",
                                                             0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_TWO_PASS_FULL_RESOLUTION },    0,                          0,                               VE, .unit = "multipass" },
-#endif
 #ifdef NVENC_HAVE_NEW_BIT_DEPTH_API
     { "highbitdepth", "Enable 10 bit encode for 8 bit input",OFFSET(highbitdepth),AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
 #endif
-#ifdef NVENC_HAVE_LDKFS
     { "ldkfs",        "Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR",
                                                             OFFSET(ldkfs),        AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, UCHAR_MAX, VE },
-#endif
     { "extra_sei",    "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream",
                                                             OFFSET(extra_sei),    AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1, VE },
     { "udu_sei",      "Pass on user data unregistered SEI if available",
@@ -211,10 +194,8 @@ static const AVOption options[] = {
                                                             OFFSET(max_slice_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
     { "constrained-encoding", "Enable constrainedFrame encoding where each slice in the constrained picture is independent of other slices",
                                                             OFFSET(constrained_encoding), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
-#ifdef NVENC_HAVE_FILLER_DATA
     { "cbr_padding",  "Pad the bitstream to ensure bitrate does not drop below the target in CBR mode",
                                                             OFFSET(cbr_padding),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
-#endif
 #ifdef NVENC_HAVE_TEMPORAL_FILTER
     { "tf_level",     "Specifies the strength of the temporal filtering",
                                                             OFFSET(tf_level),     AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, INT_MAX, VE, .unit = "tf_level" },
-- 
2.52.0


>From fd29c73b4ae90e08ccdb866becee5b42c86fd9e1 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Tue, 23 Jun 2026 23:42:51 +0200
Subject: [PATCH 2/7] avcodec/nvenc: remove old and long deprecated rc modes

---
 libavcodec/nvenc.c      | 38 --------------------------------------
 libavcodec/nvenc.h      |  3 ---
 libavcodec/nvenc_h264.c | 21 ---------------------
 libavcodec/nvenc_hevc.c | 21 ---------------------
 4 files changed, 83 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 5ef0ed572a..3f4ff3b9a3 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -48,13 +48,7 @@
 
 #define NVENC_CAP 0x30
 
-#ifndef NVENC_NO_DEPRECATED_RC
-#define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR ||             \
-                    rc == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ || \
-                    rc == NV_ENC_PARAMS_RC_CBR_HQ)
-#else
 #define IS_CBR(rc) (rc == NV_ENC_PARAMS_RC_CBR)
-#endif
 
 const enum AVPixelFormat ff_nvenc_pix_fmts[] = {
     AV_PIX_FMT_YUV420P,
@@ -951,26 +945,10 @@ static void nvenc_override_rate_control(AVCodecContext *avctx)
     case NV_ENC_PARAMS_RC_CONSTQP:
         set_constqp(avctx);
         return;
-#ifndef NVENC_NO_DEPRECATED_RC
-    case NV_ENC_PARAMS_RC_VBR_MINQP:
-        if (avctx->qmin < 0 && ctx->qmin < 0) {
-            av_log(avctx, AV_LOG_WARNING,
-                   "The variable bitrate rate-control requires "
-                   "the 'qmin' option set.\n");
-            set_vbr(avctx);
-            return;
-        }
-        /* fall through */
-    case NV_ENC_PARAMS_RC_VBR_HQ:
-#endif
     case NV_ENC_PARAMS_RC_VBR:
         set_vbr(avctx);
         break;
     case NV_ENC_PARAMS_RC_CBR:
-#ifndef NVENC_NO_DEPRECATED_RC
-    case NV_ENC_PARAMS_RC_CBR_HQ:
-    case NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ:
-#endif
         break;
     }
 
@@ -1056,13 +1034,6 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx)
         }
     }
 
-    if (ctx->rc >= 0 && ctx->rc & RC_MODE_DEPRECATED) {
-        av_log(avctx, AV_LOG_WARNING, "Specified rc mode is deprecated.\n");
-        av_log(avctx, AV_LOG_WARNING, "Use -rc constqp/cbr/vbr, -tune and -multipass instead.\n");
-
-        ctx->rc &= ~RC_MODE_DEPRECATED;
-    }
-
     ctx->encode_config.rcParams.cbQPIndexOffset = ctx->qp_cb_offset;
     ctx->encode_config.rcParams.crQPIndexOffset = ctx->qp_cr_offset;
 
@@ -1242,15 +1213,6 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx)
 
     h264->outputPictureTimingSEI = 1;
 
-#ifndef NVENC_NO_DEPRECATED_RC
-    if (cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ ||
-        cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_CBR_HQ ||
-        cc->rcParams.rateControlMode == NV_ENC_PARAMS_RC_VBR_HQ) {
-        h264->adaptiveTransformMode = NV_ENC_H264_ADAPTIVE_TRANSFORM_ENABLE;
-        h264->fmoMode = NV_ENC_H264_FMO_DISABLE;
-    }
-#endif
-
     if (ctx->flags & NVENC_LOSSLESS) {
         h264->qpPrimeYZeroTransformBypassFlag = 1;
     } else {
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 2f309b0f68..c3c4b94b71 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -39,8 +39,6 @@ typedef void ID3D11Device;
 #include "avcodec.h"
 
 #define MAX_REGISTERED_FRAMES 64
-#define RC_MODE_DEPRECATED 0x800000
-#define RCD(rc_mode) ((rc_mode) | RC_MODE_DEPRECATED)
 
 #define NVENCAPI_CHECK_VERSION(major, minor) \
     ((major) < NVENCAPI_MAJOR_VERSION || ((major) == NVENCAPI_MAJOR_VERSION && (minor) <= NVENCAPI_MINOR_VERSION))
@@ -52,7 +50,6 @@ typedef void ID3D11Device;
 
 // SDK 12.1 compile time feature checks
 #if NVENCAPI_CHECK_VERSION(12, 1)
-#define NVENC_NO_DEPRECATED_RC
 #define NVENC_HAVE_SPLIT_FRAME_ENCODING
 #endif
 
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index f5647c9dda..dea4ea6efa 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -94,27 +94,6 @@ static const AVOption options[] = {
     { "constqp",      "Constant QP mode",                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP },                   0, 0, VE, .unit = "rc" },
     { "vbr",          "Variable bitrate mode",              0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR },                       0, 0, VE, .unit = "rc" },
     { "cbr",          "Constant bitrate mode",              0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR },                       0, 0, VE, .unit = "rc" },
-#ifndef NVENC_NO_DEPRECATED_RC
-    { "vbr_minqp",    "Variable bitrate mode with MinQP (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_MINQP) },            0, 0, VE, .unit = "rc" },
-    { "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_QUALITY) },       0, 0, VE, .unit = "rc" },
-    { "ll_2pass_size", "Multi-pass optimized for constant frame size (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP) }, 0, 0, VE, .unit = "rc" },
-    { "vbr_2pass",    "Multi-pass variable bitrate mode (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_VBR) },           0, 0, VE, .unit = "rc" },
-    { "cbr_ld_hq",    "Constant bitrate low delay high quality mode", 0,          AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) },      0, 0, VE, .unit = "rc" },
-    { "cbr_hq",       "Constant bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_HQ) },               0, 0, VE, .unit = "rc" },
-    { "vbr_hq",       "Variable bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_HQ) },               0, 0, VE, .unit = "rc" },
-#else
-    { "vbr_minqp",    "Variable bitrate mode with MinQP (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-    { "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-    { "ll_2pass_size", "Multi-pass optimized for constant frame size (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) },                  0, 0, VE, .unit = "rc" },
-    { "vbr_2pass",    "Multi-pass variable bitrate mode (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-    { "cbr_ld_hq",    "Constant bitrate low delay high quality mode", 0,          AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) },                  0, 0, VE, .unit = "rc" },
-    { "cbr_hq",       "Constant bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) },                  0, 0, VE, .unit = "rc" },
-    { "vbr_hq",       "Variable bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-#endif
     { "rc-lookahead", "Number of frames to look ahead for rate-control",
                                                             OFFSET(rc_lookahead), AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
     { "surfaces",     "Number of concurrent surfaces",      OFFSET(nb_surfaces),  AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 17f3f4f027..f8e905282a 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -89,27 +89,6 @@ static const AVOption options[] = {
     { "constqp",      "Constant QP mode",                   0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CONSTQP },                   0, 0, VE, .unit = "rc" },
     { "vbr",          "Variable bitrate mode",              0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_VBR },                       0, 0, VE, .unit = "rc" },
     { "cbr",          "Constant bitrate mode",              0,                    AV_OPT_TYPE_CONST, { .i64 = NV_ENC_PARAMS_RC_CBR },                       0, 0, VE, .unit = "rc" },
-#ifndef NVENC_NO_DEPRECATED_RC
-    { "vbr_minqp",    "Variable bitrate mode with MinQP (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_MINQP) },            0, 0, VE, .unit = "rc" },
-    { "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_QUALITY) },       0, 0, VE, .unit = "rc" },
-    { "ll_2pass_size", "Multi-pass optimized for constant frame size (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_FRAMESIZE_CAP) }, 0, 0, VE, .unit = "rc" },
-    { "vbr_2pass",    "Multi-pass variable bitrate mode (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_2_PASS_VBR) },           0, 0, VE, .unit = "rc" },
-    { "cbr_ld_hq",    "Constant bitrate low delay high quality mode", 0,          AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_LOWDELAY_HQ) },      0, 0, VE, .unit = "rc" },
-    { "cbr_hq",       "Constant bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR_HQ) },               0, 0, VE, .unit = "rc" },
-    { "vbr_hq",       "Variable bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR_HQ) },               0, 0, VE, .unit = "rc" },
-#else
-    { "vbr_minqp",    "Variable bitrate mode with MinQP (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-    { "ll_2pass_quality", "Multi-pass optimized for image quality (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-    { "ll_2pass_size", "Multi-pass optimized for constant frame size (deprecated)",
-                                                            0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) },                  0, 0, VE, .unit = "rc" },
-    { "vbr_2pass",    "Multi-pass variable bitrate mode (deprecated)", 0,         AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-    { "cbr_ld_hq",    "Constant bitrate low delay high quality mode", 0,          AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) },                  0, 0, VE, .unit = "rc" },
-    { "cbr_hq",       "Constant bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_CBR) },                  0, 0, VE, .unit = "rc" },
-    { "vbr_hq",       "Variable bitrate high quality mode", 0,                    AV_OPT_TYPE_CONST, { .i64 = RCD(NV_ENC_PARAMS_RC_VBR) },                  0, 0, VE, .unit = "rc" },
-#endif
     { "rc-lookahead", "Number of frames to look ahead for rate-control",
                                                             OFFSET(rc_lookahead), AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
     { "surfaces",     "Number of concurrent surfaces",      OFFSET(nb_surfaces),  AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
-- 
2.52.0


>From 9c2521136a9fe5bda9131682daacdc950ca8fdb5 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Tue, 23 Jun 2026 23:52:40 +0200
Subject: [PATCH 3/7] avcodec/nvenc: remove legacy cbr and 2pass AVOptions

---
 libavcodec/nvenc.c      | 6 ++----
 libavcodec/nvenc.h      | 2 --
 libavcodec/nvenc_h264.c | 2 --
 libavcodec/nvenc_hevc.c | 2 --
 4 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 3f4ff3b9a3..d4f90f6d72 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -1021,13 +1021,11 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx)
 
     if (ctx->flags & NVENC_ONE_PASS)
         ctx->encode_config.rcParams.multiPass = NV_ENC_MULTI_PASS_DISABLED;
-    if (ctx->flags & NVENC_TWO_PASSES || ctx->twopass > 0)
+    if (ctx->flags & NVENC_TWO_PASSES)
         ctx->encode_config.rcParams.multiPass = NV_ENC_TWO_PASS_FULL_RESOLUTION;
 
     if (ctx->rc < 0) {
-        if (ctx->cbr) {
-            ctx->rc = NV_ENC_PARAMS_RC_CBR;
-        } else if (ctx->cqp >= 0) {
+        if (ctx->cqp >= 0) {
             ctx->rc = NV_ENC_PARAMS_RC_CONSTQP;
         } else if (ctx->quality >= 0.0f) {
             ctx->rc = NV_ENC_PARAMS_RC_VBR;
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index c3c4b94b71..60573fe800 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -234,10 +234,8 @@ typedef struct NvencContext
     int level;
     int tier;
     int rc;
-    int cbr;
     int tile_rows;
     int tile_cols;
-    int twopass;
     int device;
     int flags;
     int async_depth;
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index dea4ea6efa..e9fddf1fd9 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -97,8 +97,6 @@ static const AVOption options[] = {
     { "rc-lookahead", "Number of frames to look ahead for rate-control",
                                                             OFFSET(rc_lookahead), AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
     { "surfaces",     "Number of concurrent surfaces",      OFFSET(nb_surfaces),  AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
-    { "cbr",          "Use cbr encoding mode",              OFFSET(cbr),          AV_OPT_TYPE_BOOL,  { .i64 = 0 },   0, 1, VE },
-    { "2pass",        "Use 2pass encoding mode",            OFFSET(twopass),      AV_OPT_TYPE_BOOL,  { .i64 = -1 }, -1, 1, VE },
     { "gpu",          "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.",
                                                             OFFSET(device),       AV_OPT_TYPE_INT,   { .i64 = ANY_DEVICE },   -2, INT_MAX, VE, .unit = "gpu" },
     { "any",          "Pick the first device available",    0,                    AV_OPT_TYPE_CONST, { .i64 = ANY_DEVICE },          0, 0, VE, .unit = "gpu" },
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index f8e905282a..9709ebba66 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -92,8 +92,6 @@ static const AVOption options[] = {
     { "rc-lookahead", "Number of frames to look ahead for rate-control",
                                                             OFFSET(rc_lookahead), AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, INT_MAX, VE },
     { "surfaces",     "Number of concurrent surfaces",      OFFSET(nb_surfaces),  AV_OPT_TYPE_INT,   { .i64 = 0 }, 0, MAX_REGISTERED_FRAMES, VE },
-    { "cbr",          "Use cbr encoding mode",              OFFSET(cbr),          AV_OPT_TYPE_BOOL,  { .i64 = 0 },   0, 1, VE },
-    { "2pass",        "Use 2pass encoding mode",            OFFSET(twopass),      AV_OPT_TYPE_BOOL,  { .i64 = -1 }, -1, 1, VE },
     { "gpu",          "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.",
                                                             OFFSET(device),       AV_OPT_TYPE_INT,   { .i64 = ANY_DEVICE }, -2, INT_MAX, VE, .unit = "gpu" },
     { "any",          "Pick the first device available",    0,                    AV_OPT_TYPE_CONST, { .i64 = ANY_DEVICE },        0, 0, VE, .unit = "gpu" },
-- 
2.52.0


>From 0cb32b71c168ec2771af21c4e8ed8119d62a2aa0 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Tue, 23 Jun 2026 23:59:52 +0200
Subject: [PATCH 4/7] avcodec/nvenc: remove deprecated preset aliases

---
 libavcodec/nvenc.c      | 13 -------------
 libavcodec/nvenc.h      | 13 +------------
 libavcodec/nvenc_av1.c  |  3 +--
 libavcodec/nvenc_h264.c | 11 +----------
 libavcodec/nvenc_hevc.c | 11 +----------
 5 files changed, 4 insertions(+), 47 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index d4f90f6d72..5f324032f6 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -211,16 +211,6 @@ static void nvenc_map_preset(NvencContext *ctx)
         PRESET_ALIAS(SLOW,   P7, NVENC_TWO_PASSES),
         PRESET_ALIAS(MEDIUM, P4, NVENC_ONE_PASS),
         PRESET_ALIAS(FAST,   P1, NVENC_ONE_PASS),
-        // Compat aliases
-        PRESET_ALIAS(DEFAULT,             P4, NVENC_DEPRECATED_PRESET),
-        PRESET_ALIAS(HP,                  P1, NVENC_DEPRECATED_PRESET),
-        PRESET_ALIAS(HQ,                  P7, NVENC_DEPRECATED_PRESET),
-        PRESET_ALIAS(BD,                  P5, NVENC_DEPRECATED_PRESET),
-        PRESET_ALIAS(LOW_LATENCY_DEFAULT, P4, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
-        PRESET_ALIAS(LOW_LATENCY_HP,      P1, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
-        PRESET_ALIAS(LOW_LATENCY_HQ,      P7, NVENC_DEPRECATED_PRESET | NVENC_LOWLATENCY),
-        PRESET_ALIAS(LOSSLESS_DEFAULT,    P4, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
-        PRESET_ALIAS(LOSSLESS_HP,         P1, NVENC_DEPRECATED_PRESET | NVENC_LOSSLESS),
     };
 
     GUIDTuple *t = &presets[ctx->preset];
@@ -714,9 +704,6 @@ static av_cold int nvenc_setup_device(AVCodecContext *avctx)
 
     nvenc_map_preset(ctx);
 
-    if (ctx->flags & NVENC_DEPRECATED_PRESET)
-        av_log(avctx, AV_LOG_WARNING, "The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.\n");
-
     if (avctx->pix_fmt == AV_PIX_FMT_CUDA || avctx->pix_fmt == AV_PIX_FMT_D3D11 || avctx->hw_frames_ctx || avctx->hw_device_ctx) {
         AVHWFramesContext   *frames_ctx;
         AVHWDeviceContext   *hwdev_ctx;
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index 60573fe800..ad6ddaa434 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -111,18 +111,9 @@ typedef struct NvencDynLoadFunctions
 } NvencDynLoadFunctions;
 
 enum {
-    PRESET_DEFAULT = 0,
-    PRESET_SLOW,
+    PRESET_SLOW = 0,
     PRESET_MEDIUM,
     PRESET_FAST,
-    PRESET_HP,
-    PRESET_HQ,
-    PRESET_BD ,
-    PRESET_LOW_LATENCY_DEFAULT ,
-    PRESET_LOW_LATENCY_HQ ,
-    PRESET_LOW_LATENCY_HP,
-    PRESET_LOSSLESS_DEFAULT,
-    PRESET_LOSSLESS_HP,
     PRESET_P1,
     PRESET_P2,
     PRESET_P3,
@@ -161,8 +152,6 @@ enum {
     NVENC_LOSSLESS   = 2,
     NVENC_ONE_PASS   = 4,
     NVENC_TWO_PASSES = 8,
-
-    NVENC_DEPRECATED_PRESET = 0x8000,
 };
 
 enum {
diff --git a/libavcodec/nvenc_av1.c b/libavcodec/nvenc_av1.c
index 9f77dc2d92..b687260ef7 100644
--- a/libavcodec/nvenc_av1.c
+++ b/libavcodec/nvenc_av1.c
@@ -26,8 +26,7 @@
 #define OFFSET(x) offsetof(NvencContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 }, PRESET_DEFAULT, PRESET_P7, VE, .unit = "preset" },
-    { "default",      "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_DEFAULT }, 0, 0, VE, .unit = "preset" },
+    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 }, PRESET_SLOW, PRESET_P7, VE, .unit = "preset" },
     { "slow",         "hq 2 passes",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_SLOW },    0, 0, VE, .unit = "preset" },
     { "medium",       "hq 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_MEDIUM },  0, 0, VE, .unit = "preset" },
     { "fast",         "hp 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_FAST },    0, 0, VE, .unit = "preset" },
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index e9fddf1fd9..132c2d6a5d 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -26,19 +26,10 @@
 #define OFFSET(x) offsetof(NvencContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 },     PRESET_DEFAULT, PRESET_P7,          VE, .unit = "preset" },
-    { "default",      "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_DEFAULT },             0, 0, VE, .unit = "preset" },
+    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 },     PRESET_SLOW, PRESET_P7,             VE, .unit = "preset" },
     { "slow",         "hq 2 passes",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_SLOW },                0, 0, VE, .unit = "preset" },
     { "medium",       "hq 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_MEDIUM },              0, 0, VE, .unit = "preset" },
     { "fast",         "hp 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_FAST },                0, 0, VE, .unit = "preset" },
-    { "hp",           "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_HP },                  0, 0, VE, .unit = "preset" },
-    { "hq",           "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_HQ },                  0, 0, VE, .unit = "preset" },
-    { "bd",           "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_BD },                  0, 0, VE, .unit = "preset" },
-    { "ll",           "low latency",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_DEFAULT }, 0, 0, VE, .unit = "preset" },
-    { "llhq",         "low latency hq",                     0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HQ },      0, 0, VE, .unit = "preset" },
-    { "llhp",         "low latency hp",                     0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HP },      0, 0, VE, .unit = "preset" },
-    { "lossless",     "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_DEFAULT },    0, 0, VE, .unit = "preset" },
-    { "losslesshp",   "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_HP },         0, 0, VE, .unit = "preset" },
     { "p1",          "fastest (lowest quality)",            0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P1 },                  0, 0, VE, .unit = "preset" },
     { "p2",          "faster (lower quality)",              0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P2 },                  0, 0, VE, .unit = "preset" },
     { "p3",          "fast (low quality)",                  0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P3 },                  0, 0, VE, .unit = "preset" },
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 9709ebba66..38907b497d 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -26,19 +26,10 @@
 #define OFFSET(x) offsetof(NvencContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 },     PRESET_DEFAULT, PRESET_P7,          VE, .unit = "preset" },
-    { "default",      "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_DEFAULT },             0, 0, VE, .unit = "preset" },
+    { "preset",       "Set the encoding preset",            OFFSET(preset),       AV_OPT_TYPE_INT,   { .i64 = PRESET_P4 },     PRESET_SLOW, PRESET_P7,             VE, .unit = "preset" },
     { "slow",         "hq 2 passes",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_SLOW },                0, 0, VE, .unit = "preset" },
     { "medium",       "hq 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_MEDIUM },              0, 0, VE, .unit = "preset" },
     { "fast",         "hp 1 pass",                          0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_FAST },                0, 0, VE, .unit = "preset" },
-    { "hp",           "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_HP },                  0, 0, VE, .unit = "preset" },
-    { "hq",           "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_HQ },                  0, 0, VE, .unit = "preset" },
-    { "bd",           "",                                   0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_BD },                  0, 0, VE, .unit = "preset" },
-    { "ll",           "low latency",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_DEFAULT }, 0, 0, VE, .unit = "preset" },
-    { "llhq",         "low latency hq",                     0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HQ },      0, 0, VE, .unit = "preset" },
-    { "llhp",         "low latency hp",                     0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HP },      0, 0, VE, .unit = "preset" },
-    { "lossless",     "lossless",                           0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_DEFAULT },    0, 0, VE, .unit = "preset" },
-    { "losslesshp",   "lossless hp",                        0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_HP },         0, 0, VE, .unit = "preset" },
     { "p1",          "fastest (lowest quality)",            0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P1 },                  0, 0, VE, .unit = "preset" },
     { "p2",          "faster (lower quality)",              0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P2 },                  0, 0, VE, .unit = "preset" },
     { "p3",          "fast (low quality)",                  0,                    AV_OPT_TYPE_CONST, { .i64 = PRESET_P3 },                  0, 0, VE, .unit = "preset" },
-- 
2.52.0


>From 2bed6c63b6b00f6c37135f635b7759973eedb6b0 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Wed, 24 Jun 2026 00:08:18 +0200
Subject: [PATCH 5/7] avcodec/nvenc: remove legacy option aliases

---
 libavcodec/nvenc_h264.c | 2 --
 libavcodec/nvenc_hevc.c | 2 --
 2 files changed, 4 deletions(-)

diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 132c2d6a5d..103c9a95fd 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -106,9 +106,7 @@ static const AVOption options[] = {
     { "b_adapt",      "When lookahead is enabled, set this to 0 to disable adaptive B-frame decision",
                                                             OFFSET(b_adapt),      AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0,  1, VE },
     { "spatial-aq",   "set to 1 to enable Spatial AQ",      OFFSET(aq),           AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0,  1, VE },
-    { "spatial_aq",   "set to 1 to enable Spatial AQ",      OFFSET(aq),           AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0,  1, VE },
     { "temporal-aq",  "set to 1 to enable Temporal AQ",     OFFSET(temporal_aq),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0,  1, VE },
-    { "temporal_aq",  "set to 1 to enable Temporal AQ",     OFFSET(temporal_aq),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0,  1, VE },
     { "zerolatency",  "Set 1 to indicate zero latency operation (no reordering delay)",
                                                             OFFSET(zerolatency),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0,  1, VE },
     { "nonref_p",     "Set this to 1 to enable automatic insertion of non-reference P-frames",
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 38907b497d..94ba34c48b 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -100,9 +100,7 @@ static const AVOption options[] = {
                                                             OFFSET(forced_idr),   AV_OPT_TYPE_BOOL,  { .i64 = 0 }, -1, 1, VE },
     { "b_adapt",      "When lookahead is enabled, set this to 0 to disable adaptive B-frame decision",
                                                             OFFSET(b_adapt),      AV_OPT_TYPE_BOOL,  { .i64 = 1 }, 0, 1, VE },
-    { "spatial_aq",   "set to 1 to enable Spatial AQ",      OFFSET(aq),           AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
     { "spatial-aq",   "set to 1 to enable Spatial AQ",      OFFSET(aq),           AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
-    { "temporal_aq",  "set to 1 to enable Temporal AQ",     OFFSET(temporal_aq),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
     { "temporal-aq",  "set to 1 to enable Temporal AQ",     OFFSET(temporal_aq),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
     { "zerolatency",  "Set 1 to indicate zero latency operation (no reordering delay)",
                                                             OFFSET(zerolatency),  AV_OPT_TYPE_BOOL,  { .i64 = 0 }, 0, 1, VE },
-- 
2.52.0


>From 3cc1713867b6d2057604c8008257af46a1f39ba6 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Wed, 24 Jun 2026 00:23:15 +0200
Subject: [PATCH 6/7] avcodec/nvenc: reject deprecated global_quality instead
 of -qp

---
 libavcodec/nvenc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 5f324032f6..ff2b26c3bc 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -989,11 +989,10 @@ static av_cold int nvenc_setup_rate_control(AVCodecContext *avctx)
 {
     NvencContext *ctx = avctx->priv_data;
 
-    if (avctx->global_quality > 0)
-        av_log(avctx, AV_LOG_WARNING, "Using global_quality with nvenc is deprecated. Use qp instead.\n");
-
-    if (ctx->cqp < 0 && avctx->global_quality > 0)
-        ctx->cqp = avctx->global_quality;
+    if (avctx->global_quality > 0) {
+        av_log(avctx, AV_LOG_ERROR, "Using global_quality with nvenc is not supported. Use qp instead.\n");
+        return AVERROR(EINVAL);
+    }
 
     if (avctx->bit_rate > 0) {
         ctx->encode_config.rcParams.averageBitRate = avctx->bit_rate;
-- 
2.52.0


>From d36397468ae716974956db4e95314023a3eb2363 Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Wed, 24 Jun 2026 00:33:36 +0200
Subject: [PATCH 7/7] libavcodec: minor version bump after nvenc changes

---
 Changelog            | 1 +
 libavcodec/version.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Changelog b/Changelog
index 8cfac4c1a7..beacc002b0 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version <next>:
 - Bitstream filter to split Dolby Vision multi-layer HEVC
 - Add AMF hardware memory mapping support.
 - ONNX Runtime DNN backend with GPU execution provider support
+- Remove deprecated NVENC options and support for pre-11.1 SDK versions
 
 
 version 8.1:
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8c3d476003..5957009457 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR   0
+#define LIBAVCODEC_VERSION_MINOR   1
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.