Converting an HLS (m3u8) to MP4

orcaman picture orcaman · Oct 13, 2015 · Viewed 41.7k times · Source

Can anyone advise on how to construct an MP4 file from an HLS stream (the reverse of what you usually want)? Say I have the m3u8 - is there a straightforward way of getting a single MP4 using FFMPEG or some other tool?

Answer

szatmary picture szatmary · Oct 13, 2015

ffmpeg -i in.m3u8 -acodec copy -vcodec copy out.mp4

For AAC audio you will also need to add the the bit ststream filter. (Thanks @aergistal for pointing that out)

ffmpeg -i in.m3u8 -acodec copy -bsf:a aac_adtstoasc -vcodec copy out.mp4