[FFmpeg-devel] [PATCH] avformat/utils fix calculating wrong bitrate on HLS, DASH stream

Dongwon Kim dongwon00.kim at gmail.com
Fri Jul 17 11:21:42 EEST 2020


Signed-off-by: Dongwon Kim <dongwon.kim at sk.com>
Signed-off-by: Dongwon Kim <dongwon00.kim at gmail.com>
---
 libavformat/utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 807d9f10cb..e90467e2e0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2715,7 +2715,8 @@ static void update_stream_timings(AVFormatContext *ic)
     if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) {
         ic->duration = duration;
     }
-    if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0) {
+    if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration > 0
+            && strcmp(ic->iformat->name, "hls") && strcmp(ic->iformat->name, "dash")) {
         /* compute the bitrate */
         double bitrate = (double) filesize * 8.0 * AV_TIME_BASE /
                          (double) ic->duration;
-- 
2.25.1



More information about the ffmpeg-devel mailing list