Michael McFadden: Video Content for Plone

published Oct 04, 2023

Talk by Michael McFadden (a.k.a. flipmc) at Plone conference 2023, Eibar, Basque Country.

We do a lot of video in Plone at Radio Free Asia: https://www.rfa.org/english/video

How do we start with video in Plone? Just add a new content-type. Then add a template, use the html5 video tag and pass it a url. And it kind of works.

But we added a stream view and set some headers that helps for streaming.

So someone uploads a two hour Ultra HD video and you get a ticket: "Plone is slow" Your job is to fix it. And now the sysadmin is on the line and says: "We are seeing some troubling disk usage."

Okay, start offloading to an external server.

What I was doing here, was a journey: instead of thinking it completely through and designing a perfect solution and never shipping it, I just started coding and getting something out there that kind of worked and that we could improve.

We never used blobs here, we just did not have the disk space. Saving a 50 TB video would give 503 as feedback. "What is this nginx thingie, I thought we were using Plone?"

So we hired a javascript developer to help here, and they saw a progress bar. And I wrote a z3c.form custom widget. Without even using jQuery. And then when you click Save, you only post some metadata to Plone, with the video already being somewhere else. This worked nicely.

And now a video on our site went viral. Google for "gutter oil", if you have a strong stomach. So the CEO gets a message, look at this video, and opens it on the phone in the DC metro, and the video does not load. "Plone is broken."

Video encoding to get it to a reasonable resolution. Use ffmpeg to get it done. Don't look at its code, don't create an event handler for this. You would do this somewhere externally. Amazon S3 or something. We use Kaltora.

"Variable/adaptive bitrate video delivery." Such buzzwords get you a new job and 20 grand extra. Chop the video into fragments. You can load video fragments on different resolutions, depending on your bandwidth. Code this into an m3u8 file.

So I created https://github.com/flipmcf/CasterPak, creating HLS stream packaging for video on demand, with a built in file cache.

We abstract away the complexity. How leaky is this abstraction? A native video content type in Plone, is this possible? With code like this, it starts maybe becoming possible. We can push it.

Audience: you can look at https://peertube.tv/ or https://mediacms.io/.