Flirting with Owncast, Raspberry Pi and OBS - Adventure in Self Hosing

bcoyle

Member
Owncast is an environment similar to youtube etc, just not as well known. There is no censorship and you are pretty much allowed to have you own channel with your own stuff. But, You should still pay attention to copyright laws.

Owncast has a central directory where other people have their channels and live broadcasts are highlighted. It has chat etc.

There are many solutions in the cloud, but can be costly if you use a lot of bandwidth. Also, you don't want to store a lot of videos there either.

So this is an experiment in self hosting.
Owncast has downloadable software that runs on a PI and make it pretty easy to get started.


Of course, upload speed is important, so you need good upload speeds to make this work.

So wish me luck and join in the adventure if interested.
 
Last edited:

bcoyle

Member
Step 2. Got the PI today - Put it together.
I got a pi 5, 8gb ram, 128gb sd card with preloaded OS.
The instructions were printed very small. Had to use a magnetizing glass.
Went to the god of all knowledge to help for a few details.
Plugged the power supply in, got a green light.
Connected a monitor, mouse,keyboard.
Came up alright.
Created account, password
selected english, timezone and browser type.
Connected the lan cable.
browser worked fine
I am totally impressed

IT IS SO TINY!
 

bcoyle

Member
So, why should you care about this forum channel?
So far, i've gotten a few views, but not enough interest to anybody to join.

So this would be of interest to less experienced people, new to cloud and server use.

Of course, it's easy to just say in these times , just go ahead and buy this or that. but truly, if this is a burden finance wise, then hint to the wife or kids, that you might like this as a present on a birthday or Christmas.

Anyway, i recommend buying a kit with pi 5 (not 4) with a full desk top, power supply, cables etc. I payed $130 for my klit (on amazon, came next day) ) with 8gb ram and 128gb main disc. The main disc is really just a big SD card, you might use for cameras. Think windows C drive.This will save you pain and when booting up for the first time. You just connect a usb keyboard and mouse, use the supplied hdmi cable to a monitor. Later , you can remove these and operate it headless (i.e. remotely if you wish.

The pi 5 aleady has a firefox and chrome brower installed along with a VCN server for remote operation. It truly has everything. The operating system is a denian 12 linux system. It also has a wireless connection along with a wired cat input. It truly is just a small form factor computer.
 

bcoyle

Member
So I started with a youtube video: https://www.youtube.com/watch?v=0BWc8TF0qI0

This is a video on setup / install of owncast on a pi.
It talks about what you need to know to get this going.
In the first part of the video he talks about flashing a new system on sd card.
I avoided this by buying a full kit with installed OS , PS, cables, box etc. Don't go cheap.

Please realize, even if I am talking about owncast, a lot of this also applies to other server types.

Since I got the full kit, I looked at the documentation first. I have old eyes, so needed a magnifying glass to view some of the diagrams.
The kit came with a pi pc board, a cooler fan and a box that I had to put together. Not hard.
Once assembled, I plugged in the power supply cable, the ubs keyboard and mouse. They suppled 2 hdmi cables, plugged one into a spare monitor. All this made it easy to deal with the pi for the first time. You can remove this later and talk to the pi remotely if you like.

On startup, the pi asks you a few questions about names, browser types etc.

To talk to the pi remotely , i downed loaded 2 programs to my main computer. They are both free. Google them to find the install pages

1. Putty: Creates a command window.
2 Realvnc LITE. This lets you do a remote desktop login. Be sure to get the LITE version which is free while the regualr version is not.


The video will fill you in with some of the details about installing the owncast server.

Th raspberry pi becomes just another computer on your local network with an address that looks like 192.168.1.x where x is a number assigned by your router on startup. Hopefully the same each time.
 

bcoyle

Member
Now a server is just a piece of software sitting a on a computer somewhere "LISTENING" on a port. You can talk to it by specifying the computer address 192.168.1.x and the port number. This address works well if you are talking on the local network using your browser. The x is whatevery the routewr assigned to the PI.

So lets say, your pi has an address of 168.192.1.17. Once the owncast server is running, it will respond to you (using a browser) with different commands.

If yiou know how to stream to youtube, owncast is similar. It has a target address and a stream key. For owncast, you are using the internal network address not the youtube address in the clouds.

So to stream to owncast , you need to edit obs stream setting.. FYI: in the owncast setup (remember the video), you created a stream key, yourself. This is needed to stream to owncast.

So the target owncast server is custom, rtmp://192.168.1.17:1935/live and the stream key is the one you created. Easy enough. Port 1935 is the port that the owncast server is listening on for you to stream to, while port 8080 is the port where you can watch the video.

One VERY IMPORTANT thing to remember is HOW MUCH UP BANDWITH do you have. For each user logged on, you are using your home bandwidth. Now I am lucky and have 400 up / down, so can support a number of users depending on my video bit rate. Owncast also has videos on how to install a server on a free (within reason) LINODE cloud account. There are limits on the stream data you can send without paying for extra, But you get a free permanent internet address.
 

bcoyle

Member
On my home computer, I can use a browser and watch the streaming video on 192.16.1.x:8080 by just typing in that ip address and port 8080. You could have the PI connect to you local TV and have it wirelessly and have you own private tv STREAMING channel (WITHOUT SENSORSHIP).

So great, you can stream to you local computer or tv set

What about the outside world????
 

bcoyle

Member
Now I know that many people know all this stuff, but for the benefit of newbe's, added this section to understand how a web address gets to your server.


At this point, we can talk from one computer to another on the local lan, using the target computer ip address and port number. Think of this like a telephone number with the computer being the area code and the port as the rest of the phone number. As example, the phone number 408-555-1234 has an area code of 408 and the phone number being 555-1234. The 408 is your router and the 555 is your computer and the 1234 is your port number.

Now a server is just a piece of software located on some computer, listening on a port for a message for it to do something. The computer has an IP address that identifies the computer. On the local lan, you can say 192.169.1.20 : 8080. the192.168.1.20 is the computer and the 8080 is the port , sometimes known as a service.

From the outside, i.e. the www, a remote computer wanting to connect to a service (owncast,ftp,etc) in your home lan network, has no idea how to get there. This is where DNS or domain name lookup comes into play. From the outside, you want to use a name instead of a ip address to get there. Many people have a web website. You normally get there by typing in a name like my_website.com using using a brower. You browser goes out to DNS or dynamic name server. Your browser talks to dns and gets an ip address in exchang and "ONLY" an ip address. There is no port information or ip address for the individual computer on your home network. just how to get to your router.

When you send a request to my_website.com : 8080, the browser gets the ip address from the DNS and creates a new target maybe 147.12.34.10 + 8080 to get 147.12.34.10:8080. At this point , the request comes into your router and it has no idea what this port 8080 is and on what local computer it is located on.

Now suppose you have 3 web cameras on your lan and each talks over port 1200 and has 3 different ip addresses. You can't just say :1200 coming into your router. But using PORT FORWARDING you can. Ffrom the outside, assign port 1201 to camera 1, 1202 to camera 2 and 1203 to camera 3. These are completely made up numbers you choose. In the router, you have a translation table (DNAT) that creates a new ip address and port number form the incoming made up port number.

Internally the 3 web cam have the following addresses :
Cam 1: - 192.168.1.21:1200
Cam 2 - 192.168.1.22:1200
Cam3 - 192.168.1.23:1200

Notice the .21,.22,.23 that identifes the indivual cameras.

The router DNAT table translates 1201,1202 and 1203 into

1201 as 192.168.1.21:1200 (cam 1)
1202 as 192.168.1.22:1200 (cam 2)
1203 as 192.168.1.23:1200 (cam 3)

When setting this up, you need to log onto your router as admin and create the tables. Different rotuers have differernt menus.

So the thing to keep in mind is that when using a domain name.

1. The name like my_website.com gets translated into your router ip address.
2. The port number you invent gets translated (via the DNST table in the router) into the real local computer ip and the correct port number for that service.

So you are sitting at home and you bring up vlc or media player and you want to set cam 1

You want the camera , not the website, so you might typing "cameras.my_website.com : 1201" for cam 1

ok, so what is the "cameras." tag.

When your media player asks for .cameras.my_website.com, what happens first is that my_website.com as the address gets looked up. This would be the ip address of the actual website. Now all DNS addresses also support the added ".some tag.also as a secondary address. This is stored in table that stores "A" records. This is used to point at servers other than the my_website. i use godaddy and I would just create a new A record and give it the ipaddress of my router. So .cameras.my_website would now point to my router.

So to talk to "cameras.my_website.com:1201" which is camera 1

1. media player asks DNS for the address of cameras.my_website.com
2 DNS looks up my_website.com
3 DNS sees secondary tag "cameras.", looks that up in the A record table and returns the external ip address of your router
4.Port forwarding in the router see 1201 and translates this to the camera 1 ip and port 1200.

Basically there are two lookups, one in the dns and one in the port worward part of you router.

Once you get your head around all this, you will find it not that hard.

If I got any of this wrong, please let me know.
 

bcoyle

Member
2 station onwcas smallt.jpg


Well, we have proceeded down the road. I'm running 2 owncast channels using casttor Ai to drive 2 copies of OBS. Used Caddy on the raspberry pi to convert HTTP TO HTTPS and have a web address with no port numbers. These 2 are featured on the owncast directory. This has been a little hard to get my head around at times but I have "mostly" arrived. The journey continues
 

bcoyle

Member
"IPTV" SERVER. It turns out that this is a pretty good HLS server and vlc will treat it as a HLS server, i.e m3u8. Pretty cool. So I can now run this as IPTV. In this mode, the owncast browser is not visible.
 

bcoyle

Member
WOW,AWESOME. Th best part is that you NOW also have IPTV / HSL / M3U8 server. Yes if you use a browser, you get the owncast interface, but use a vlc viewer or even the vlv source in obs, and you get the video by itself. Also you can embed this in your website. You can add /hls/stream.m3u8 to the url and it for sure plays the video. You can easily create a .m3u8 file and share with your friends, your own iptv. I think you can set it up also, that's it's private.
 

Frisk

New Member
Hey there bcoyle! Your thread is the only thing I saw in my results that was relevant to topic of running Owncast on Raspberry Pi 5, so I hoped you'd be able to answer a question regarding the setup you use, or at least maybe give advice. Wanted to ask, how is the performance with running it on RPI 5? I know I've had issues running Owncast in all configurations due to processing power bottleneck on RPI 4, but I know RPI 5 comes with some significant improvements in processing power.

I guess your experience will probably differ from what I'd want to create, since I wanted to make a streaming setup for 1080x1920 video streamed using OBS and maybe if allowed to see if reencoding is usable (back in my testing it was not, don't think RPI 5 has hardware acceleration support). Have you tried something similar? Have you observed how demanding it is on the machine?

Thanks!
 
Last edited:

bcoyle

Member
I'm using a pi 5 I got from amazon. It's clock is 2.3g. I'm currently running 3 owncast channels, at 720p (obs canvas 1080p - output 720). They are running at 2.5mbs/ 30fps. Cpu usage is 60-80 percent. I'm experimenting with passthru on one of the channels and in that mode it 40-55 cpu %. Every once in a while I seem to get a disconnect. I'm running 3 owncast instances, ingess 1936,37,38 and using a caddy front end. In caddy, I've removed access to admin* from the outside. I brought a second pi to experiment with 1080p at 4500-6000. But since my main pi 5 can do 3 channels of 720 @ 30fps @ 2500 kps, - re-encoded pretty sure it can do 1 1080p channel.

I brought a more expensive 8g ram / 128g disk sd. Using the app Top, the pi is using about 50% memory and <10% disc usage. Probably a 64g disc would be ok.

Can i ask if you are in the owncast directory and who you are. I'm Mr Bill's 3 owncast channels.

I use OBS as my front end and have a 24/7 compositing/scheduling app.


Hope this helps. Haven't benn able to really talk to anyone about owncast, so sharing is fun.
 

bcoyle

Member
I ran an experiment for you ( and me). I still have 3 owncast instants running, idling at 40% cpu. I sent a 5900kps/30fps/1920x1080 video stream from obs. 5900 is the max setting in a owncast server. I started multiple vlc instants and connected them to the pi server via the url owncast3.cast-tor.com. I was able to get to 15 copies of vlc @6mps before buffering. The video segment download graph is now at max allowed. Also cpu = 90%.

oh,passthru did not help

So, bascially owncast was handling vlc 13 streams and 2 regualar browser streams. My network meter said about 100m which matches the expected bitrate.

Since I had the other 2 owncast idling, you would probable get a little more out of it if only using 1 owncast instant.

Of course, if you were running at 3mbs then you would be able to support more.


i would say that you could support 100/bitrate instants, ie 100/6 = 15 running copies.
This is based on the return streams coming from a close ISP.

I have a netgear typical 1g switch and a ISP of 400up/down.

SO you are good to go, if you want to purchase a pi 5 with 8 g of memeory. I don't know what will happen if you brought the 16g ram version, maybe it would handle more.

That Help?
 

bcoyle

Member
I did find that after the experiment, I started up the other instants of owncast and that screwed up everything. i got struttering. So the moral of the story is only 1 owncast server per pi or at least lower bit rate
 

Frisk

New Member
Hey again, thank you for thorough response!

I only use Owncast for streaming video, mostly 1080p, 30fps sometimes 60fps with ~6800Kbps bitrate. It's basically all gaming sessions that I or my friends stream to each other semi-privately (on my subdomain publicly, but without announcing it publicly which is why I don't plan to drop a link here, especially since those streams might sometimes have adult content).

Under those conditions, it's usually 1-3 people who actually watch a single livestream (so one instance of Owncast).

In the past I've tested setup of OBS + Owncast + nginx acting as reverse proxy on Raspberry Pi 4 and the performance was underwhelming, but close to being okey, just with regular stutters when the device was not able to keep up with frames I assume. I guess no hardware encoding is still supported for Raspberry Pi 5, which is a bummer.

However based on what you wrote, and your experiments (which I'm very thankful for your help there!) I assume that if I do get Raspberry Pi 5 it should hopefully be just fine and still leave plenty of resources for other services that I run on my little RPI server, which is awesome because I'd love to get something like this working and utilize such low power devices as Raspberry Pi.

I guess my last question, you do have the official stock cooling fan/cooling setup that Raspberry Pi sells right? You mentioned fan in one of your previous posts so I guess you referred to that kit (I mean this one https://www.raspberrypi.com/news/heating-and-cooling-raspberry-pi-5/).
 

bcoyle

Member
On the owncast server, the bit rate only goes up to 5900kps - in re-encode mode. Further experiments show that if you use (on my dell laptop) an accelerator, and then, passthru does not work. You need to run x264 standard and not the navia gpu. That surprized me. If you want to free up cpu cycles on the pi, then use obs x264 encode and then use passthru on the pi.
 
Top