Merge pull request #2006 from jasaw/fix-bitrate

motion: Fix bitrate
This commit is contained in:
Calin Crisan 2019-07-24 23:49:33 +03:00 committed by GitHub
commit 3ed1832bac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,13 @@
diff --git a/ffmpeg.c b/ffmpeg.c
index a8afa6e..3f731ca 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -558,7 +558,7 @@ static int ffmpeg_set_quality(struct ffmpeg *ffmpeg){
if ((strcmp(ffmpeg->codec->name, "h264_omx") == 0) || (strcmp(ffmpeg->codec->name, "mpeg4_omx") == 0)) {
// H264 OMX encoder quality can only be controlled via bit_rate
// bit_rate = ffmpeg->width * ffmpeg->height * ffmpeg->fps * quality_factor
- ffmpeg->quality = (ffmpeg->width * ffmpeg->height * ffmpeg->fps * ffmpeg->quality) >> 7;
+ ffmpeg->quality = (int)(((int64_t)ffmpeg->width * ffmpeg->height * ffmpeg->fps * ffmpeg->quality) >> 7);
// Clip bit rate to min
if (ffmpeg->quality < 4000) // magic number
ffmpeg->quality = 4000;