Message ID | 22848661.ktHMkvvdCD@komascript.de |
---|---|
State | Superseded |
Headers | show |
On Wed, Jun 20, 2018 at 09:09:11AM +0200, Markus Kohm wrote: > Recoding videos with subtitles, I often have problems with subtitle streams, > because the dts starts again with 0 after some time (I think, it is at jumping > from DVD layer 1 to 2, but I'm not sure). > > There is code in ffmpeg.c to handle such nonmonolithic dts errors in video and > audio streams, but for subtitle streams it is not used. Some years ago the dts > time fix has been used also for subtitle streams, but this has been removed > while changing the code in ffmpeg.c. There is a bug report with an (old) patch > for this in the ffmpeg, but this has never found its way to the > release. I've adapted the patch for current ffmpeg and it works like a charm. > Please add it to your repository. Please post a git compatible patch [...]
--- fftools.orig/ffmpeg.c 2018-06-20 09:00:12.749632351 +0200 +++ fftools/ffmpeg.c 2018-06-20 09:00:29.262284733 +0200 @@ -772,7 +772,7 @@ - FFMIN3(pkt->pts, pkt->dts, ost->last_mux_dts + 1) - FFMAX3(pkt->pts, pkt->dts, ost->last_mux_dts + 1); } - if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && + if ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO || st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) && pkt->dts != AV_NOPTS_VALUE && !(st->codecpar->codec_id == AV_CODEC_ID_VP9 && ost->stream_copy) && ost->last_mux_dts != AV_NOPTS_VALUE) {