'how to fix Non-monotonous DTS in output stream 0:1; when using ffmpeg

When I use ffmpeg to convert m3u8 to mp4, I get some warning,

ffmpeg -i xx.m3u8 -c copy demo.mp4

warning is

Non-monotonous DTS in output stream 0:1; previous: 3277744, current: 3276712; changing to 3277745. This may result in incorrect timestamps in the output file.
Non-monotonous DTS in output stream 0:1; previous: 3277745, current: 3277736; changing to 3277746. This may result in incorrect timestamps in the output file.

what should I do to fix it?



Solution 1:[1]

You can try this:

ffmpeg -i xx.m3u8 -c copy -bsf:a aac_adtstoasc demo.mp4

Per this forum post, you can also try:

It seems that decoding time stamps are broken. You can try "-fflags +igndts" to regenerate DTS based on PTS:

Or point to the .ts file directly, ignore the DTS:

ffmpeg -fflags +igndts -i xx.ts -map 0:0 -map 0:2 -c:v copy -c:a copy demo.mp4

Solution 2:[2]

I ran into this downloading sports video from HUDL. The m3u8 file had #EXT-X-DISCONTINUITY and #EXT-X-PROGRAM-DATE-TIME directives that ffmpeg didn't handle correctly. So I just created .txt file for ffmpeg to simply concatenate the segments with the directives removed:

Find m3u8 using browser tools

cat ~/Downloads/<m3_u8 downloaded> | grep ".ts$" | awk '{print "file <url path of m3u8 file>" $1}' > files.txt

ffmpeg -protocol_whitelist file,tcp,http,https,tls -f concat -safe 0 -i files.txt -q 0 -c copy video.MTS

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 slhck
Solution 2 daltontf1212