1

So I'm using ffmpeg to download streams from the internet but I'm facing a problem with one of them and is that, every once in a while, in the middle of the stream, it goes to some kind of "break" and this #EXT-X-DISCONTINUITY-SEQUENCE tag appears on the .m3u8 files I start to download. I start getting "Non monotuonous DTS" errors on the console and the audio and video start to desync, eventually, I will play the stream once downloaded and it won't work.

Is there any way to download with ffmpeg this kind of streams and in some way "skip" the m3u8 files which have this tag or maybe correctly parse them to the video?

Hope someone could help me.

1 Answer 1

4

ffmpeg fails with "Non monotuonous DTS" because it tries to forcefully merge streams which dont have the exact same framerate or so (see https://superuser.com/questions/1150276/trim-video-and-concatenate-using-ffmpeg-getting-non-monotonous-dts-in-output for a more detailed explanation).

and since there is currently no option to tell ffmpeg to NOT merge streams separated by #EXT-X-DISCONTINUITY in m3u8, the only possibility is to manually split the m3u8 in several pieces. where you see the #EXT-X-DISCONTINUITY tags. then (after making these pieces valid m3u8 singleton) feed them all to ffmpeg.

that will give you several video pieces, but you can (as strangely as it may sound) merge them all together using ffmpeg without problem using the concat command (https://trac.ffmpeg.org/wiki/Concatenate).

now if only the ffmpeg devs could possibly add an option allowing to not forcefully merge streams when the m3u8 contains #EXT-X-DISCONTINUITY, that would make my day.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.