19

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
  • 8,894
  • 3
  • 17
  • 42
xiao xin
  • 201
  • 1
  • 2
  • 3

2 Answers2

9

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
  • 33,914
  • 26
  • 134
  • 182
Chandan Kumar
  • 741
  • 6
  • 21
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