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 BD6E945170 for ; Tue, 10 Jan 2023 16:02:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A24FA68BD26; Tue, 10 Jan 2023 18:02:51 +0200 (EET) Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9D6F968BC70 for ; Tue, 10 Jan 2023 18:02:45 +0200 (EET) Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4NrwZC0xQPz9smf for ; Tue, 10 Jan 2023 17:02:43 +0100 (CET) Message-ID: <311b55cf-563b-fbfc-ec62-051e917af010@gyani.pro> Date: Tue, 10 Jan 2023 21:32:28 +0530 MIME-Version: 1.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20230103102217.1074-1-ffmpeg@gyani.pro> <167334854686.4503.11919708033955040353@lain.khirnov.net> From: Gyan Doshi In-Reply-To: <167334854686.4503.11919708033955040353@lain.khirnov.net> X-Rspamd-Queue-Id: 4NrwZC0xQPz9smf 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-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 2023-01-10 04:32 pm, Anton Khirnov wrote: > Quoting Gyan Doshi (2023-01-03 11:22:17) >> At present, the offset for discontinuity adjustment is applied per-file but >> the check for discontinuity is intra-stream so the same discontinuity when >> seen in multiple streams with copyts, leads to compounded adjustment of the >> discontinuity offset. This introduces gaps in streams, leading to loss of sync >> or even de facto loss of stream. >> >> The ts_offset_discont parameter is transferred to InputStream and adjusted >> based on intra-stream gaps. > I never had much use for this feature, but I wonder if adding different > offsets to different streams isn't going against the whole point of > timestamps, which is synchronizing them. A robust method would have to look at the inter-stream delta among first packets in each stream after the jump, which neither the existing code nor my changes do. The existing code compares dts against next_dts for the stream where the jump is first seen, and derives the offset from that. That offset adjustment applied to all other streams may not preserve the inter-stream deltas for the packets after the jump since inter-frame intervals in each stream will be different. In practice, the discrepancy is going to be minor, except for pathological inputs. But this patch avoids the compounded adjustment currently being applied, which makes the output defunct, or worse frozen and a CPU/memory hog if video encoding is CFR. Regards, Gyan _______________________________________________ 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".