[FFmpeg-devel] [PATCH v7] Add SUP/PGS subtitle demuxer

Michael Niedermayer michaelni at gmx.at
Wed Oct 1 18:01:29 CEST 2014


On Wed, Oct 01, 2014 at 05:32:52PM +0200, wm4 wrote:
> On Wed, 1 Oct 2014 17:11:17 +0200
> Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > > Ouch. Yeah, I think this function used to corrupt perfectly fine h264
> > > mpegts timestamps in the past or so...
> > 
> > which trac ticket is that ?
> > or do you mean by "past" that this is not relevant anymore as it has
> > been fixed already ?
> 
> It has been fixed quite a while ago.
> 
> > > If we can't reconstruct a correct DTS if it's missing, we definitely
> > > should prevent the generic libavformat code from filling in completely
> > > broken DTS. Is there a flag for this?
> > 
> > dts are not optional in mpeg*
> > if you have no dts you wont have a mpeg-TS
> > 
> > They are a integral part of the muxing process
> > used both in the buffering model as well as in stream interleaving.
> > 
> > that said its quite easy to add a flag to disable the code that
> > sets the DTS if someone really wants such flag
> 
> Well, .sup files are not mpeg... and there are some formats that store
> PTS only (like avi and mkv). I'm not sure if libavformat makes up a
> (broken) DTS for these.

no dts implies only 1 stream, as dts are the basis for stream
interleaving. You could invent some other interleaving that works
based on non montone pts if you think thats easier than just setting
dts correctly.

you could try something like this, which may prevent dts from being
set

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 55add43..4c58475 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -494,7 +494,8 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt)
         for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
             FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);

-        pkt->dts = st->pts_buffer[0];
+        if (st->codec->codec_id != AV_CODEC_ID_HDMV_PGS_SUBTITLE)
+            pkt->dts = st->pts_buffer[0];
     }

     if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141001/ff5ca811/attachment.asc>


More information about the ffmpeg-devel mailing list