Generic webcams
If the operating system is Linux, edit mediamtx.yml and replace everything inside section paths with the following content:
paths:
cam:
runOnInit: ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
runOnInitRestart: yesIf the operating system is Windows:
paths:
cam:
runOnInit: ffmpeg -f dshow -i video="USB2.0 HD UVC WebCam" -c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
runOnInitRestart: yesWhere USB2.0 HD UVC WebCam is the name of a webcam, that can be obtained with:
ffmpeg -list_devices true -f dshow -i dummyThe resulting stream will be available on path /cam.