Ron Yadgar
Ron Yadgar

Reputation: 397

Converting HLS with discontinuity tag into MP4 using ffmpeg

I'm trying to concat all chunks in HLS, into a single mp4 file, using ffmpeg. I tried the command: ffmpeg -i -vcodec copy -acodec copy -bsf:a aac_adtstoasc

However, I noticed that if m3u8 contains discontinuity tag, then the concatenation is not work well, i.e. the video stops during all the missing chunks.

Any idea, how to convert so the video play continuously, namely, ignoring the missing chunks?

Upvotes: 2

Views: 3745

Answers (2)

user9546659
user9546659

Reputation: 11

this problem can be solved by concat protocol

  1. first turn input m3u8 file to a ts list file

    grep -e '^http.*.ts$' input.m3u8 | awk '{print "file", $1}' > all.ts

  2. second use all.ts as input to concat into a mp4 file

    ffmpeg -protocol_whitelist 'http,file,tcp' -nostdin -f concat -safe 0 -i all.ts -c copy -movflags faststart -y output.mp4

Upvotes: 1

jdramer
jdramer

Reputation: 945

Looks like this is a known issue.

https://trac.ffmpeg.org/ticket/5419

FFMPEG Trac ticket #5419 HLS EXT-X-DISCONTINUITY tag is not supported

Upvotes: 1

Related Questions