Back to home.

Learning: Setting up my own livestream server and media server

Alghero on 2023-06-21T12:12:00.000+02:00
by Angelo Reale
tags: gcp, transcoding, vod, livestream

I own a webradio.

I've been streaming audio with Airtime Pro for a while now.

Using Rogue Amoeba's Loopback and Audio Hijack makes virtual digital audio routing and streaming much easier.

Also, Traktor and a NI Audio 6 interfaces makes both analog and digital audio processing much easier.

But I'm evolving, and I like videos.

After setting up some NDI cameras and using OBS to mux/encode a video stream, I've started streaming to our known platforms: YouTube, Twitch, etc.

I've used Restream.io to do it.

Unfortunately, even though all my radio's streams are monitored and use AI via ACRCloud to generate reports of tracks played (which I submit yearly to SIAE to pay artist's royalties), platforms like YouTube and Twitch don't provide an easy way to inform them that we have the rights to stream audio content.

So they take livestreams and video on demand down, and they're right in doing so. Copyright is a serious thing.

I didn't want to be limited by this though, and decided to upgrade my Restream plan to Premium in order to try out the embedded player they provide.

It sucked.

No one who was helping me QA (not even myself) could watch a continuous stream for longer than 5 seconds. It would interrupt and buffer.

The issue was with Cloudflare Streams it seems.

But I still wanted to provide my radio's nimble listeners with a reliable live stream of audio and video.

So I've tried a couple of new things:

1. Bitmovin for Livestream;
2. Bunny for VOD.

Bitmovin aced it. I could spin up a streaming server in seconds (using their new Streams offering) and the feed could be reliably played by any browser (using HLS for adaptive reproduction).

7h of stream later, and over a night of sleep, I get an email: "You've exceeded your free quota and the bill is 60$".

I said to myself: what? Am I paying over 5+k/month to use ffmpeg?

Bunny is also awesome for VOD. I'm assuming Bunny's bill would be similar, but I'm still on trial.

No way.

At the core of modern internet infrastructure, it always drills down to 4 major players:

1. Amazon
2. Google
3. Microsoft
4. Alibaba

So I've decided to spin things around.

I saw that Google Cloud Platform had a Live Stream API and a Transcoder API (cheap computing resources to run ffmpeg)

And so I've decided to setup my own live stream server and media server.

And it worked.

Here are a couple of tutorials that helped me, and that might help you too:

1. Live Stream API
2. Media Server

Now I can go to bed streaming 4K hyperspace videos to my radio listeners knowing I'll be paying less than 1$ an hour.

And they can watch some recordings too, without blowing my budget.

It's like having my own radio's private YouTube at low cost.

Ah, and did I tell you? No takedowns no more.