diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index ecc1c4f9e2..421ea79c62 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -864,6 +864,10 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) cc->profileGUID = NV_ENC_HEVC_PROFILE_MAIN10_GUID; avctx->profile = FF_PROFILE_HEVC_MAIN_10; break; + case NV_ENC_HEVC_PROFILE_REXT: + cc->profileGUID = NV_ENC_HEVC_PROFILE_FREXT_GUID; + avctx->profile = FF_PROFILE_HEVC_REXT; + break; } // force setting profile as main10 if input is 10 bit @@ -872,6 +876,12 @@ static av_cold int nvenc_setup_hevc_config(AVCodecContext *avctx) avctx->profile = FF_PROFILE_HEVC_MAIN_10; } + // force setting profile as rext if input is yuv444 + if (IS_YUV444(ctx->data_pix_fmt)) { + cc->profileGUID = NV_ENC_HEVC_PROFILE_FREXT_GUID; + avctx->profile = FF_PROFILE_HEVC_REXT; + } + hevc->chromaFormatIDC = IS_YUV444(ctx->data_pix_fmt) ? 3 : 1; hevc->pixelBitDepthMinus8 = IS_10BIT(ctx->data_pix_fmt) ? 2 : 0; diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h index 521902c77d..efc2a7ad2e 100644 --- a/libavcodec/nvenc.h +++ b/libavcodec/nvenc.h @@ -121,6 +121,7 @@ enum { enum { NV_ENC_HEVC_PROFILE_MAIN, NV_ENC_HEVC_PROFILE_MAIN_10, + NV_ENC_HEVC_PROFILE_REXT, }; enum { diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c index e8757726d3..9e94a43f66 100644 --- a/libavcodec/nvenc_hevc.c +++ b/libavcodec/nvenc_hevc.c @@ -39,9 +39,10 @@ static const AVOption options[] = { { "llhp", "low latency hp", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOW_LATENCY_HP }, 0, 0, VE, "preset" }, { "lossless", "lossless", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_DEFAULT }, 0, 0, VE, "preset" }, { "losslesshp", "lossless hp", 0, AV_OPT_TYPE_CONST, { .i64 = PRESET_LOSSLESS_HP }, 0, 0, VE, "preset" }, - { "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = NV_ENC_HEVC_PROFILE_MAIN }, NV_ENC_HEVC_PROFILE_MAIN, FF_PROFILE_HEVC_MAIN_10, VE, "profile" }, + { "profile", "Set the encoding profile", OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = NV_ENC_HEVC_PROFILE_MAIN }, NV_ENC_HEVC_PROFILE_MAIN, FF_PROFILE_HEVC_REXT, VE, "profile" }, { "main", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_HEVC_PROFILE_MAIN }, 0, 0, VE, "profile" }, { "main10", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_HEVC_PROFILE_MAIN_10 }, 0, 0, VE, "profile" }, + { "rext", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_HEVC_PROFILE_REXT }, 0, 0, VE, "profile" }, { "level", "Set the encoding level restriction", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, NV_ENC_LEVEL_AUTOSELECT, NV_ENC_LEVEL_HEVC_62, VE, "level" }, { "auto", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_AUTOSELECT }, 0, 0, VE, "level" }, { "1", "", 0, AV_OPT_TYPE_CONST, { .i64 = NV_ENC_LEVEL_HEVC_1 }, 0, 0, VE, "level" },