diff --git a/docs/stream.mediamtx.md b/docs/stream.mediamtx.md index 6d50bd1..1a7501e 100644 --- a/docs/stream.mediamtx.md +++ b/docs/stream.mediamtx.md @@ -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. + + +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 " +``` + +