Students cannot download the streaming videos through a download button or by right-clicking into the video and choosing "Save link as". Nevertheless, technically skilled students will find a way to download them anyway.

Act I - Background

Because of Corona, most of my university lectures are held online since the beginning of summer semester 2020. Some of the lecturers are doing a really great job with digitalizing their lectures, uploading all videos in advance, etc. - and some don't.
Or more precisely: Some lecturers or important university people seem to give a shit about their students. From streaming-only lectures via zoom up to mandatory lectures in normally free weeks I experienced everything. But this should not be a rant about the German university system...

Act II - WTF

A simple email:

Dear students,
by request from the moodle-team we have removed the option to download lectures. We don't know if we will be able to offer that option again at a later time. [...]

Without any further explanation, but there are rumours it's about server performance when everyone downloads the videos. Should be solvable for a technical "elite" university...
The video download option was removed from our online learning platform moodle - but the videos were still accessible via stream. After googeling for a few seconds, I found a (internal?) documentation for the lecturers about the videos telling me, that

Students  cannot download them without having technical knowledge.

Well, WTF?! What is the T in RWTH standing for?

Also: New semester, same bullshit again. I hoped they improved their digital lecture concept for the second "corona semester", but nope... That's why I publish it now.

Act III - Browsers

Browsers render web pages client side, meaning all content displayed in the browser is on my computer.  

So it can't be that hard to download the streamed video, I thought.

My first tries, like using youtube-dl or CURL'ing the moodle or OpenCast stream didn't work, so I had a look into the browser's network tab:

Network tab with video segments
Network tab with video segments

As one can see, the browser loads a bunch of .ts files with increasing numbers.
When clicking the request, a simple download window appears:

Video segment download window
Video segment download window

But downloading every single segment via the browser or via CURL is very annoying, so a more efficient solution had to be found.
In addition, all the segments have to be concatenated to a complete video. The maximal number can be found by scrolling to the end of the video while looking at the web requests made.

Act IV - Python + FFMPEG

Disclaimer: I wrote a quick and dirty poc. This is definitely not well-written python.

Downloading the video segments can be simply done by iterating over the numbers at the end of the url directly before the .ts and calling curl for every segment.

for i in range(0, max_ts+1):
    url = base_url[:-4] + str(i) + '.ts'
    os.system("curl " + url + " --output str(i) + ".ts ")

The single video segments can be concatenated using ffmpeg:

ffmpeg -i concat:1.ts|2.ts|3.ts -codec copy out.ts

The full script can be found here, a more advanced version will probably follow in the next weeks.  




Act V - Bonus round: TUHH

Well... There it was just copy & past'ing the video URL from network tab and and downloading it via wget ¯\_(ツ)_/¯