How to Download M3U8 Video with FFmpeg (HLS Videos)

masterjosh
by
masterjosh
Apr 06, 2019
How to Download M3U8 Video with FFmpeg (HLS Videos)

Over the past few years, more and more video streaming services are adopting HTTP Live Streaming (HLS) protocol to better serve the video content. The best thing about HLS is that it is an adaptive streaming protocol. Which simply means that the video streaming can be automatically adjusted for better video playback experience by dividing the video file into multiple smaller chunks with different data rates.

Though HLS improves the video playback experience, one downside of it is that you cannot directly download the video. In fact, you cannot find the direct download link to the video file.

If you act clever and you use some sort of browser extension, all you get is a manifest file with .M3U8 extension. That is not the video file you are looking for.

But, all is not lost. There are many online services that let you download HLS videos without any hassle. However, why depend on a third party web service when you can use FFmpeg, a free and open-source software to download the video?

In case you are wondering, here's how to download M3U8 video files with FFmpeg.

Download M3U8 Video with FFmpeg

Downloading HLS videos with FFmpeg is way easier than you think. All you have to do is execute a single line command. Since all most all the video streaming services use web-optimized video MP4 format, we are going to download M3U8 video files with FFmpeg and convert them to MP4 format.

1. To start off, download and install FFmpeg On Windows 10 or Install FFmpeg on Linux if you haven't already.

2. Next, go to the streaming site from where you want to download and grab the M3U8 video URL. For ease of use, you can use free extensions like Video DownloadHelper available for both Chrome and Firefox to grab the M3U8 file. For Edge, you can try Video Downloader Professional.

3. Now, open the PowerShell or Command Prompt by searching for it in the start menu.

4. Once you have opened the command line tool and have the M3U8 video URL, replace 

http://example.com/video_url.m3u8

 in the below command with the actual M3U8 video URL and execute it. If you want to, you can customize the output file name by changing 

output.mp4

.


ffmpeg -i "http://example.com/video_url.m3u8" -c copy -bsf:a aac_adtstoasc "output.mp4"

"Download M3u8 Video Execute Command"

5. As soon as you execute the command, FFmpeg starts the downloading process. i.e, it downloads each individual 


.ts

 file and adds them to create a single .mp4 video files. So, depending on the video length and speed of your internet connection, it can take some time to complete the downloading procedure.

"Download M3u8 Video - Command Processing"

6. Once the procedure has been completed, you can go to the destination folder to see the output file. In my case, the destination folder is 

C:\Users\Vamsi\

.

"Download M3u8 Video Saved Video File"

That's all there is to do and it is that simple to download M3U8 video with FFmpeg. If you face any problems while following the procedure, comment below and I will try to help you.




Add Comment