On Mon, 28 Oct 2019 at 05:45, Steven Liu <l...@chinaffmpeg.org> wrote: > > > > > 在 2019年10月28日,02:39,Philip Langdale <phil...@overt.org> 写道: > > > > There have been many reports over the years about problems when > > taking an HLS stream as input to `ffmpeg` where there are timestamp > > discontinuities present. This is explicitly supported in the > > HLS spec (EXT-X-DISCONTINUITY) and often used for ad injection. > > > > Various fixes and work-arounds have been proposed over the years, > > but one step that seems obvious, even if it's not a complete fix, > > is to mark the HLS input format as supporting discontinuities. This > > will prevent timestamp fixup logic in ffmpeg.c kicking in that ends > > up mangling the timestamps unnecessarily. > > > > I've tested this out with an example provided by Joe Koberg early > > last year, and it is sufficient to allow `ffmpeg` to download and > > mux the stream correctly. Joe had briefly suggested that other > > situations can still be handled incorrectly, but this seems like > > a strict improvement. > > > > Joe's example: > > > > https://s3.amazonaws.com/playon-test-videos/discont_test_new/discont_test.m3u8 > > --- > > libavformat/hls.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/hls.c b/libavformat/hls.c > > index d7f4d5b442..ac151d5ca4 100644 > > --- a/libavformat/hls.c > > +++ b/libavformat/hls.c > > @@ -2326,7 +2326,7 @@ AVInputFormat ff_hls_demuxer = { > > .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"), > > .priv_class = &hls_class, > > .priv_data_size = sizeof(HLSContext), > > - .flags = AVFMT_NOGENSEARCH, > > + .flags = AVFMT_NOGENSEARCH | AVFMT_TS_DISCONT, > > .read_probe = hls_probe, > > .read_header = hls_read_header, > > .read_packet = hls_read_packet, > > -- > > 2.20.1 > > > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe”. > > LGTM, whatever other more reasons, this can fix one of those problems. > > Thanks > Steven
This patch actually fixes the occurence of DTS and PTS discontinuities I've been seeing with (some) HLS inputs that have discontinuities due to ad insertion(s). 10+ hours later without a single discontinuity. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".