@@ -492,7 +492,14 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va
492492 }
493493 break ;
494494 case AV_CODEC_ID_HEVC :
495- av_opt_set_int (c->priv_data , " crf" , std::min (std::stoi (value), 51 ), 0 ); // 0-51
495+ if (strstr (info.vcodec .c_str (), " svt_hevc" ) != NULL ) {
496+ av_opt_set_int (c->priv_data , " preset" , 7 , 0 );
497+ av_opt_set_int (c->priv_data , " forced-idr" ,1 ,0 );
498+ av_opt_set_int (c->priv_data , " qp" ,std::min (std::stoi (value), 51 ),0 );
499+ }
500+ else {
501+ av_opt_set_int (c->priv_data , " crf" , std::min (std::stoi (value), 51 ), 0 ); // 0-51
502+ }
496503 if (std::stoi (value) == 0 ) {
497504 av_opt_set (c->priv_data , " preset" , " veryslow" , 0 );
498505 av_opt_set_int (c->priv_data , " lossless" , 1 , 0 );
@@ -545,6 +552,13 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va
545552 else {
546553 av_opt_set_int (c->priv_data , " crf" , std::min (std::stoi (value),63 ), 0 );
547554 }
555+ case AV_CODEC_ID_HEVC :
556+ c->bit_rate = 0 ;
557+ if (strstr (info.vcodec .c_str (), " svt_hevc" ) != NULL ) {
558+ av_opt_set_int (c->priv_data , " qp" , std::min (std::stoi (value),51 ), 0 );
559+ av_opt_set_int (c->priv_data , " preset" , 7 , 0 );
560+ av_opt_set_int (c->priv_data , " forced-idr" ,1 ,0 );
561+ }
548562 break ;
549563 }
550564#endif
0 commit comments