RaspberryPi_WebRTC icon indicating copy to clipboard operation
RaspberryPi_WebRTC copied to clipboard

Pi 5, HQ Camera and self hosted MQTT Server

Open taurisjoe opened this issue 6 months ago • 1 comments

Hi.

I found this program in search of something to make WebRTC work with my Pi 5 and high quality camera and I'm still struggling.

I followed the instructions and deployed the v1.1.1 tar.gz file and ran the following command:

./pi-webrtc \
    --camera=libcamera:0 \
    --fps=30 \
    --width=1280 \
    --height=960 \
    --use-mqtt \
    --mqtt-host=192.168.1.213 \    # My Laptop IP address running Mosquitto
    --mqtt-port=1883 \                
    --mqtt-username=mqttuser \    # Set the username and password hashed with the mosquitto_pword utility 
    --mqtt-password=mqttpassword \  
    --uid=pi0001 \   
    --no-audio 

This command runs with the following output:

$ ./pi-webrtc \
    --camera=libcamera:0 \
    --fps=30 \
    --width=1280 \
    --height=960 \
    --use-mqtt \
    --mqtt-host=192.168.1.213 \
    --mqtt-port=1883 \
    --mqtt-username=mqttuser \
    --mqtt-password=mqttpassword \
    --uid=pi0001 \
    --no-audio 
Using Libcamera, ID: 0
[0:15:27.037032668] [4437]  INFO Camera camera_manager.cpp:326 libcamera v0.5.0+59-d83ff0a4
[0:15:27.046186187] [4445]  INFO RPI pisp.cpp:720 libpisp version v1.2.1 981977ff21f3 29-04-2025 (14:13:50)
[0:15:27.062354520] [4445]  INFO RPI pisp.cpp:1179 Registered camera /base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a to CFE device /dev/media2 and ISP device /dev/media0 using PiSP variant BCM2712_C0
[libcamera_capturer] camera id: /base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a
[libcamera_capturer] camera validated format: 1280x960-YUV420.
[libcamera_capturer]   width: 1280, height: 960, stride: 1280
[0:15:27.062899927] [4437]  INFO Camera camera.cpp:1205 configuring streams: (0) 1280x960-YUV420
[0:15:27.063028687] [4445]  INFO RPI pisp.cpp:1483 Sensor: /base/axi/pcie@1000120000/rp1/i2c@80000/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected CFE format: 2028x1520-PC1B

My Mosquito server sees that the Pi has connected (yay):

1749503998: New connection from 172.18.0.4:33194 on port 1883.

1749503998: New client connected from 172.18.0.4:33194 as mqtt-explorer-454c9028 (p2, c1, k60, u'mqttuser').

Even with the connection working, I receive no messages in Mosquitto regarding any offers for connection from the WebRTC diagram:

sub: home-pi-5/sdp/+/offer
sub: home-pi-5/ice/+/offer

my mosquitto.conf file:


persistence true
persistence_location /var/lib/mosquitto/

password_file /mosquitto/config/mosquitto_password

listener 1883
allow_anonymous false

# this will expect websockets connections
listener 9001
protocol websockets

Any thoughts or pointers in the right direction would be appreciated.

Thanks in advance.

taurisjoe avatar Jun 09 '25 21:06 taurisjoe

I saw yor uid is pi0001, so you shoud subscribe

sub: pi0001/sdp/+/offer
sub: pi0001/ice/+/offer

instead of home-pi-5.

TzuHuanTai avatar Jun 09 '25 22:06 TzuHuanTai