Set video bit rate to 0 if an invalid bit rate detected (which happens when using crf) (#191)

This commit is contained in:
Jonathan Thomas
2019-01-26 17:56:15 -06:00
committed by GitHub
parent 0587ada6dc
commit f66ccb11c4

View File

@@ -148,6 +148,8 @@ void FFmpegWriter::SetVideoOptions(bool has_video, string codec, Fraction fps, i
}
if (bit_rate >= 1000) // bit_rate is the bitrate in b/s
info.video_bit_rate = bit_rate;
else
info.video_bit_rate = 0;
info.interlaced_frame = interlaced;
info.top_field_first = top_field_first;
@@ -968,9 +970,12 @@ AVStream* FFmpegWriter::add_video_stream()
#endif
/* Init video encoder options */
if (info.video_bit_rate > 1000) {
if (info.video_bit_rate >= 1000) {
c->bit_rate = info.video_bit_rate;
}
else {
c->bit_rate = 0;
}
//TODO: Implement variable bitrate feature (which actually works). This implementation throws
//invalid bitrate errors and rc buffer underflow errors, etc...