On Wed, May 17, 2017 at 01:56:13PM +0200, Matthieu Bouron wrote: > On Fri, May 12, 2017 at 11:12:12PM +0200, Michael Niedermayer wrote: > > On Thu, May 11, 2017 at 04:33:50PM +0200, Matthieu Bouron wrote: > > > 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(-) > > > > should be ok > > Do you agree if I extend the patch to apply this behaviour to the mvhd > atoms (like a398f054fdb9b0f0b5a91c231fba6ce014143f71 originally did) ?
Here is an updated version of the patch (which extends the behaviour to the mvhd atoms). -- Matthieu B.
>From 31d808ac885bcf1af1f546a1c8f29b1af82b381b Mon Sep 17 00:00:00 2001 From: Matthieu Bouron <matthieu.bou...@gmail.com> Date: Thu, 11 May 2017 15:16:22 +0200 Subject: [PATCH] lavf/mov: make invalid m{d,v}hd time_scale default to 1 instead of erroring out 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index afef53b79a..90b0ab1de7 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 */ @@ -1266,8 +1266,8 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) mov_metadata_creation_time(&c->fc->metadata, creation_time); c->time_scale = avio_rb32(pb); /* time scale */ if (c->time_scale <= 0) { - av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d\n", c->time_scale); - return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_ERROR, "Invalid mvhd time scale %d, defaulting to 1\n", c->time_scale); + c->time_scale = 1; } av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); -- 2.12.0
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel