RTSP流和USB摄像头转MJPEG使用VLC

测试环境:

       系统: Ubuntu14.04 LTS Desktop

       设备:海康IP摄像头和USB摄像头

1、需要先安装vlc包,命令行运行

sudo apt-get update
sudo apt-get install vlc

2、安装完成后,使用cvlc工具,在命令行运行(注:测试环境的海康摄像头IP 10.0.10.64  ,  rtsp的端口 554 ,   关闭了http basic 验证)

cvlc -R rtsp://10.0.10.64:554/Streaming/Channels/101 --sout "#transcode{vcodec=mjpg,vb=25,scale=1.0,fps=10,acodec=none}:standard{access=http{mime=multipart/x-mixed-replace; boundary=7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8888/videostream.cgi}"

运行返回

VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
[0x1d8dff8] dummy interface: using the dummy interface module...
[mjpeg @ 0x7f39b8015320] removing common factors from framerate
[mjpeg @ 0x7f39b86cb220] removing common factors from framerate
[0x7f39b00009b8] main input error: ES_OUT_RESET_PCR called

现在可以在浏览器中访问 http://localhost:8888/videostream.cgi

3、使用USB摄像头,在命令行运行(注:这里使用的USB摄像头系统设备名称为 video0)

cvlc --no-audio v4l2:///dev/video0 --v4l2-width 1920 --v4l2-height 1080 --v4l2-chroma h264 --v4l2-fps 30 --v4l2-hflip 1 --v4l2-vflip 1 --sout "#transcode{vcodec=mjpg,vb=25,scale=1.0,fps=10,acodec=none}:standard{access=http{mime=multipart/x-mixed-replace; boundary=7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8554/videostream.cgi}"

运行返回

VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
Warning: option --v4l2-fps no longer exists.
[0x113e878] dummy interface: using the dummy interface module...
[mjpeg @ 0x7f75b001a680] removing common factors from framerate
[mjpeg @ 0x7f75b00bccc0] removing common factors from framerate

现在可以在浏览器中访问 http://localhost:8554/videostream.cgi