bit_rate is not a critical field, and we shouln't hard fail if we can't caluclate it due to a large timebase - it needlessly breaks valid files.
Signed-off-by: Derek Buitenhuis <derek.buitenh...@gmail.com> --- libavformat/mov.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index d0b8b2595b..99d10c2b33 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -7666,11 +7666,12 @@ static int mov_read_header(AVFormatContext *s) MOVStreamContext *sc = st->priv_data; if (st->duration > 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", + av_log(s, AV_LOG_WARNING, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", sc->data_size, sc->time_scale); - return AVERROR_INVALIDDATA; - } - st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration; + if (s->error_recognition & AV_EF_EXPLODE) + return AVERROR_INVALIDDATA; + } else + st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / st->duration; } } } @@ -7681,12 +7682,13 @@ static int mov_read_header(AVFormatContext *s) MOVStreamContext *sc = st->priv_data; 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", + av_log(s, AV_LOG_WARNING, "Overflow during bit rate calculation %"PRId64" * 8 * %d\n", sc->data_size, sc->time_scale); - return AVERROR_INVALIDDATA; - } - st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / - sc->duration_for_fps; + if (s->error_recognition & AV_EF_EXPLODE) + return AVERROR_INVALIDDATA; + } else + st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale / + sc->duration_for_fps; } } } -- 2.32.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".