]> git.sesse.net Git - ffmpeg/commit
avformat/hls: Set AVFMT_TS_DISCONT flag on HLS input format
authorPhilip Langdale <philipl@overt.org>
Sun, 27 Oct 2019 18:39:08 +0000 (11:39 -0700)
committerSteven Liu <lq@chinaffmpeg.org>
Wed, 30 Oct 2019 09:59:02 +0000 (17:59 +0800)
commitd6ac6650b911f0957e69545d7fc25be6b7728705
treee984227389c050e6aa67a1b1fdc6b9912c876d91
parentfd172185580c1ccdcfb90bbfdb59fa806fad3117
avformat/hls: Set AVFMT_TS_DISCONT flag on HLS input format

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

Reviewed-by: Steven Liu <lq@onvideo.cn>
Reviewed-by: Dennis Mungai <dmngaie@gmail.com>
libavformat/hls.c