[FFmpeg-devel] [PATCH] avformat/mpegts: unset DTS/PTS for subtitle PES packets if PCR not available
jeebjp at gmail.com
Fri Dec 21 21:04:14 EET 2018
On Wed, Dec 19, 2018 at 8:56 PM Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Sat, Dec 15, 2018 at 08:50:41PM +0200, Jan Ekström wrote:
> > Fixes issues when a subtitle packet is received before PCR for the
> > program has been received, leading to wildly jumping timestamps
> > on the lavf client side as well as in the re-ordering logic.
> > This usually happens in case of multiplexes where the PCR of a
> > program is not taken into account with subtitle tracks' DTS/PTS.
> > ---
> > libavformat/mpegts.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> For the record, so this is not lost on IRC and causes misunderstandings
> <michaelni> JEEB, if you prefer the simple solution iam fine with that too but i might (if i find time) rewrite it to do the buffering so the timestamps arent lost in the cases this affects
As Michael is OK with this, If there are no further comments, I will
push this tomorrow morning.
As a reminder of what this improves:
Steps to show difference:
1. ffprobe -of json -show_packets -show_programs - > before.json
2. ffprobe -of json -show_packets -show_programs - > after.json
3. git diff --no-index before.json after.json
Example of a failing ffmpeg.c command line without these changes
(requires the libzvbi teletext decoder to be enabled):
ffmpeg -fix_sub_duration -txt_format text -v verbose -i
2018-04-04-funky_teletext_mux.cut.ts -c:v mpeg4 -c:a aac -c:s ass
This works after this patch is applied and the incorrect timestamp is
no longer there in the first teletext subtitle packet.
More information about the ffmpeg-devel