Introduction: Webcam Over WiFi for OBS

About: An electrical engineering student enjoying hobby level making.

I wanted to be able to use my webcam for streaming without being tethered to my computer.

Fortunately, Raspberry Pi exists and I was able to use one for a cooking stream! This Instructable sits alongside this YouTube video I made:

If you need any additional help, you can:

Supplies

  • Raspberry Pi (I used a 3, but anything with a wifi connection should be ok)
  • Display, HDMI cable and etc
  • Keyboard & mouse
  • 8GB sd card
  • Power supply rated for 2A
  • USB webcam (I used a Logitech C920)

Step 1: Setting Up the SD Card

I’m going to quickly run through setting up the SD card. If you know what you’re doing or have a preloaded card, feel free to skip ahead.

For this project we’ll be using Raspbian, which is a lightweight Linux distribution.

We’re going to install NOOBS, which stands for New Out Of the Box Software. Aimed at beginners, it’s pretty easy to set up and it allows you to choose which operating system you’d like to install. It’s also likely to be installed on the preloaded SD cards.

To start, we’ll navigate to https://www.raspberrypi.org/downloads/noobs/ and download the ZIP file.

Once the ZIP file has downloaded, copy the contents to the SD card.

And that’s it, SD card flashed.

Step 2: Setting Up the Pi

Now just take the SD card and put it in the raspberry pi, plug in the screen, keyboard, mouse and power and we are away.

Connecting the power will boot your raspberry pi and load the NOOBS installer.

Connect to your WiFi network here.

You should see a few different operating systems available, but we’re going to select Raspbian and click install.

Step 3: Disabling GUI and Changing Hostname

In a terminal, enter

sudo raspi-config

And disable the GUI from running on boot in boot options and change the hostname to picam in (or whatever you like) in network options.

If you need to use the GUI for any reason, you can enter

startx

in the terminal.

Step 4: Download/run Shells

In a terminal enter

git clone https://github.com/Bryce-AC/pi-webcam-server

and hit enter. This will download files I’ve already made. If you’d like to make sure what you’re downloading isn’t malicious, you can view everything here: https://github.com/Bryce-AC/pi-webcam-server

Next, still in the terminal, type

crontab -e 

and hit enter. This opens a file that allows us to automate processes. We’re going to scroll down to the bottom using the arrow keys and type

@reboot /bin/sh /home/pi/pi-webcam-server/webcam.sh

I have included a file which is for using a Raspberry pi camera module named picam.sh, as I said before, it’s quite laggy, but if you want to run that, just use @reboot /bin/sh /home/pi/pi-webcam-server/picam.sh instead.

Press CONTROL+O to save the file, and CONTROL+X to exit the editor.

Step 5: OBS

Now the raspberry pi is set up and ready to go. Reboot the pi and unplug everything but the power and webcam. We don't need a display or mouse/keyboard anymore!

All we have to do now is create a media source in OBS. Deselect local file and type

http://picam:8099/

in the input field (or the Pi’s IP address).

Wait a few seconds for the stream to load and we’re done!