26

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?

William Miller
  • 9,839
  • 3
  • 25
  • 46
xiao xin
  • 271
  • 1
  • 3
  • 3

2 Answers2

11

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
slhck
  • 36,575
  • 28
  • 148
  • 201
Chandan Kumar
  • 799
  • 7
  • 23
0

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
  • It seems that ffmpeg 4.4.x and 5.1.x support those streams correctly, also if there is nothing about that in the changleog. – gabry Nov 15 '22 at 07:53