https://github.com/tzuhuantai/raspberrypi-webrtc
Native WebRTC low-latency P2P video streaming on Raspberry Pi and NVIDIA Jetson with both hardware and software encoding support.
https://github.com/tzuhuantai/raspberrypi-webrtc
h264 jetson low-latency nvidia openh264 p2p peer-to-peer raspberry-pi v4l2 video video-streaming webrtc
Last synced: about 1 month ago
JSON representation
Native WebRTC low-latency P2P video streaming on Raspberry Pi and NVIDIA Jetson with both hardware and software encoding support.
- Host: GitHub
- URL: https://github.com/tzuhuantai/raspberrypi-webrtc
- Owner: TzuHuanTai
- License: apache-2.0
- Created: 2022-05-09T06:06:35.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2026-05-11T10:28:08.000Z (about 1 month ago)
- Last Synced: 2026-05-11T12:37:34.971Z (about 1 month ago)
- Topics: h264, jetson, low-latency, nvidia, openh264, p2p, peer-to-peer, raspberry-pi, v4l2, video, video-streaming, webrtc
- Language: C++
- Homepage: https://picamera.live
- Size: 41.3 MB
- Stars: 975
- Watchers: 8
- Forks: 59
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Raspberry Pi WebRTC
Turn Raspberry Pi or NVIDIA Jetson into a low-latency ~200ms WebRTC streaming platform.
- Native WebRTC with hardware/software encoding
- Support snapshot, recording and [broadcasting](https://youtu.be/fuJ_EzwmlPM?si=66H8CgUIKo85leHI)
- Remote control and IoT messaging via WebRTC DataChannel
- Signaling options:
**MQTT**
* [picamera.js](https://www.npmjs.com/package/picamera.js)
* [picamera-react-native](https://www.npmjs.com/package/picamera-react-native)
* [picamera-web](https://app.picamera.live)
* [picamera-app](https://github.com/TzuHuanTai/picamera-app) - Android
**[WHEP](https://www.ietf.org/archive/id/draft-ietf-wish-whep-02.html)**
* [Home Assistant WebRTC Camera](https://github.com/AlexxIT/WebRTC)
* [eyevinn/webrtc-player](https://www.npmjs.com/package/@eyevinn/webrtc-player)
**WebSocket**
* [picamera.js](https://github.com/TzuHuanTai/picamera.js?tab=readme-ov-file#watch-videos-via-the-sfu-server) - SFU signaling & broadcast
## Requirements

- **Raspberry Pi (Zero/3/4/5)** or **NVIDIA Jetson (Nano/NX/Orin)**
- CSI or USB camera (supports libcamera, libargus or V4L2)
# Quick Start for Pi
Check out the [tutorial video](https://youtu.be/g5Npb6DsO-0) or follow these steps.
### 1. Flash Raspberry Pi OS
Use [Raspberry Pi Imager](https://www.raspberrypi.com/software/) to flash **Lite OS** to SD card.
### 2. Install Dependencies
```bash
sudo apt update
sudo apt install libmosquitto1 pulseaudio libavformat61 libswscale8 libyaml-cpp0.8
```
### 3. Download Binary
Get the latest [release binary](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/releases) .
```bash
wget https://github.com/TzuHuanTai/RaspberryPi-WebRTC/releases/latest/download/pi-webrtc_raspios-trixie-arm64.tar.gz
tar -xzf pi-webrtc_raspios-trixie-arm64.tar.gz
```
### 4. MQTT Signaling
Use [HiveMQ](https://www.hivemq.com), [EMQX](https://www.emqx.com/en), or a [self-hosted](doc/SETUP_MOSQUITTO.md) broker.
> [!TIP]
> **MQTT** lets your Pi camera and client exchange WebRTC connection info.
**WHEP** doesn’t need a broker but requires a public hostname.
## Run the App

- Open [picamera-web](https://app.picamera.live), add MQTT settings, and create a `UID`.
- Run the command on your Pi:
```bash
./pi-webrtc \
--camera=libcamera:0 \
--fps=30 \
--width=1280 \
--height=960 \
--use-mqtt \
--mqtt-host=your.mqtt.cloud \
--mqtt-port=8883 \
--mqtt-username=hakunamatata \
--mqtt-password=Wonderful \
--uid=your-custom-uid \
--no-audio \
--hw-accel # Only Pi Zero 2W, 3B, 4B support hw encoding
```
> [!IMPORTANT]
> Remove `--hw-accel` for Pi 5 or others without hardware encoder.
# [Advanced Usage](https://github.com/TzuHuanTai/RaspberryPi_WebRTC/wiki/Advanced-Settings)
- [Broadcasting a Live Stream to 1,000+ Viewers via SFU](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#broadcasting-a-live-stream-to-1000-viewers-via-sfu)
- [Using the V4L2 Driver](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#using-the-legacy-v4l2-driver) (for USB cameras)
- [Running as a Linux Service](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#running-as-a-linux-service)
- [Recording](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#recording)
- [Two-way Audio Communication](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#two-way-audio-communication)
- [Two-way DataChannel Messaging](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#two-way-datachannel-messaging)
- [Stream AI or Any Custom Feed to a Virtual Camera](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings##stream-ai-or-any-custom-feed-to-a-virtual-camera)
- [WHEP with Nginx proxy](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#whep-with-nginx-proxy)
- [Using the WebRTC Camera in Home Assistant](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#using-the-webrtc-camera-in-home-assistant)