Commit 3dca4887 authored by Anton Schubert's avatar Anton Schubert Committed by Michael Niedermayer

dashenc: fix bitrate estimation with correct scaling

Signed-off-by: 's avatarAnton Schubert <ischluff@mailbox.org>
Signed-off-by: 's avatarPeter Große <pegro@friiks.de>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 75bd0109
...@@ -947,6 +947,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) ...@@ -947,6 +947,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
for (i = 0; i < s->nb_streams; i++) { for (i = 0; i < s->nb_streams; i++) {
OutputStream *os = &c->streams[i]; OutputStream *os = &c->streams[i];
AVStream *st = s->streams[i];
char filename[1024] = "", full_path[1024], temp_path[1024]; char filename[1024] = "", full_path[1024], temp_path[1024];
int range_length, index_length = 0; int range_length, index_length = 0;
...@@ -1001,7 +1002,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) ...@@ -1001,7 +1002,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream)
if (!os->bit_rate) { if (!os->bit_rate) {
// calculate average bitrate of first segment // 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) { if (bitrate >= 0) {
os->bit_rate = bitrate; os->bit_rate = bitrate;
snprintf(os->bandwidth_str, sizeof(os->bandwidth_str), snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment