https://github.com/bluenviron/mediamtx
下載地址:Releases · bluenviron/mediamtx
mediamtx支持windows和Linxu
解壓後配置yml文件
在最後添加paths即可
paths:
my_camera:
source: rtsp://admin:xxx@192.168.0.xx:554/h264/ch1/main/av_stream
如果是Linux上的usb攝像頭
paths:
my_camera:
runOnInit: ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -preset ultrafast -b:v 6000k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
runOnInitRestart: yes
設置好後,使用命令行運行mediamtx服務即可
windows下雙擊mediamtx.exe
Linux下執行./mediamtx
網頁播放
hls:(有延遲)
http://localhost:8888/my_camera/
webrtc:(低延遲,谷歌google瀏覽器支持直接訪問)