summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Schubert <ischluff@mailbox.org>2017-10-29 16:10:34 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-10-29 18:28:40 +0100
commit3dca4887aef4f1c2ab2f94a02342b3f50913522c (patch)
tree9086e04e963b5e01ac0a2846d705d7051036bf89
parent75bd01090f5b93eb1d2b4543d1c01031281879a4 (diff)
dashenc: fix bitrate estimation with correct scaling
Signed-off-by: Anton Schubert <ischluff@mailbox.org> Signed-off-by: Peter Große <pegro@friiks.de> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/dashenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 04b0fd99e6..e25a660fbe 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -947,6 +947,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
for (i = 0; i < s->nb_streams; i++) {
OutputStream *os = &c->streams[i];
+ AVStream *st = s->streams[i];
char filename[1024] = "", full_path[1024], temp_path[1024];
int range_length, index_length = 0;
@@ -1001,7 +1002,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
if (!os->bit_rate) {
// calculate average bitrate of first segment
- int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / (os->max_pts - os->start_pts);
+ int64_t bitrate = (int64_t) range_length * 8 / ((os->max_pts - os->start_pts) * av_q2d(st->time_base));
if (bitrate >= 0) {
os->bit_rate = bitrate;
snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),