[FFmpeg-devel] [PATCH] lavf/mov: make invalid mdhd time_scale default to 1 instead of erroring out
Matthieu Bouron
matthieu.bouron at gmail.com
Thu May 11 17:33:50 EEST 2017
Some samples have their metadata track time_scale incorrectly set to 0
and the check introduced by a398f054fdb9b0f0b5a91c231fba6ce014143f71
prevents playback of those samples. Setting the time_scale to 1 fixes
playback.
---
libavformat/mov.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index afef53b79a..3c8b75ddb3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1236,8 +1236,8 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->time_scale = avio_rb32(pb);
if (sc->time_scale <= 0) {
- av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d\n", sc->time_scale);
- return AVERROR_INVALIDDATA;
+ av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 1\n", sc->time_scale);
+ sc->time_scale = 1;
}
st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */
--
2.12.2
More information about the ffmpeg-devel
mailing list