slama.dev

Downloading video lectures

Preface

This post is not about how to illegally download lectures to share them online, since it’s something you obviously shouldn’t do (for both moral and legal reasons).

It is instead meant for people who would like to download videos for offline viewing, when the sites they’re viewing them on don’t support this by default. They usually do this so for reasons mentioned above, which is frustrating for people who:

Regular websites

When you start viewing a video on a website’s media player and don’t see an obvious way to download it, there is a high chance that it plays the video using a .m3u file that it first downloads. You can check this by going to the Network tab of your browser (F12 for Firefox/Chrome), refreshing the page and looking for a file that ends with m3u8.

If it does, then downloading it is easy – use ffmpeg with the following parameters:

ffmpeg -i "<URL of the .m3u8 file>" <output file name>.mp4

YouTube (and a few others)

The steps above don’t work on YouTube, because it uses its own methods for displaying the video in your browser. Luckily, you can use yt-dlp (formally youtube-dl):

yt-dlp "<URL of the YouTube video>"

Microsoft Stream

Same problem as with YouTube, different program – use destreamer:

destreamer -i "<URL of the Microsoft Stream video>"