It's a PoC WebRTC client for Raspberry Pi, built with Pion (GitHub Repo) and GStreamer. It connects to a signaling server, streams camera/microphone over WebRTC, and supports data channels for testing peer connections
I tested it on a Raspberry Pi model 4B (1GB RAM, 1,4 GHz ARM Cortex-A53 Quad-Core-CPU) but I guess it can easily run on a smaller model like Raspberry Pi Zero or Raspberry Pi Zero 2 W
Gstreamerinstalled on Raspberry Pi- (Optional)
Goinstalled, otherwise cross-compile the program for raspi - Camera [and microphone if needed], connected to raspi
- Signaling server or any other mean to exchange the SPD messages and ICE-candidates
- Set the env var, e.g:
export SIGNAL_WS_URL=wss://your.host/webrtc-signaling/ws
export SIGNAL_ORIGIN=https://your.host # (must match AllowedOrigins)
export RTC_CONFIG_URL=https://your.host/webrtc-signaling/api/rtc-config
# optional:
# export VIDEO_PORT=5004
# export AUDIO_PORT=5006
# export GST_VIDEO_PIPELINE='libcamerasrc ! video/x-raw,width=640,height=480,framerate=30/1 ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=ultrafast key-int-max=60 ! h264parse config-interval=1 ! rtph264pay pt=96 config-interval=1 ! udpsink host=127.0.0.1 port=5004'
# export GST_AUDIO_PIPELINE='alsasrc ! audioconvert ! audioresample ! opusenc bitrate=24000 ! rtpopuspay pt=111 ! udpsink host=127.0.0.1 port=5006'I used my own "playground" signaling server on websockets
wget https://github.com/ownerofglory/go-pion-raspi-poc/releases/download/v1.0.0/pi-client-arm64.zip
unzip pi-client-arm64.zipOR
makescp ./build/pi-client-arm64 <user>@<raspberry_host>:~Once the env variable set:
./pi-client-arm64OR Set the env variables inline
SIGNAL_WS_URL=wss://your.host/webrtc-signaling/ws \
SIGNAL_ORIGIN=https://your.host \
RTC_CONFIG_URL=https://your.host/webrtc-signaling/api/rtc-config \
./pi-client-arm64Example running with my "playground" signaling server
If the issues is with the camera try running the Gstreamer pipeline on your Raspberry Pi to see whether the video is working overall
Set <your_other_host_ip> to the IP of your machine within your local network and start transmitting video from Raspberry Pi
gst-launch-1.0 libcamerasrc ! video/x-raw,width=640,height=480,framerate=30/1 ! \
videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=ultrafast ! \
rtph264pay config-interval=1 pt=96 ! udpsink host=<your_other_host_ip> port=5000 On your other machine start the receiver pipeline. Example for MacOS:
gst-launch-1.0 udpsrc port=5000 caps="application/x-rtp, media=video, encoding-name=H264, payload=96" ! \
rtph264depay ! avdec_h264 ! autovideosink