Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Last active November 12, 2024 18:28
Show Gist options
  • Save primaryobjects/7423d7982656a31e72542f60d30f9d30 to your computer and use it in GitHub Desktop.
Save primaryobjects/7423d7982656a31e72542f60d30f9d30 to your computer and use it in GitHub Desktop.
How to download m3u8 and ts video movie streams.

m3u8 Downloading

  1. Open Chrome Developer tools and click the Network tab.
  2. Navigate to the page with the video and get it to start playing.
  3. Filter the list of files to "m3u8".
  4. Find master.m3u8 or index.m3u8 and click on it.
  5. Save the file to disk and look inside it.
  6. If the file contains a single m3u8 master url, copy that one instead.
  7. Run the program m3u8x.
  8. Paste the same m3u8 url in both textboxes (URL and Quality URL) and click "Headers" and set the referral url and user-agent from the request as found in Chrome.
  9. Select the Video format of "MP4".
  10. Checkmark "One .. One".
  11. Click "Download".
  12. A dialog will display with all of the individual .ts files. Click "Download" to download them all and join them together.

Auto-Clicking Continue Dialog

Occasionally, the download of one of the .ts files may fail and a dialog will displaying asking to continue or not. You can automatically click "Yes" and continue downloading everything by using a tool such as Buzof.

@MrModest
Copy link

MrModest commented Aug 6, 2023

I made a python script to automate this. All you need to do is provide an m3u8 file.

https://github.com/TheDynomike/m3u8_downloader

@TheDynomike is your tool able to work with encrypted videos?

@Nikanoru
Copy link

Nikanoru commented Sep 27, 2023

Thank you very much, this solution worked great for me. I was able to get all the videos my mom asked me for, because she wasnt able to download them. I wasn't aware of this whole m3u8 thing, glad I found this post :) 👍

@MeYousafbukhari
Copy link

Can someone help me please? It doesn't work. I can't extract the m3u8 links from here https://capcuttemplates.io/

@bleros
Copy link

bleros commented Nov 3, 2023

Can someone help me please? It doesn't work. I can't extract the m3u8 links from here https://capcuttemplates.io/

U want download templates? No need for m3u8 its easy download

@jmuheim
Copy link

jmuheim commented Nov 16, 2023

Try https://fetchv.net/de it works great!

@SakshamGairola
Copy link

Any fix for ssl/tsl error?
image

@mukul27wno
Copy link

any solution for -- "Error: decrypt failed. 0: java.security.Invalid KeyException: Unsupported key size: 64 bytes" ?

@ayoubjamouhi
Copy link

dl

+1

@ayoubjamouhi
Copy link

Use youtube-dl

youtube-dl file. m3u8

@ILikeJasmineRixe
Copy link

If anyone could try to download this file here: https://video.cwl-live.ch/video/72/weff-2021---vortrag-andreas-thiel?channelName=Dani?t=0 I'd be very grateful. 🙏

VLC lets you do it. Just open up VLC Media Player and do this path:

Media -> Open Network Stream -> enter URL -> arrow next to Play -> Stream -> paste link again -> next -> add -> browse -> choose file location and a file name (.mp4) -> next -> Profile: Video - H.264 + MP3 (MP4) -> Next -> Stream

@kudit
Copy link

kudit commented May 3, 2024

This is the command that consistently works for me:
ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "https://m.media-amazon.com/images/S/vse-vms-transcoding-artifact-us-east-1-prod/fb043d87-2a63-4e0d-a0a3-52c8b536ea0d/default.jobtemplate.hls.m3u8" -c copy video.mp4

@podhikaru
Copy link

This is the command that consistently works for me: ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "https://m.media-amazon.com/images/S/vse-vms-transcoding-artifact-us-east-1-prod/fb043d87-2a63-4e0d-a0a3-52c8b536ea0d/default.jobtemplate.hls.m3u8" -c copy video.mp4

This works perfectly !! Thanks.

@hagbard231
Copy link

I'm trying to download videos from this page:
https://digitaler-lesesaal.bundesarchiv.de/video/30762/683275
Can anyone help me find a way to do it?

@tillcash
Copy link

tillcash commented Jun 15, 2024

I'm trying to download videos from this page: https://digitaler-lesesaal.bundesarchiv.de/video/30762/683275 Can anyone help me find a way to do it?

@hagbard231 Download yt-dlp and run the code

yt-dlp --legacy-server-connect \
'https://digitaler-lesesaal.bundesarchiv.de/lixe/files/71/86/7186c268-7f86-4ebc-b514-f2ef5bdb1bc5/43605_1_1_Welt_im_stream_1/master.m3u8'

@hagbard231
Copy link

@hagbard231 Download yt-dlp and run the code

yt-dlp --legacy-server-connect \
'https://digitaler-lesesaal.bundesarchiv.de/lixe/files/71/86/7186c268-7f86-4ebc-b514-f2ef5bdb1bc5/43605_1_1_Welt_im_stream_1/master.m3u8'

Thank you so much @tillcash ! Your solution works like a charm. This was a major pain for me.

@kolbdog323
Copy link

I suggest vovosoft m3u8 downloader from major geeks just get the version direcly frmo their site it has worked for me for many videos just need to update the ffmpeg manually.

@edtadros
Copy link

This is the command that consistently works for me: ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "https://m.media-amazon.com/images/S/vse-vms-transcoding-artifact-us-east-1-prod/fb043d87-2a63-4e0d-a0a3-52c8b536ea0d/default.jobtemplate.hls.m3u8" -c copy video.mp4

This is brilliant!

@akdev000
Copy link

An alternative approach which emulates the same headers that your browser sends, thereby bypassing 403 Forbidden errors:

Using Firefox, open Developer Tools using Ctrl + Shift + I, or click on the 3-line hamburger menu in the top-right (1.) > More Tools (2.) > Web Developer Tools (3.).

Firefox: 3-line Hamburger Menu > More Tools
Firefox: More Tools > Developer Tools

Go to the Network tab (4.), reload the page, find the appropriate .m3u8 entry, typically named stream.m3u8 or something similar (5.), right-click, Copy Value (6.) > Copy as cURL (7.).

stream.m3u8: Copy Value > Copy as cURL

Then paste the resulting cURL command into here: https://windyakin.github.io/curl2ffmpeg. Download and install the free, open source FFMpeg tool if you don't already have it, paste the resulting ffmpeg command into your commandline (you may have to add a .exe suffix, eg: ffmpeg becomes ffmpeg.exe if you are using Windows) and enjoy the video!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment