PR #21380 opened by Jan Ekström (jeeb) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21380 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21380.patch
Adds DTS to packets which would otherwise break tbr calculation within libavformat, as well as packet rate calculation in ffmpeg. An example of such input would be an MPEG-TS stream where a whole GOP is put into a single PES packet. Co-authored-by: Jan Ekström <[email protected]> Signed-off-by: Jan Ekström <[email protected]> From 1d5affdfdef4c361cbd79d65abc16a9a4ab5fd89 Mon Sep 17 00:00:00 2001 From: Martin Machalek <[email protected]> Date: Fri, 28 Apr 2023 15:09:22 +0200 Subject: [PATCH] avformat/demux: in case of no timestamps, calculate dts based on previous dts and duration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds DTS to packets which would otherwise break tbr calculation within libavformat, as well as packet rate calculation in ffmpeg. An example of such input would be an MPEG-TS stream where a whole GOP is put into a single PES packet. Co-authored-by: Jan Ekström <[email protected]> Signed-off-by: Jan Ekström <[email protected]> --- libavformat/demux.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/demux.c b/libavformat/demux.c index b40739dc3a..67b54aba3b 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -1152,6 +1152,12 @@ 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->pts, pkt); + + if (pkt->dts == AV_NOPTS_VALUE && pkt->pts == AV_NOPTS_VALUE && + !is_relative(sti->cur_dts) && sti->cur_dts != AV_NOPTS_VALUE && + pkt->duration > 0) + pkt->dts = sti->cur_dts + pkt->duration; + if (pkt->dts > sti->cur_dts) sti->cur_dts = pkt->dts; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
