Downloading m3u8 online streams with ffmpeg

Advertisement

Recently I was asked to download some online stream videos, and judging by their source code, most of them were m3u8 links.

As the name suggests, m3u8 is really just a playlist. Open it and you get a bunch of ts files, and the conventional approach means downloading them in bulk and then merging them.

Advertisement

But flip the thinking around: if you just have ffmpeg decode the stream and save it, things get a lot simpler.

Through the browser’s “developer tools” we can grab the m3u8 address easily:

screenshot.8.jpg

Then get ffmpeg ready. Whether you’re on Windows, Linux, or even the noble Mac OSX, you can install ffmpeg.

Use the command:

ffmpeg -i “your video's M3U8 URL” the_filename_you_want.mp4

Hit enter and it should start saving. Sure, it might be a bit slower than other tools, but the upside is convenience—ffmpeg is already on plenty of machines.

screenshot.9.jpg

Source: https://zhuanlan.51cto.com/art/201711/558658.htm

Discuss this post on plumz.me

Comments are hosted on the Chinese main site. This mirror is read-only.

Table of Contents