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 7B5674105E for ; Tue, 10 Jan 2023 20:10:31 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1CD9668BC6A; Tue, 10 Jan 2023 22:10:29 +0200 (EET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B95FB68BAA0 for ; Tue, 10 Jan 2023 22:10:22 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 7C8E7240004 for ; Tue, 10 Jan 2023 20:10:20 +0000 (UTC) Date: Tue, 10 Jan 2023 21:10:18 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230110201018.GA1949656@pb2> References: <20230103102217.1074-1-ffmpeg@gyani.pro> MIME-Version: 1.0 In-Reply-To: <20230103102217.1074-1-ffmpeg@gyani.pro> Subject: Re: [FFmpeg-devel] [PATCH] ffmpeg: apply discontinuity adjustment per-stream 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 Content-Type: multipart/mixed; boundary="===============7076768094135292154==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============7076768094135292154== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6c2NcOVqGQ03X4Wi" Content-Disposition: inline --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 03, 2023 at 03:52:17PM +0530, Gyan Doshi wrote: > At present, the offset for discontinuity adjustment is applied per-file b= ut > the check for discontinuity is intra-stream so the same discontinuity when > seen in multiple streams with copyts, leads to compounded adjustment of t= he > discontinuity offset. This introduces gaps in streams, leading to loss of= sync > or even de facto loss of stream. >=20 > The ts_offset_discont parameter is transferred to InputStream and adjusted > based on intra-stream gaps. > --- > Here's a simulated example to demonstrate the issue: > 1) generate input > ffmpeg -f lavfi -i nullsrc=3Ds=3D32x32:r=3D1,format=3Dgray -f lavfi -i an= ullsrc=3Dcl=3Dmono:r=3D8000 -c:v libx264 -preset superfast -bf 0 -crf 50 -c= :a aac -b:a 64k -muxpreload 0 -muxdelay 0 -output_ts_offset 95000 -t 100000= src-100000s.ts >=20 > 2) demo > ffmpeg -copyts -i "src-100000.ts" -vf "showinfo=3Dchecksum=3D0" -af "asho= winfo" -f null - -report >=20 > =3D=3DBefore patch=3D=3D >=20 > timestamp discontinuity for stream #0:1 (id=3D257, type=3Daudio): -954437= 17689, new offset=3D 95443717689 > timestamp discontinuity for stream #0:0 (id=3D256, type=3Dvideo): -954437= 17689, new offset=3D 190887435378 >=20 > [Parsed_ashowinfo_0 @ 000002700af98800] n:0 pts:759998976 pts_time:94999.9 > [Parsed_ashowinfo_0 @ 000002700af98800] n:1 pts:760000000 pts_time:95000 > ...=20 > [Parsed_ashowinfo_0 @ 000002700af98800] n:745202 pts:1523085824 pts_time:= 190386 > [Parsed_ashowinfo_0 @ 000002700af98800] n:745203 pts:1523086848 pts_time:= 190386 > [Parsed_ashowinfo_0 @ 000002700af98800] n:745204 pts:2286637614 pts_time:= 285830 > [Parsed_ashowinfo_0 @ 000002700af98800] n:745205 pts:2286638638 pts_time:= 285830 >=20 >=20 > [Parsed_showinfo_0 @ 000002700ec34700] n: 0 pts:8550000000 pts_time:950= 00 > [Parsed_showinfo_0 @ 000002700ec34700] n: 1 pts:8550090000 pts_time:950= 01 > ...=20 > [Parsed_showinfo_0 @ 000002700ec34700] n:95380 pts:17134200000 pts_time:1= 90380 > [Parsed_showinfo_0 @ 000002700ec34700] n:95381 pts:17134290000 pts_time:1= 90381 > [Parsed_showinfo_0 @ 000002700ec34700] n:95382 pts:25724314592 pts_time:2= 85826 > [Parsed_showinfo_0 @ 000002700ec34700] n:95383 pts:25724404592 pts_time:2= 85827 >=20 > =3D=3DAfter patch=3D=3D >=20 > timestamp discontinuity for stream #0:1 (id=3D257, type=3Daudio): -954437= 17689, new stream offset=3D 95443717689 > timestamp discontinuity for stream #0:0 (id=3D256, type=3Dvideo): -954437= 17689, new stream offset=3D 95443717689 >=20 > [Parsed_ashowinfo_0 @ 0000023c773c8880] n:0 pts:759998976 pts_time:94999.9 > [Parsed_ashowinfo_0 @ 0000023c773c8880] n:1 pts:760000000 pts_time:95000 > ...=20 > [Parsed_ashowinfo_0 @ 0000023c773c8880] n:745202 pts:1523085824 pts_time:= 190386 > [Parsed_ashowinfo_0 @ 0000023c773c8880] n:745203 pts:1523086848 pts_time:= 190386 > [Parsed_ashowinfo_0 @ 0000023c773c8880] n:745204 pts:1523087872 pts_time:= 190386 > [Parsed_ashowinfo_0 @ 0000023c773c8880] n:745205 pts:1523088896 pts_time:= 190386 >=20 >=20 > [Parsed_showinfo_0 @ 0000023c795d07c0] n: 0 pts:8550000000 pts_time:950= 00 > [Parsed_showinfo_0 @ 0000023c795d07c0] n: 1 pts:8550090000 pts_time:950= 01 > ...=20 > [Parsed_showinfo_0 @ 0000023c795d07c0] n:95380 pts:17134200000 pts_time:1= 90380 > [Parsed_showinfo_0 @ 0000023c795d07c0] n:95381 pts:17134290000 pts_time:1= 90381 > [Parsed_showinfo_0 @ 0000023c795d07c0] n:95382 pts:17134380000 pts_time:1= 90382 > [Parsed_showinfo_0 @ 0000023c795d07c0] n:95383 pts:17134470000 pts_time:1= 90383 >=20 >=20 >=20 > fftools/ffmpeg.c | 12 ++++++------ > fftools/ffmpeg.h | 8 ++++---- > 2 files changed, 10 insertions(+), 10 deletions(-) I havent looked into this but i have a slightly ungood feeling about this change thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato --6c2NcOVqGQ03X4Wi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCY73GIwAKCRBhHseHBAsP q8d+AJ9eRzXhm9LN/x7HGdZRjoL4RKFQSQCfZc8Wih8WCJBCj/w26+vT2XLSQn8= =ek3u -----END PGP SIGNATURE----- --6c2NcOVqGQ03X4Wi-- --===============7076768094135292154== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============7076768094135292154==--