I recently completed a project using the Pi Zero 2 W and the Camera Module 3. My goal was to stream a live feed from the camera and use WebRTC to integrate it with HTML. After some trial and error, I found MediaMTX to be the best package for WebRTC. I wouldn’t have been able to do this without stumbling upon a helpful Reddit post.
- **Device:** Raspberry Pi Zero 2 W
- **OS:** Raspberry Pi OS (other) -> Raspberry Pi OS Lite (32-bit) (Bookworm, No GUI)
- Configure settings to set up your user/pass and SSID for Wi-Fi.
```bash
sudo apt update
sudo apt full-upgrade
```
```bash
sudo apt install libcamera-apps
```
```bash
libcamera-hello --list-cameras
```
> You should see output similar to this:

```bash
wget https://github.com/bluenviron/mediamtx/releases/download/v1.9.0/mediamtx_v1.9.0_linux_armv7.tar.gz
tar -xvzf mediamtx_v1.9.0_linux_armv7.tar.gz
```
```javascript
sudo rm -rf LICENSE
```
```javascript
sudo mv mediamtx /usr/local/bin/
sudo mv mediamtx.yml /usr/local/etc/
sudo chmod +x /usr/local/bin/mediamtx
```
```bash
sudo nano /usr/local/etc/mediamtx.yml
```
Scroll to the bottom and add the following under `paths:`:
```bash
paths:
cam:
source: rpiCamera
```
Ensure proper indentation (2 spaces per level). Save and exit nano (`Ctrl + O`, `Ctrl + X`).
> `Optional`
>
> I also change `rpiCameraTextOverlayEnable = true` and I set a description in the `rpiCameraTextOverlay`. These settings are just above the paths in the rpi section. You can refer > to the documentation for this.
[https://github.com/bluenviron/mediamtx?tab=readme-ov-file#raspberry-pi-cameras](https://github.com/bluenviron/mediamtx?tab=readme-ov-file#raspberry-pi-cameras)
```bash
sudo tee /etc/systemd/system/mediamtx.service >/dev/null << EOF
[Unit]
Wants=network.target
[Service]
ExecStart=/usr/local/bin/mediamtx /usr/local/etc/mediamtx.yml
[Install]
WantedBy=multi-user.target
EOF
```
```bash
sudo systemctl daemon-reload
sudo systemctl enable mediamtx
sudo systemctl start mediamtx
sudo systemctl status mediamtx
```
> The status output should look something like this:

```javascript
sudo journalctl -u mediamtx.service
```
```bash
http://yourIPaddress:8889/cam
```
You should see a live video feed.

Hope this helps!