From patchwork Wed Nov 3 09:46:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thilo Borgmann X-Patchwork-Id: 31281 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:a610:0:0:0:0:0 with SMTP id q16csp5066907ioi; Wed, 3 Nov 2021 02:46:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ5nFuMBDh5aQunwrvKn9z6eDUHQCBw8xXbBOjvtOGTHUYQ6i7oXKKzjZQnhkO/x1dp/ur X-Received: by 2002:a05:6402:520b:: with SMTP id s11mr20337902edd.213.1635932799462; Wed, 03 Nov 2021 02:46:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635932799; cv=none; d=google.com; s=arc-20160816; b=EMwXA8YKPKuOhRp5Z9bhh2rWfSoTRJrUDNUzrnO6JkQ7U+kJOPIh4G1Fy3n8ryAuKR xKdAiPH4AsNu46Lwwl77Um4rKCrw/ne8E8DxQHWgsEi4dmsGQaeSlK57infnDf74nbo2 xplrKdEK1Q0MeSGmZlLiTLKgxMoaG5ekjaBR9DAtWBhGxRt9BN28Y10+u64S78qLasUx aOUuqoAlGuM1zWXIzyDZTE5EbvC5UyPUpOyg3k8b4doKM/UBXtQjwLGUSc999GwnQYMj Dfy4eyB2f1dINn7dIHY9cSa3/GLZN95VBsdJOTHbSwEoG8PiNq5a2/sypU1v6W4Fot20 B4gA== 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 :content-language:mime-version:date:message-id:from:to :dkim-signature:delivered-to; bh=YYWg7UM00JSYy/yhftE9cUBTiq4xeF0nvWPXyr+Azgw=; b=xxl8GMFIfzXNiH64eQS99gJNen10JTmPcVTYOfC4HduPlW7Hz9joLGxzLq2tOsueNq qHloGWGqzIVXzET26SzCSvwXQ8GuR2gmtewlTa59cBobD20n/k6KcTRxBm+lhhcF01ya xkKcIQC7luk8uCLSvehdZjyJ/GopYB5am7h30aJDIEDlWnZVp6Z3TWwSTmnltyQFoV/G ibO5ECF0gJv1srcjioIfMbfx236sw2cfwM/kEr7cB/Ul+O5IM3HAmoAZ7d/PIhnxbgBP 16U/4Jcic7zHlooSHRWdktT2GP3j2uf6+u+ih+f/Sq/TsSNB2scn0M9iU2rB4WLTnvxn j+Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mail.de header.s=mailde202009 header.b=Y0om7met; 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=mail.de Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d8si3476917edm.486.2021.11.03.02.46.38; Wed, 03 Nov 2021 02:46: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=@mail.de header.s=mailde202009 header.b=Y0om7met; 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=mail.de Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 213AC68A827; Wed, 3 Nov 2021 11:46:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from shout01.mail.de (shout01.mail.de [62.201.172.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5B8D6689E7C for ; Wed, 3 Nov 2021 11:46:28 +0200 (EET) Received: from postfix01.mail.de (postfix02.bt.mail.de [10.0.121.126]) by shout01.mail.de (Postfix) with ESMTP id 00FECA0B41 for ; Wed, 3 Nov 2021 10:46:28 +0100 (CET) Received: from smtp01.mail.de (smtp01.bt.mail.de [10.0.121.211]) by postfix01.mail.de (Postfix) with ESMTP id DB78EA03C1 for ; Wed, 3 Nov 2021 10:46:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1635932787; bh=hzMw5Q3gPWBMP8oj2RkT4kBcNReNYhZo7HlMnvMrFlA=; h=To:From:Subject:Date:From; b=Y0om7metrp4a+SznAqrm7yhH6QdhIMzv2NIt1DUl9zA3MPV1W9GJafuhOzRcEhn14 bHCObFfBNMCp79nwnlUm9MrHtfobK2ke0laQkvhnfnHqm84gk24DARfWE+q+imQI+5 KuQ9i9L/Ug1kLdxlYff9tjB5d30mw58rpb1+4EuNLI/v8RDfowv3z9NEfuvMlM92jV 6rJUyVwNH8/IjOMWwVUGgXZHPuQ606hJdBunyznhKusyGcHltPdLbJVBOmPr4bfTx+ Bz0rMHOy+wW9/7XD9Go0JO7i3fuebi2yt0VTv44oMfscKasm0u2Jwa79sVj1Byzptl pTvcVomXNIvKg== Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtp01.mail.de (Postfix) with ESMTPSA id AA5D910046B for ; Wed, 3 Nov 2021 10:46:27 +0100 (CET) To: FFmpeg development discussions and patches From: Thilo Borgmann Message-ID: <98f55a71-2854-904e-d681-e6eebcf2e12b@mail.de> Date: Wed, 3 Nov 2021 10:46:26 +0100 MIME-Version: 1.0 Content-Language: en-US X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 5746 X-purgate-ID: 154282::1635932787-00006BE6-FBF48520/0/0 Subject: [FFmpeg-devel] [PATCH] lavf/mov: Always prefer tfdt over sidx X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: IokSxrHsz5wC Hi, this effectively reverts 071930de724166bfb90fc6d368c748771188fd94 and fixes the underlying issue by always preferring TFDT. Furthermore, the current solution fails if the -use_tfdt flag is given but no TFDT box is found in the stream. -Thilo From 1ae6d7f213d0ba2360b9b1cf7fde2e3d0adde70d Mon Sep 17 00:00:00 2001 From: Thilo Borgmann Date: Tue, 2 Nov 2021 22:49:37 +0100 Subject: [PATCH] lavf/mov: Always prefer tfdt over sidx --- doc/demuxers.texi | 6 ------ libavformat/isom.h | 1 - libavformat/mov.c | 12 +++++------- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 1c9575b2e8..fa669f88fe 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -689,12 +689,6 @@ Set mfra timestamps as PTS Don't use mfra box to set timestamps @end table -@item use_tfdt -For fragmented input, set fragment's starting timestamp to @code{baseMediaDecodeTime} from the @code{tfdt} box. -Default is disabled, which will preferentially use the @code{earliest_presentation_time} from the @code{sidx} box. -In either case, the timestamp from the @code{mfra} box will be used if it's available and @code{use_mfra_for} is -set to pts or dts. - @item export_all Export unrecognized boxes within the @var{udta} box as metadata entries. The first four characters of the box type are set as the key. Default is false. diff --git a/libavformat/isom.h b/libavformat/isom.h index f3c18c95be..55e5fa7b23 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -279,7 +279,6 @@ typedef struct MOVContext { int moov_retry; int use_mfra_for; int has_looked_for_mfra; - int use_tfdt; MOVFragmentIndex frag_index; int atom_depth; unsigned int aax_mode; ///< 'aax' file has been detected diff --git a/libavformat/mov.c b/libavformat/mov.c index 3fcb1dc908..00205bb1be 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4828,16 +4828,16 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) dts = frag_stream_info->first_tfra_pts; av_log(c->fc, AV_LOG_DEBUG, "found mfra time %"PRId64 ", using it for dts\n", pts); - } else if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE && !c->use_tfdt) { + } else if (frag_stream_info->tfdt_dts != AV_NOPTS_VALUE) { + dts = frag_stream_info->tfdt_dts - sc->time_offset; + av_log(c->fc, AV_LOG_DEBUG, "found tfdt time %"PRId64 + ", using it for dts\n", dts); + } else if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE) { // FIXME: sidx earliest_presentation_time is *PTS*, s.b. // pts = frag_stream_info->sidx_pts; dts = frag_stream_info->sidx_pts - sc->time_offset; av_log(c->fc, AV_LOG_DEBUG, "found sidx time %"PRId64 ", using it for pts\n", pts); - } else if (frag_stream_info->tfdt_dts != AV_NOPTS_VALUE) { - dts = frag_stream_info->tfdt_dts - sc->time_offset; - av_log(c->fc, AV_LOG_DEBUG, "found tfdt time %"PRId64 - ", using it for dts\n", dts); } else { dts = sc->track_end - sc->time_offset; av_log(c->fc, AV_LOG_DEBUG, "found track end time %"PRId64 @@ -8533,8 +8533,6 @@ static const AVOption mov_options[] = { FLAGS, "use_mfra_for" }, {"pts", "pts", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_PTS}, 0, 0, FLAGS, "use_mfra_for" }, - {"use_tfdt", "use tfdt for fragment timestamps", OFFSET(use_tfdt), AV_OPT_TYPE_BOOL, {.i64 = 0}, - 0, 1, FLAGS}, { "export_all", "Export unrecognized metadata entries", OFFSET(export_all), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = FLAGS }, { "export_xmp", "Export full XMP metadata", OFFSET(export_xmp),