Sometimes you come across a streaming website which is so uncomfortable to stream and watch videos, you just want to download the videos and then watch them later.

Intro

It happened to me today. I wanted to download lectures from the video streaming platform from my university to watch them later with VLC. For that I use JDownlaoder, just right-click, copy source and paste them into JDownloader. It finds downloadable content, and on the right you just choose that you want to download videos. Done. But today: "OFFLINE". I was like wtf, why and double checked that I can watch the videos online and can watch them with vlc. The first panic that the videos are offline  (exams are in some weeks) vanished. If you can watch them, you can download them. If not download, you can at least screencapture them.

And of course there is always the option to copy the link and paste that link into VLC. But what if the source file goes offline? What if your connection is not so reliable you can watch it at home. With this tiny little script you can download the video from work or from the WiFi at the coffee shop or university and then watch your videos at home.

This little "script" is extendable, you could make it read a *.txt file line for line with urls inside and then downloading them one at a time.

For this you can go in the source-code of the website. Find a link with m3u - copy that link to your clipboard.

There are a lot of tutorials and things on the Internet, but the only thing you need is just this short command:

Important Stuff

#!/bin/bash
URL="https://somevideo.portal.io/streamingfoo?=morebarandfoo.m3u"
echo DOWNLOADING:${URL}
ffmpeg -i ${URL} -c copy output.mp4

Easy peasy. Here with my bandwidth it downloads the file with 40x speed of the original file.

this above outputs a lot. If you want to tell ffmpeg to be a bit quieter:

URL="https://somevideo.portal.io/streamingfoo?=morebarandfoo.m3u"
echo DOWNLOADING:${URL}
ffmpeg -hide_banner -loglevel panic -i ${URL} -c copy output.mp4

If you experienced any problems or have some suggestions, please write something in the comments below :) really appreciated.

Install FFMPEG