From patchwork Wed May 17 12:58:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Bouron X-Patchwork-Id: 3688 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp179603vsk; Wed, 17 May 2017 05:57:39 -0700 (PDT) X-Received: by 10.28.191.26 with SMTP id p26mr8187847wmf.54.1495025859866; Wed, 17 May 2017 05:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495025859; cv=none; d=google.com; s=arc-20160816; b=eM1tg9Hka2w2gE1IJd9FG/8WZNQ185khaDTTmcUOEdnNIXMBPGUYomhDPRsO3Fm1Nv 62BFk4sTNfHnCPpSCo/23feQfb8G9reclVAkpk09bxzEZCNNfXBKXSTgk2c8/tcGikQC ZLe8vAn5UFlTvzqENJGR09Cf/RjDTa7oh01+oG095hie815JR7REpSlFsgkx3hbmH3OT vxcWNECtPe8LPbmt+XF9GR+GCGip9xoZHQDK3sOeSjdckEjoO5xzfuxRgdJG77JLXBoO UDqqh6cQU2VrCKKwHtDvAjkgmPOdpIjdvZ+4cR9SVNPI7Up47rWPjWijH5flpWwZV4uA UMrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :in-reply-to:content-disposition:mime-version:references:message-id :to:from:date:dkim-signature:delivered-to:arc-authentication-results; bh=UR1gADEkHVgfVfiBdFI81t4yMbnij2cl0a3CnJdJ/aI=; b=N5OyyYCDqWrfSr9J0eVEnjn5QLdmuUWFpobvL9nlkvKL8GL7bhkUECaopfkKnkU/z3 7tliihD8PByI5fT88jctZKd0hXtTmKZ7en5XkIG6nltoYxA35PszWCu0/Kgkds3kQtb+ xPuh4Fpk4nt8c1pai9MrsX1MOkhspv39rR5Aby7wnQGQGECaTSHIBvkznQHzzlj7Qsjk Asy0RgYSmMMEw4cctTTpOoJbyx+IGXqnHQDFf93R5WFepDAOhe1shhuGhjHMqdBLujuw PTz1AYQL1OEjpYX9fy1pxt9vWHq8ZqvrpZhIIDTHswmDTUSrtrO3o3IJ0Xb0HcPJX7kA EYKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t138si2703355wmd.63.2017.05.17.05.57.39; Wed, 17 May 2017 05:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DDD1A6891FA; Wed, 17 May 2017 15:57:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DCCA56883CE for ; Wed, 17 May 2017 15:57:29 +0300 (EEST) Received: by mail-wm0-f54.google.com with SMTP id 70so2314582wmq.1 for ; Wed, 17 May 2017 05:57:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=X/PfUjgbQitLO9rIZASRsVtuaBoM4nxK5YLb7A2CnHw=; b=Pc7f77U6xonwtE2W7i74jj2WvYw+WO5E/Xn86CHVJquJV/8DPUGwXcMtoKgErK57ru O9lXBTuubaPXA7xh5KMhlTENof1NQ2lhL1FXy4s89uYQmFVbcgh53M7IFwXc+orSO8nN dLtH7CWBeDBrFraRANjAZEYpvM3Fp0bfM0AZPgfzeo/qB6x3q7rHhw1EwSTdjUSa0RgW //UhTC36riBT6s3vyc17asUrcBmVNwwHgdvqZd7ujW0q3/zsRN0SsOu7pcuO6g6iTZjT EvZMU388WYzwLquBTo6/s59PbTnjckg9nMex/dJOGjV1tNq6Di6bg/i5K7ay5l1vGhBq OZPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=X/PfUjgbQitLO9rIZASRsVtuaBoM4nxK5YLb7A2CnHw=; b=ALmPXlo/O4/OUoVJHBgDPhj9qvHtpc4KNqnXDf5fdDav0nzHtiHoLRT93CBdOVH1A2 w8FjNLERJ6XU9GUue34XFo8d5wuE4RkeEYMVlEGimlSpxo2z0Z0kdIATaUomw2NYVEFN nWw3YtQuEEQAym+5hUjRhRDqDABlfXpgdYAQEKHx6QXinL311aaUgeXCYhBIq3Usvnyy /ITveL3Cd2XIc1i8Su7QN+IYfQDg+QeTo1zrQ5BOhCtUMJfv5qx29Z0hEF8hXLTedvmW O11HCrZr+bny3AKCglJV3MpgfeWthUkOPg7BwBC+UnRAFTaZw9fSR0+YpOA0vY/ZrR5Q aG3g== X-Gm-Message-State: AODbwcCT2TjvAVje5UqT9VvZscTf+VRxVU+K0RI64Za61vFin8cFmebY UKG3V1Ek7Va83jCI X-Received: by 10.28.47.88 with SMTP id v85mr11914377wmv.110.1495025849751; Wed, 17 May 2017 05:57:29 -0700 (PDT) Received: from tsuri.lan (AMontsouris-653-1-6-238.w86-212.abo.wanadoo.fr. [86.212.85.238]) by smtp.gmail.com with ESMTPSA id k18sm1644729wre.9.2017.05.17.05.57.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 May 2017 05:57:28 -0700 (PDT) Date: Wed, 17 May 2017 14:58:12 +0200 From: Matthieu Bouron To: FFmpeg development discussions and patches Message-ID: <20170517125812.GD10480@tsuri.lan> References: <20170511143350.2782-1-matthieu.bouron@gmail.com> <20170512211212.GX4759@nb4> <20170517115613.GC10480@tsuri.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170517115613.GC10480@tsuri.lan> User-Agent: Mutt/1.8.2 (2017-04-18) Subject: Re: [FFmpeg-devel] [PATCH] lavf/mov: make invalid mdhd time_scale default to 1 instead of erroring out X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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). From 31d808ac885bcf1af1f546a1c8f29b1af82b381b Mon Sep 17 00:00:00 2001 From: Matthieu Bouron 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