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 -yNext, 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 -IStep 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-t 0disables the timeout, allowing the camera to stream indefinitely.--inlineforces the encoder to write SPS/PPS headers into the stream, which helps OBS decode the video instantly.-o tcp://0.0.0.0:5000binds the TCP server to all network interfaces on port 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.
- Open OBS Studio.
- Go to the Sources dock at the bottom of the screen, click the + (Add) button, and select Media Source.
- Give the source a name (e.g., “Pi Camera”) and click OK.
- Uncheck the Local File box.
- 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 - In the Input Format field, type:
h264 - (Optional) To minimize latency, change the Network Buffering dropdown to No Buffering or a low value.
- 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.