Two-way Audio
pi-webrtc can send audio from a microphone on the device, and play audio from the viewer on a speaker.
Turn audio on
Audio is on when you do not pass --no-audio. pi-webrtc uses PulseAudio by default:
./pi-webrtc --camera=libcamera:0 --uid=my-pi --use-whep ...On a system without PulseAudio, add --force-alsa. Then make sure that the ALSA default device is your speaker.
To run pi-webrtc as a service with audio, also run PulseAudio as a system service. See Run as a service.
What works where
- Peer-to-peer (MQTT, WHEP): audio goes both ways. The viewer's audio plays on the default output device.
- SFU (LiveKit, Cloudflare): audio goes one way, from the device to the viewers.
Hardware
The device needs a microphone and a speaker. USB audio devices are the easiest choice. For devices on the GPIO pins (I2S), see:
- Microphone: wiring and testing an I2S MEMS microphone
- Speaker: wiring a MAX98357 I2S amplifier
Encoding
pi-webrtc encodes the video for each WebRTC connection, so each connection can follow its own network. This page shows which encoder it uses, and how the fra...
Signaling
Before video can flow, the browser and the device must exchange connection details (an SDP offer and answer, and ICE candidates). This step is called signali...

