Raspberry Pi Networked Camera Software

Figured I’d start my own thread to keep the Twitch thread less cluttered.

I put together a project, picam, to use a Raspberry Pi with webcams or UVC hdmi capture devices like the CamLink and turn them into RTSP streams capable of sending the video and audio over the network. You can download an sd card image and flash it and configure the Pi using a web interface.

7 Likes

Some notes to help folks getting started.

After visiting the configuration page, click on the devices link to see what devices the Pi can see and edit the ones you want to use. Make sure you use a unique endpoint name for each one. After editing a device config you need to save the config and restart the stream service on the Pi by going to the admin page and clicking the ‘write config’ button, followed by clicking the ‘restart picam service’ button. Restarting the service will kill all feeds currently running.

Not all configurations are valid for each camera some common ones:

C920 Video
Type: C920
Encoding: h264 or mjpeg
Framerate: 30 or less
Resolution: Pretty much all of them

C922 Video
Type: C922
Encoding: mjpeg (no h264)
Framerate: 60 or less
Resolution: Any, but only 1280x720 for 60fps

Brio Video
Type: BRIO
Encoding: mjpeg (no h264)
Framerate: 60 or less
Resolution: Any, but only 1920x1080 or 1280x720 for 60fps
*1080@60 also requires plugging into a USB 3.0 port

C920/C922 Audio
Audio Rate: 32000 only
Type: C920

Brio Audio
Audio Rate: Any (but probably 48000)
Type: BRIO

The lower the exposure absolute setting, the faster the framerate can get to. On the Brio it should be at 200 or less for full 60fps, use the gain control to brighten up the image if necessary.

On the homepage you can click the any of the devices to open a realtime edit option for the webcam controls. These do not get persisted so if you like a setting you’ll need to edit the configuration in the devices page and then write the config/restart the service for the next time.

I’m going to try and make a tutorial video tonight if I can figure out how to do that.

2 Likes

Grrrrr. Stupid time syncing. Looks like I mistakenly added the ntp package when I didn’t need to and it can cause the system to fall out of sync with the time inducing some latency. I’m going to put together a new build tonight and work on and update to disable one or the other time service and that makes a big difference in the low latency ability.

New version 2.1.0 pushed for download. Should fix clock sync issue and allow for stable latency in the stream for those syncing to clocks. If you’ve noticed excessive latency it might be a good idea to try this build.

Getting back around to this I’ve built a new version with some usability improvements and I installed Windows on an old machine to be able to get some videos/screenshots to help with getting things working there at least with OBS. It’s not too bad to install the required OBS plugin DLL and the GStreamer package but you do have to edit the environment parameters apparently to add the GStreamer binaries so the OBS plugin finds them. Then things work pretty well. So if anyone is still looking for networked video options and wants to give it a try I’m always more than happy to help. And I have a Windows machine to play with now.

No need for limitations on number of USB ports or HDMI receivers.

3 Likes

Oh, it does networked audio too.

I got this working again and got the gstreamer plugin working in OBS. This really is great. When I location stream again, I want to try this for 100% wireless as it seems easier than hdmi transmitors.

I see you added camlink support. Does it need a pi4 to have usb3?

1 Like

Awesome. I’m working on a setup video too that I need to put together and figure out my voice track too along with some more tweaks to the software for autoconfiguring and default settings based on camera type.

The Camlink does need USB 3 to work properly. It’ll report it’s available on the USB 2 ports (on Pi4 or older Pis) but it won’t actually work. So a Pi4 is required and it needs to be plugged into one of the two blue ports.

I have an HD60 S+ coming tonight that I’m going to see if works too or needs anything additional.

Let me know if you need any help with the gstreamer pipelines. I know those are really powerful but also tricky.

I also need to get back to the audio and see how the plugin and OBS have evolved as it used to have a problem falling out of sync with no way to reset it other than restart OBS. I was able to work around it on Linux by setting up a fake audio source and sending the audio to that which OBS seemed to be just fine with but it was a bit ugly.

I have a Windows machine now so I can play with it for folks on that OS to help out a bit more.

1 Like

HD60 S+ seems like it’ll work with a little bit of tweaking the code. I have something functional I think that I’ll update. I need to try and see what the power requirements for it are since it might push the limits of the usb on the Pi. I’ll be playing around with it and my CX405, but it also has an audio input as well which might allow for some interesting uses.

1 Like

Woohoo. I got a pi 4 in, camlink works great when powered off a good power supply. I have been doing a soak test of camlink + c922 off a battery. The pi complains about low voltage, but it still seems to work. I am ordering some usb to barrel connector cables to see if running a powered hub off the battery as well and putting the camlink into that will fix it.

Now that I can run HDMI camera, this seems way simpler than trying to use 3 transmitter / receivers.

I don’t know the tradeoffs between the encoding options. x264enc seems to be working out well, but I don’t really know what the tradeoffs are.

It will be interesting to see how much my laptop and wifi can handle. I also need to see if I my laptop will run eth0 and wifi on 2 different networks.

On location, my plan is to connect picams to a dedicated wifi access with my laptop hardwired I to that. Then get internet through wifi. Not that I am heading on location any time soon.