Windows/Camera

Windows/Camera

Stream camera to http / rtmp

VLC Stream

HTTP: 8080 (tcp)
RTSP: 8554 (tcp and udp) (rtsp 默认端口 554)

"C:\Program FIles\VideoLAN\VLC\vlc.exe" :sout=#rtp{sdp=rtsp:/10.0.0.12/:5544/stream} :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep

打开 DirectShow 摄像头,并发布到 http 和 rtsp stream 命令:

with transcode (H264+mp3)

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" dshow:// --dshow-vdev="AV TO USB2.0" --dshow-size=640x480 --sout="#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:duplicate{dst=rtp{sdp=rtsp://:8554/aabbccddeeff},dst=http{mux=ffmpeg{mux=flv},dst=:8080/aabbccddeeff}}" --sout-all --sout-keep

其中:

  • --dshow-vdev : directshow 设备名。在 VLC File - Open Capture 的 directshow 设备列表里找。
  • --dshow-size : directshow 源大小。测试对于某些摄像头需要指定。
  • --sout : 输出 stream 参数。在 VLC File - Stream 里配置的最后一步显示的参数。

运行后 VLC 标题显示 "dshow://", 但此时 stream 已经开启了。测试: (返回 http 200)

curl -i http://127.0.0.1:8080/aabbccddeeff

设置为 /aabbccddeeff 路径是作为密码

Windows 的 shortcut 里的 Target 允许输入的最大字符(命令+参数) 有限制。所以建议用 bat 启动

start /B /MIN "" "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" dshow:// --dshow-vdev="AV TO USB2.0" --dshow-size=640x480 --sout="#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:duplicate{dst=rtp{sdp=rtsp://:8554/aabbccddeeff},dst=http{mux=ffmpeg{mux=flv},dst=:8080/aabbccddeeff}}" --sout-all --sout-keep

将这个 bat 或其快捷方式加入当前用户的 startup 文件夹即可实现开机时启动 VLC stream。

测试开启 transcode 后 CPU 占用较高。不转码:

--sout="#duplicate{dst=http{mux=ffmpeg{mux=flv},dst=:8080/aabbccddeeff},dst=rtp{sdp=rtsp://:8554/aabbccddeeff}}"

ffmpeg stream


Last update: 2020-07-21 07:02:22 UTC