MJPG-Streamer推流,将摄像头图像推送到http网页,

mjpeg推流,将摄像头推送到http网页

一、工具准备

  1. Linux系统
  2. usb摄像头

二、安装MJPG-Streamer

依赖的库和工具:

#库
sudo apt-get install libjpeg8-dev  #JPEG支持库(图像相关)

sudo apt-get install libv4l-dev   #4l是小写"L"(底层摄像头驱动的上层应用库)

#工具

#sudo apt-get install cmake  #下载编译工具(一般都有,没有需要下载)

#sudo apt-get install git    #(一般都有,没有需要下载)

安装与运行

# 方式包含但不限于以下两种

# 方式一    git

# pi@raspberrypi:~ $git clone  https://e.coding.net/fivecc/mjpg-streamer/mjpg-streamer.git

# 方式二    wget

pi@raspberrypi:~ $wget https://github.com/Five-great/mjpg-streamer/archive/master.zip

pi@raspberrypi:~ $unzip master.zip

#两种方式实现的效果大致相同

pi@raspberrypi:~ $ cd mjpg-*  # 进入mjpg-streamer-master文件夹

pi@raspberrypi:~/mjpg-streamer-master $ cd mjpg-*   # 进入mjpg-streamer-experimental文件夹

pi@raspberrypi:~/mjpg-streamer-master/mjpg-streamer-experimental $ make   #编译

pi@raspberrypi:~/mjpg-streamer-master/mjpg-streamer-experimental $ sudo make install #安装

# 至此安装完毕

# 接下来就可以运行

pi@raspberrypi: ~ $  ./mjpg_streamer -i "./input_uvc.so -n  -r 1920x1080 " -o "./output_http.so -w ./www"

运行之后我们就可以在服务器的8080端口看到我们的摄像头啦

请添加图片描述

运行参数

mjpg_streamer
# mjpg_streamer本身只有两个主要参数

# -i:指定生成动态库

# input_uvc.so:用来处理输入的数据

# -o:指定生成另外一个动态库

# output_http.so:用来处理输出的数据,用来给到浏览器

# 注意:MJPG-Streamer还有一个插件叫做output_rtsp.so;其实它是浪得虚名,它并不能把我们的输入转换成rtsp协议输出
input_uvc.so
 [-d | --device ].......: video device to open (your camera)
 [-r | --resolution ]...: the resolution of the video device,
                          can be one of the following strings:
                          QQVGA QCIF CGA QVGA CIF PAL 
                          VGA SVGA XGA HD SXGA UXGA 
                          FHD 
                          or a custom value like the following
                          example: 640x480
 [-f | --fps ]..........: frames per second
                          (camera may coerce to different value)
 [-q | --quality ] .....: set quality of JPEG encoding
 [-m | --minimum_size ].: drop frames smaller then this limit, useful
                          if the webcam produces small-sized garbage frames
                          may happen under low light conditions
 [-e | --every_frame ]..: drop all frames except numbered
 [-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver
 [-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave
                          it up to the driver using the value "auto"
 [-t | --tvnorm ] ......: set TV-Norm pal, ntsc or secam
 [-u | --uyvy ] ........: Use UYVY format, default: MJPEG (uses more cpu power)
 [-y | --yuv  ] ........: Use YUV format, default: MJPEG (uses more cpu power)
 [-fourcc ] ............: Use FOURCC codec 'argopt', 
                          currently supported codecs are: RGB24, RGBP 
 [-timestamp ]..........: Populate frame timestamp with system time
 [-softfps] ............: Drop frames to try and achieve this fps
                          set your camera to its maximum fps to avoid stuttering
 [-timeout] ............: Timeout for device querying (seconds)
 [-dv_timings] .........: Enable DV timings queriyng and events processing
output_http.so
[-d | --device ].......: video device to open (your camera)
 [-r | --resolution ]...: the resolution of the video device,
                          can be one of the following strings:
                          QQVGA QCIF CGA QVGA CIF PAL 
                          VGA SVGA XGA HD SXGA UXGA 
                          FHD 
                          or a custom value like the following
                          example: 640x480
 [-f | --fps ]..........: frames per second
                          (camera may coerce to different value)
 [-q | --quality ] .....: set quality of JPEG encoding
 [-m | --minimum_size ].: drop frames smaller then this limit, useful
                          if the webcam produces small-sized garbage frames
                          may happen under low light conditions
 [-e | --every_frame ]..: drop all frames except numbered
 [-n | --no_dynctrl ]...: do not initalize dynctrls of Linux-UVC driver
 [-l | --led ]..........: switch the LED "on", "off", let it "blink" or leave
                          it up to the driver using the value "auto"
 [-t | --tvnorm ] ......: set TV-Norm pal, ntsc or secam
 [-u | --uyvy ] ........: Use UYVY format, default: MJPEG (uses more cpu power)
 [-y | --yuv  ] ........: Use YUV format, default: MJPEG (uses more cpu power)
 [-fourcc ] ............: Use FOURCC codec 'argopt', 
                          currently supported codecs are: RGB24, RGBP 
 [-timestamp ]..........: Populate frame timestamp with system time
 [-softfps] ............: Drop frames to try and achieve this fps
                          set your camera to its maximum fps to avoid stuttering
 [-timeout] ............: Timeout for device querying (seconds)
 [-dv_timings] .........: Enable DV timings queriyng and events processing
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值