@@ -1999,26 +1999,36 @@ static void configure_nvenc(AVCodecContext *codec_ctx, struct setparam_param *pa
19991999 check_av_opt_set (codec_ctx->priv_data , " forced-idr" , 1 );
20002000
20012001 const bool h264 = codec_ctx->codec_id == AV_CODEC_ID_H264;
2002- #ifdef PATCHED_FF_NVENC_NO_INFINITE_GOP
2003- const bool patched_ff = true ;
2004- #else
2005- const bool patched_ff = false ;
2006- if (!h264 && param->periodic_intra != 0 ) {
2007- LOG (LOG_LEVEL_WARNING) << MOD_NAME " FFmpeg not patched, " << (param->periodic_intra != 1 ? " not " : " " ) << " enabling Intra Refresh.\n " ;
2002+ const bool hevc = codec_ctx->codec_id == AV_CODEC_ID_HEVC;
2003+ if (!h264) {
2004+ if (param->periodic_intra == 1 ) {
2005+ if (hevc) {
2006+ MSG (WARNING,
2007+ " Requeseted intra-refresh for NVENC "
2008+ " HEVC but there may occur artifacts!\n " );
2009+ } else {
2010+ MSG (WARNING,
2011+ " Requeseted intra-refresh for NVENC "
2012+ " AV1 but it won't most likely work with UG "
2013+ " because of NVENC_INFINITE_GOPLENGTH!\n " );
2014+ }
2015+ }
2016+ if (param->periodic_intra == -1 ) {
2017+ MSG (WARNING,
2018+ " Intra-refresh won't be enabled for NVENC "
2019+ " HEVC/AV1, bitrate variance will be higher!\n " );
2020+ }
20082021 }
2009- # endif
2010- if (h264 && param->periodic_intra != 0 ) {
2022+ if ((h264 && param-> periodic_intra != 0 ) ||
2023+ param->periodic_intra == 1 ) {
20112024 if (param->header_inserter_req == -1 ) {
20122025 MSG (INFO,
2013- " Auto-enabling header inserter for H.264 when "
2014- " intra-refresh used.\n " );
2026+ " Auto-enabling header inserter for %s when "
2027+ " intra-refresh used.\n " , codec_ctx-> codec -> name );
20152028 param->header_inserter_req = 1 ;
20162029 }
20172030 param->periodic_intra = 1 ;
20182031 }
2019- if (!h264 && patched_ff && param->periodic_intra != 0 ) {
2020- param->periodic_intra = 1 ;
2021- }
20222032
20232033 if (param->periodic_intra == 1 ) {
20242034 incomp_feature_warn (INCOMP_INTRA_REFRESH, param->periodic_intra );
@@ -2035,14 +2045,6 @@ static void configure_nvenc(AVCodecContext *codec_ctx, struct setparam_param *pa
20352045 double lavc_rc_buffer_size_factor = DEFAULT_NVENC_RC_BUF_SIZE_FACTOR;
20362046 if (const char *val = get_commandline_param (" lavc-rc-buffer-size-factor" )) {
20372047 lavc_rc_buffer_size_factor = stof (val);
2038- } else if (!h264) {
2039- LOG (LOG_LEVEL_WARNING)
2040- << MOD_NAME
2041- " To reduce NVENC HEVC/AV1 pulsation, you can try \" --param "
2042- " lavc-rc-buffer-size-factor=0\" "
2043- " or a small number. 0 or higher value (than default "
2044- << DEFAULT_NVENC_RC_BUF_SIZE_FACTOR
2045- << " ) may cause frame drops on receiver.\n " ;
20462048 }
20472049 codec_ctx->rc_buffer_size =
20482050 (int ) ((double ) codec_ctx->rc_max_rate / param->desc .fps *
0 commit comments