Skip to content

Commit

Permalink
Add another example for mediamtx
Browse files Browse the repository at this point in the history
  • Loading branch information
nvtkaszpir committed May 8, 2024
1 parent 8ef2329 commit aa87db6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/stream.mediamtx.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,35 @@ Or you could watch it via web browser under endpoints such as
http://rpi-address:8889/cam
http://rpi-address:8889/endoscope
```

## Example with single camera over USB

Raspberry Pi Zero 2 + Logitech C920, thanks to [user [&] undso.io](https://forum.prusa3d.com/forum/profile/undso-io/)
for working example.

Allows to have a camera live stream and prusa camera script to use that stream
as source of the images to send to PrusaConnect.

<!-- markdownlint-disable line_length -->
mediamtx config fragment

```yaml
paths:
cam:
runOnInit: ffmpeg -f v4l2 -i /dev/video0 -pix_fmt yuv420p -video_size 1920x1080 -framerate 30 -preset ultrafast -c:v libx264 -b:v 6000k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
runOnInitRestart: yes
```
env file for prusa connect script, remember to replace `[rpizero-ip]` with
device address (or try `127.0.0.1` or `0.0.0.0` if script runs on the same host where mediamtx runs)

```shell
PRINTER_ADDRESS=...
PRUSA_CONNECT_CAMERA_TOKEN=...
PRUSA_CONNECT_CAMERA_FINGERPRINT=...
CAMERA_DEVICE=/dev/null
CAMERA_COMMAND=ffmpeg
CAMERA_COMMAND_EXTRA_PARAMS="-loglevel error -y -rtsp_transport udp -i 'rtsp://[rpizero-ip]:8554/cam' -f image2 -vframes 1 -pix_fmt yuv420p "
```

<!-- markdownlint-enable line_length -->

0 comments on commit aa87db6

Please sign in to comment.