From patchwork Fri Dec 20 22:35:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 16896 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 0282D44B14B for ; Sat, 21 Dec 2019 00:35:52 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D57936898F8; Sat, 21 Dec 2019 00:35:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86B7068832F for ; Sat, 21 Dec 2019 00:35:44 +0200 (EET) X-Originating-IP: 213.47.68.29 Received: from localhost (213-47-68-29.cable.dynamic.surfer.at [213.47.68.29]) (Authenticated sender: michael@niedermayer.cc) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 5388520004 for ; Fri, 20 Dec 2019 22:35:43 +0000 (UTC) Date: Fri, 20 Dec 2019 23:35:41 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20191220223541.GV3089@michaelspb> References: <20191217131509.46441-1-martin@martin.st> MIME-Version: 1.0 In-Reply-To: <20191217131509.46441-1-martin@martin.st> Subject: Re: [FFmpeg-devel] [PATCHv2] movenc: Write durations based on pts into mvhd/mdhd/tkhd/elst 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 Tue, Dec 17, 2019 at 03:15:09PM +0200, Martin Storsjö wrote: > Keep all the existing data fields as they are (there's lots and > lots of nontrivial calculation and heuristics based on them in > their current form), but derive the duration as the difference > between the pts of the first packet to the maximum pts+duration > (not necessarily the last packet); use this duration in any box > where the actual presentation duration is supposed to be. > > Fixes: 8420 > --- > Fixed to fetch the duration for tmcd tracks from their designated > source track. > --- > libavformat/movenc.c | 35 ++++++++++++++++++++++++++++------- > 1 file changed, 28 insertions(+), 7 deletions(-) I found another case that changes, again dont know which is more correct make -j12 && ./ffmpeg -i ~/tickets/3453/mov_with_tmcd.mov -y -bitexact -codec copy -map 0 -t 2 file.mov ; ./ffprobe -v 0 file.mov -show_packets -print_format compact > /tmp/before file should be here: https://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3453/ [...] --- /tmp/before 2019-12-20 23:28:04.009327038 +0100 +++ /tmp/after 2019-12-20 23:27:17.213326052 +0100 @@ -188,7 +188,7 @@ packet|codec_type=audio|stream_index=1|pts=88320|pts_time=1.840000|dts=88320|dts_time=1.840000|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=4096|pos=408905|flags=K_ packet|codec_type=data|stream_index=2|pts=46|pts_time=1.840000|dts=46|dts_time=1.840000|duration=1|duration_time=0.040000|convergence_duration=N/A|convergence_duration_time=N/A|size=4|pos=413001|flags=K_ packet|codec_type=audio|stream_index=1|pts=89344|pts_time=1.861333|dts=89344|dts_time=1.861333|duration=896|duration_time=0.018667|convergence_duration=N/A|convergence_duration_time=N/A|size=3584|pos=413005|flags=K_ -packet|codec_type=video|stream_index=0|pts=26624|pts_time=2.080000|dts=24064|dts_time=1.880000|duration=512|duration_time=0.040000|convergence_duration=N/A|convergence_duration_time=N/A|size=776|pos=416589|flags=_D +packet|codec_type=video|stream_index=0|pts=26624|pts_time=2.080000|dts=24064|dts_time=1.880000|duration=512|duration_time=0.040000|convergence_duration=N/A|convergence_duration_time=N/A|size=776|pos=416589|flags=__ packet|codec_type=audio|stream_index=1|pts=90240|pts_time=1.880000|dts=90240|dts_time=1.880000|duration=1024|duration_time=0.021333|convergence_duration=N/A|convergence_duration_time=N/A|size=4096|pos=417365|flags=K_ packet|codec_type=data|stream_index=2|pts=47|pts_time=1.880000|dts=47|dts_time=1.880000|duration=1|duration_time=0.040000|convergence_duration=N/A|convergence_duration_time=N/A|size=4|pos=421461|flags=K_ packet|codec_type=audio|stream_index=1|pts=91264|pts_time=1.901333|dts=91264|dts_time=1.901333|duration=896|duration_time=0.018667|convergence_duration=N/A|convergence_duration_time=N/A|size=3584|pos=421465|flags=K_