* [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Limit TS invalid messages
@ 2025-10-02 21:36 David Dominguez via ffmpeg-devel
2025-10-05 19:46 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
0 siblings, 1 reply; 3+ messages in thread
From: David Dominguez via ffmpeg-devel @ 2025-10-02 21:36 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: David Dominguez
mpegts_write_pes() warns when DTS - PCR is negative. This is
done to detect frames that are late for decoding, meaning that
timestamping is wrong or the muxrate value is insufficient.
But this comparison only makes sense on the first packet of
the frame. After that the comparison will always be negative
as DTS doesn't change until the next frame, resulting in
hundreds of useless warnings.
Addtionaly, for long key frames that take several frame periods
to transmity false warnings may be issued if max_delay
is low enough. For example, in low latency CC video.
Limiting the warning to the start of frame transmission fixes
these issues.
Signed-off-by: David Dominguez <ddominguez@fagormultimedia.com>
---
libavformat/mpegtsenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 6935b71cfe..d66055e1dc 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1596,7 +1596,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
set_af_flag(buf, 0x10);
q = get_ts_payload_start(buf);
// add 11, pcr references the last byte of program clock reference base
- if (dts != AV_NOPTS_VALUE && dts < pcr / SYSTEM_CLOCK_FREQUENCY_DIVISOR)
+ if (is_start && dts != AV_NOPTS_VALUE && dts < pcr / SYSTEM_CLOCK_FREQUENCY_DIVISOR)
av_log(s, AV_LOG_WARNING, "dts < pcr, TS is invalid\n");
extend_af(buf, write_pcr_bits(q, pcr));
q = get_ts_payload_start(buf);
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] Re: [PATCH] avformat/mpegtsenc: Limit TS invalid messages
2025-10-02 21:36 [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Limit TS invalid messages David Dominguez via ffmpeg-devel
@ 2025-10-05 19:46 ` Michael Niedermayer via ffmpeg-devel
2025-10-06 5:53 ` Kieran Kunhya via ffmpeg-devel
0 siblings, 1 reply; 3+ messages in thread
From: Michael Niedermayer via ffmpeg-devel @ 2025-10-05 19:46 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Michael Niedermayer
[-- Attachment #1.1: Type: text/plain, Size: 1136 bytes --]
Hi
On Thu, Oct 02, 2025 at 11:36:33PM +0200, David Dominguez via ffmpeg-devel wrote:
> mpegts_write_pes() warns when DTS - PCR is negative. This is
> done to detect frames that are late for decoding, meaning that
> timestamping is wrong or the muxrate value is insufficient.
>
> But this comparison only makes sense on the first packet of
> the frame. After that the comparison will always be negative
> as DTS doesn't change until the next frame, resulting in
> hundreds of useless warnings.
>
> Addtionaly, for long key frames that take several frame periods
> to transmity false warnings may be issued if max_delay
> is low enough. For example, in low latency CC video.
>
> Limiting the warning to the start of frame transmission fixes
> these issues.
This doesnt feel right, the time a frame is decoded has
to be after all of its parts are transmitted
But there are other people here, who know mpeg-ts much better than i
do
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The worst form of inequality is to try to make unequal things equal.
-- Aristotle
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 163 bytes --]
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] Re: [PATCH] avformat/mpegtsenc: Limit TS invalid messages
2025-10-05 19:46 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
@ 2025-10-06 5:53 ` Kieran Kunhya via ffmpeg-devel
0 siblings, 0 replies; 3+ messages in thread
From: Kieran Kunhya via ffmpeg-devel @ 2025-10-06 5:53 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Cc: Michael Niedermayer, Kieran Kunhya
On Mon, 6 Oct 2025, 04:46 Michael Niedermayer via ffmpeg-devel, <
ffmpeg-devel@ffmpeg.org> wrote:
> Hi
>
> On Thu, Oct 02, 2025 at 11:36:33PM +0200, David Dominguez via ffmpeg-devel
> wrote:
> > mpegts_write_pes() warns when DTS - PCR is negative. This is
> > done to detect frames that are late for decoding, meaning that
> > timestamping is wrong or the muxrate value is insufficient.
> >
> > But this comparison only makes sense on the first packet of
> > the frame. After that the comparison will always be negative
> > as DTS doesn't change until the next frame, resulting in
> > hundreds of useless warnings.
> >
> > Addtionaly, for long key frames that take several frame periods
> > to transmity false warnings may be issued if max_delay
> > is low enough. For example, in low latency CC video.
> >
> > Limiting the warning to the start of frame transmission fixes
> > these issues.
>
> This doesnt feel right, the time a frame is decoded has
> to be after all of its parts are transmitted
In TS, yes. This patch makes no sense.
Kieran
>
>
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-06 5:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-02 21:36 [FFmpeg-devel] [PATCH] avformat/mpegtsenc: Limit TS invalid messages David Dominguez via ffmpeg-devel
2025-10-05 19:46 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
2025-10-06 5:53 ` Kieran Kunhya via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ http://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git