diff mbox

[FFmpeg-devel,1/1] possible fix to correct (improve) bitrate estimation for streams in fragmented MP4 when calculation is based on trex_data

Message ID 20180926120044.60653-2-nick.paul.ryan@gmail.com
State New
Headers show

Commit Message

Nick Ryan Sept. 26, 2018, noon UTC
Signed-off-by: Nick Ryan <nick.paul.ryan@gmail.com>
---
 libavformat/mov.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 540e5ca057..67015a72a1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7459,14 +7459,14 @@  static int mov_read_header(AVFormatContext *s)
         for (i = 0; i < s->nb_streams; i++) {
             AVStream *st = s->streams[i];
             MOVStreamContext *sc = st->priv_data;
-            if (st->duration > 0) {
+            if (sc->duration_for_fps > 0) {
                 if (sc->data_size > INT64_MAX / sc->time_scale / 8) {
                     av_log(s, AV_LOG_ERROR, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n",
                            sc->data_size, sc->time_scale);
                     mov_read_close(s);
                     return AVERROR_INVALIDDATA;
                 }
-                st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration;
+                st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / sc->duration_for_fps;
             }
         }
     }