FFMPEG mp4 from http live streaming m3u8 file?

FfmpegHttp Live-Streaming

Ffmpeg Problem Overview


How Can I extract mp4 from http live streaming m3u8 file? I Tried this command below:

ffmpeg -i {input file} -f rawvideo -bsf h264_mp4toannexb -vcodec copy out.mp4

I took this error:

>[NULL @ 0000000002f07060] Packet header is not contained in global extradata, corrupted stream or invalid MP4/AVCC bitstream Failed to open bitstream filter h264_mp4toannexb for stream 0 with codec copy: I

Ffmpeg Solutions


Solution 1 - Ffmpeg

Your command is completely incorrect. The output format is not rawvideo and you don't need the bitstream filter h264_mp4toannexb which is used when you want to convert the h264 contained in an mp4 to the Annex B format used by MPEG-TS for example. What you want to use instead is the aac_adtstoasc for the AAC streams.

ffmpeg -i http://.../playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4

Solution 2 - Ffmpeg

Aergistal's answer works, but I found that converting to mp4 can make some m3u8 videos broken. If you are stuck with this problem, try to convert them to mkv, and convert them to mp4 later.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionthiago.adriano26View Question on Stackoverflow
Solution 1 - FfmpegaergistalView Answer on Stackoverflow
Solution 2 - FfmpegblackmiaoolView Answer on Stackoverflow