@@ -1086,7 +1086,11 @@ bool VideoEncoder::Impl::init_video_codec_av(const AVCodec *codec)
1086
1086
video.av_ctx ->rc_max_rate = options.realtime_options .max_bitrate_kbits * 1000 ;
1087
1087
video.av_ctx ->gop_size = int (options.realtime_options .gop_seconds *
1088
1088
float (video.av_ctx ->framerate .num ) / float (video.av_ctx ->framerate .den ));
1089
- if (video.av_ctx ->gop_size == 0 )
1089
+
1090
+ // TODO: Is there a way to express infinite GOP here?
1091
+ if (video.av_ctx ->gop_size < 0 )
1092
+ video.av_ctx ->gop_size = 120 ;
1093
+ else if (video.av_ctx ->gop_size == 0 )
1090
1094
video.av_ctx ->gop_size = 1 ;
1091
1095
1092
1096
if (is_x264)
@@ -1229,8 +1233,17 @@ bool VideoEncoder::Impl::init_video_codec_pyro(PyroEnc::Profile profile)
1229
1233
rate_info.mode = options.low_latency ? PyroEnc::RateControlMode::CBR : PyroEnc::RateControlMode::VBR;
1230
1234
rate_info.bitrate_kbits = options.realtime_options .bitrate_kbits ;
1231
1235
rate_info.max_bitrate_kbits = options.realtime_options .max_bitrate_kbits ;
1232
- rate_info.gop_frames = unsigned (
1233
- options.realtime_options .gop_seconds * float (pyro_info.frame_rate_num ) / float (pyro_info.frame_rate_den ));
1236
+
1237
+ if (options.realtime_options .gop_seconds < 0 .0f )
1238
+ {
1239
+ rate_info.gop_frames = UINT32_MAX;
1240
+ }
1241
+ else
1242
+ {
1243
+ rate_info.gop_frames = unsigned (
1244
+ options.realtime_options .gop_seconds * float (pyro_info.frame_rate_num ) /
1245
+ float (pyro_info.frame_rate_den ));
1246
+ }
1234
1247
1235
1248
if (!pyro_encoder.set_rate_control_info (rate_info))
1236
1249
{
0 commit comments