Stream Raspberry Pi Camera to OBS Studio

This article explains how to stream real-time video from a Raspberry Pi camera module to OBS Studio over a local network. By utilizing the built-in command-line tools on Raspberry Pi OS and the native Media Source in OBS Studio, you can easily set up a low-latency wireless camera feed for your streams or recordings without needing extra capture cards.

Step 1: Prepare the Raspberry Pi

Ensure your Raspberry Pi camera module is physically connected and enabled. Update your system to the latest software by running the following commands in the terminal:

sudo apt update && sudo apt upgrade -y

Next, find your Raspberry Pi’s local IP address, which you will need to connect OBS. Run this command and note the IP address outputted (e.g., 192.168.1.15):

hostname -I

Step 2: Start the Video Stream on the Pi

Modern Raspberry Pi OS versions use the libcamera stack. To start a continuous H.264 video stream hosted on port 5000, run the following command in your terminal:

libcamera-vid -t 0 --inline --codec h264 -o tcp://0.0.0.0:5000

Step 3: Configure OBS Studio

With the stream running on your Raspberry Pi, move to the computer running OBS Studio on the same local network.

  1. Open OBS Studio.
  2. Go to the Sources dock at the bottom of the screen, click the + (Add) button, and select Media Source.
  3. Give the source a name (e.g., “Pi Camera”) and click OK.
  4. Uncheck the Local File box.
  5. In the Input field, enter the network URL of your Raspberry Pi stream, replacing <Raspberry_Pi_IP> with the IP address you found in Step 1: tcp://<Raspberry_Pi_IP>:5000
  6. In the Input Format field, type: h264
  7. (Optional) To minimize latency, change the Network Buffering dropdown to No Buffering or a low value.
  8. Click OK.

Your Raspberry Pi camera feed will now appear as an active source in your OBS scene. If you stop the stream on the Pi, you can restart it using the same terminal command, and OBS will automatically reconnect.