Stream Raspberry Pi Camera to OBS over LAN
This article explains how to capture high-frame-rate (HFR) video from
a Raspberry Pi camera module and stream it directly into OBS Studio over
a local area network (LAN). By utilizing the native
libcamera tools on Raspberry Pi OS and the Secure Reliable
Transport (SRT) protocol, you can achieve a low-latency,
high-performance video feed suitable for live streaming, recording, or
monitoring.
Step 1: Prepare the Hardware and Network
To achieve high frame rates (such as 60 FPS or higher) with minimal latency, ensure your hardware and network meet the following requirements: * Raspberry Pi: A Raspberry Pi 4 or Raspberry Pi 5 is recommended for hardware-accelerated encoding. * Camera Module: Raspberry Pi Camera Module V2 (supports up to 720p at 60 FPS) or Camera Module 3 / HQ Camera. * Network: Connect both the Raspberry Pi and the OBS computer to the same router via wired Ethernet cables. If Wi-Fi must be used, ensure both devices are on a stable 5 GHz band.
Step 2: Configure the Raspberry Pi Stream
Modern Raspberry Pi OS releases use the libcamera
framework. We will use libcamera-vid to capture the video
and stream it using the SRT protocol in listener mode. This allows OBS
to initiate the connection.
- Open a terminal on your Raspberry Pi.
- Run the following command to start a 1280x720 stream at 60 frames per second:
libcamera-vid -t 0 --inline --width 1280 --height 720 --framerate 60 --codec h264 -o srt://0.0.0.0:1234?mode=listener-t 0: Disables the timeout so the stream runs indefinitely.--inline: Forces header bytes to be inline, which helps OBS decode the stream immediately upon connection.--width 1280 --height 720 --framerate 60: Sets the resolution and targets 60 FPS. You can lower the resolution (e.g., 640x480) if you wish to push for higher frame rates like 90 or 120 FPS, depending on your camera module’s capabilities.-o srt://0.0.0.0:1234?mode=listener: Opens port 1234 on the Pi to listen for incoming OBS connections.
Note the IP address of your Raspberry Pi by running
hostname -I in the terminal.
Step 3: Set Up OBS Studio to Receive the Stream
Now configure OBS Studio on your main computer to capture the incoming SRT feed.
- Open OBS Studio.
- In the Sources dock, click the + icon and select Media Source.
- Name the source (e.g., “Pi Camera”) and click OK.
- In the properties window, uncheck the box labeled Local File.
- In the Input field, enter the SRT address of your
Raspberry Pi:
srt://<RASPBERRY_PI_IP>:1234?mode=caller(Replace<RASPBERRY_PI_IP>with the actual IP address of your Raspberry Pi). - In the Input Format field, type:
mpegts - Set the Network Buffering option to 1 MB (or lower) to minimize latency.
- Click OK. The high-frame-rate video feed from your Raspberry Pi will appear in the OBS viewport.
Step 4: Fine-Tuning for Ultra-Low Latency
If you experience stuttering or lag, apply these optimizations: *
Reduce OBS Buffering: Re-open the Media Source
properties in OBS and set the “Network Buffering” to the minimum allowed
or use the “Speed” preset. * Adjust Bitrate on the Pi:
You can limit the bandwidth usage of the stream by adding the
--bitrate flag to your Raspberry Pi command. For example,
adding --bitrate 5000000 limits the stream to 5 Mbps, which
is ideal for a stable 720p60 stream.