From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id C972D42315 for ; Fri, 17 Dec 2021 13:43:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0342868AE80; Fri, 17 Dec 2021 15:43:19 +0200 (EET) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 98D3A68A877 for ; Fri, 17 Dec 2021 15:43:12 +0200 (EET) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 1BHDhBAI012270-1BHDhBAJ012270; Fri, 17 Dec 2021 15:43:11 +0200 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id DF2BAA1439; Fri, 17 Dec 2021 15:43:10 +0200 (EET) Date: Fri, 17 Dec 2021 15:43:10 +0200 (EET) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: Message-ID: <9eb61544-deb4-439c-9661-c4b8b88f641f@martin.st> References: MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM Subject: Re: [FFmpeg-devel] [PATCH] avformat/movenc: fix duration in mdhd box 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 Cc: Zhao Zhili Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 17 Dec 2021, Zhao Zhili wrote: > It's the duration of this media, should not take account of > editlist. > --- > libavformat/movenc.c | 9 +++++++-- > tests/ref/fate/movenc | 2 +- > 2 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index 0f912dd012..643beac6f2 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -2970,8 +2970,13 @@ static int64_t calc_pts_duration(MOVMuxContext *mov, MOVTrack *track) > static int mov_write_mdhd_tag(AVIOContext *pb, MOVMuxContext *mov, > MOVTrack *track) > { > - int64_t duration = calc_pts_duration(mov, track); > - int version = duration < INT32_MAX ? 0 : 1; > + int64_t start, end; > + int64_t duration; > + int version; > + > + get_pts_range(mov, track, &start, &end); > + duration = end - start; > + version = duration < INT32_MAX ? 0 : 1; Isn't this equal to what calc_samples_pts_duration() returns? It'd be good to point out in the commit message, that c2424b1f35a1c6c06f1f9fe5f77a7157ed84e1cd was incorrect in this aspect. It'd also be good to really spell it out clearly, that (if I understand it correctly), mvhd and tkhd should present the post-editlist duration, while mdhd should have the pre-editlist duration? // Martin _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".