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 1C11E460F4 for ; Fri, 5 May 2023 20:25:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5BA9868BA81; Fri, 5 May 2023 23:25:44 +0300 (EEST) 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 CCB0668A48F for ; Fri, 5 May 2023 23:25:37 +0300 (EEST) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id C9EAA20004 for ; Fri, 5 May 2023 20:25:36 +0000 (UTC) Date: Fri, 5 May 2023 22:25:34 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230505202534.GJ1391451@pb2> References: <20230505113123.28404-1-jeebjp@gmail.com> MIME-Version: 1.0 In-Reply-To: <20230505113123.28404-1-jeebjp@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avformat/demux: in case of no timestamps, calculate dts based on previous dts and duration 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="===============3606356653307155227==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============3606356653307155227== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="73fGQZLCrFzENemP" Content-Disposition: inline --73fGQZLCrFzENemP Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 05, 2023 at 02:31:23PM +0300, Jan Ekstr=F6m wrote: > From: Martin Machalek >=20 > Adds DTS to packets which would otherwise break tbr calculation > within libavformat, as well as packet rate calculation in ffmpeg. >=20 > An example of such input would be an MPEG-TS stream where a whole > GOP is put into a single PES packet. >=20 > Co-authored-by: Jan Ekstr=F6m >=20 > Signed-off-by: Jan Ekstr=F6m > --- > libavformat/demux.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/libavformat/demux.c b/libavformat/demux.c > index 06de71cd6e..9a4ab28679 100644 > --- a/libavformat/demux.c > +++ b/libavformat/demux.c > @@ -1098,6 +1098,11 @@ static void compute_pkt_fields(AVFormatContext *s,= AVStream *st, > if (!onein_oneout) > // This should happen on the first packet > update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->p= ts, pkt); > + > + if (pkt->dts =3D=3D AV_NOPTS_VALUE && !is_relative(sti->cur_dts) && > + sti->cur_dts !=3D AV_NOPTS_VALUE && pkt->duration > 0) > + pkt->dts =3D sti->cur_dts + pkt->duration; > + > if (pkt->dts > sti->cur_dts) > sti->cur_dts =3D pkt->dts; This produces invalid timestamps example: [mpegts read_frame_internal stream=3D2, pts=3D310689000, dts=3D310687200,= size=3D11356, duration=3D1800, flags=3D0 [mpegts read_frame_internal stream=3D2, pts=3D310719600, dts=3D310689000,= size=3D74100, duration=3D1800, flags=3D0 [mpegts read_frame_internal stream=3D2, pts=3D310721400, dts=3D310690800,= size=3D36957, duration=3D1800, flags=3D0 -[mpegts read_frame_internal stream=3D2, pts=3D310332330, dts=3DNOPTS, siz= e=3D49072, duration=3D3600, flags=3D0 -[mpegts read_frame_internal stream=3D2, pts=3D310348800, dts=3DNOPTS, siz= e=3D16516, duration=3D3600, flags=3D0 -[mpegts read_frame_internal stream=3D2, pts=3D310356000, dts=3DNOPTS, siz= e=3D16876, duration=3D3600, flags=3D0 +[mpegts read_frame_internal stream=3D2, pts=3D310332330, dts=3D310335930,= size=3D49072, duration=3D3600, flags=3D0 +[mpegts read_frame_internal stream=3D2, pts=3D310348800, dts=3D310339530,= size=3D16516, duration=3D3600, flags=3D0 +[mpegts read_frame_internal stream=3D2, pts=3D310356000, dts=3D310343130,= size=3D16876, duration=3D3600, flags=3D0 [mpegts read_frame_internal stream=3D2, pts=3D310366800, dts=3D310332330,= size=3D51652, duration=3D3600, flags=3D0 [mpegts read_frame_internal stream=3D2, pts=3D310363200, dts=3D310348800,= size=3D15588, duration=3D3600, flags=3D0 [mpegts read_frame_internal stream=3D2, pts=3D310370400, dts=3D310356000,= size=3D21476, duration=3D3600, flags=3D0 Its not possible for a decode timestamp to be after its presentation timest= amp =20 [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein --73fGQZLCrFzENemP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZFVmOgAKCRBhHseHBAsP q2laAJ0Ufu6cWteaB9m2XH6v+e0wM2uBHACfZV0dBm/iO6UupQhzFjQwkWBByII= =h3PA -----END PGP SIGNATURE----- --73fGQZLCrFzENemP-- --===============3606356653307155227== 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". --===============3606356653307155227==--