美文网首页
树莓派4b+MJPGStreamer

树莓派4b+MJPGStreamer

作者: 犬夜叉写作业 | 来源:发表于2019-08-15 17:38 被阅读0次

    1、先开启摄像头

    sudo raspi-confug
    

    找到 interface option - camera,enable
    重启

     sudo reboot
    

    2、装必要的库

    sudo apt-get update
    sudo apt-get -y install subversion
    sudo apt-get -y install libjpeg8-dev
    sudo apt-get -y install imagemagick
    sudo apt-get -y install libv4l-dev
    sudo apt-get -y install cmake
    sudo apt-get -y install git
    

    注:如果出现以下错误,说明是源不对
    列软件包有未 (源不对)

    下列软件包有未满足的依赖关系:

     libv4l-dev : 依赖: libv4l-0 (= 1.12.3-1) 但是 1.16.3-3 正要被安装
                  依赖: libv4lconvert0 (= 1.12.3-1) 但是 1.16.3-3 正要被安装
                  依赖: libv4l2rds0 (= 1.12.3-1) 但是 1.16.3-3 正要被安装
    

    3、下载mjpg-streamer

    sudo git clone https://github.com/jacksonliam/mjpg-streamer.git
    cd mjpg-streamer/mjpg-streamer-experimental
    sudo make all
    sudo make install
    

    cd mjpg-streamer/mjpg-streamer-experimental进入里面之后才能输入以下的内容

    csi摄像头用这个命令

    ./mjpg_streamer -i "./input_raspicam.so" -o "./output_http.so -w ./www"
    

    usb摄像头用这个命令

    ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"
    

    加权限

    chmod 744 jk.sh
    

    执行脚本命令:

    ./ jk.sh
    

    这样就能运行摄像头了!!!!!

    注:

    使用下面指令启动普通USB摄像头:

    ./mjpg_streamer -i "./input_uvc.so" -o "./output_http.so -w ./www"
    

    启动树莓派专用摄像头RaspiCamera的指令是:( CSI摄像头 )

    ./mjpg_streamer -i "./input_raspicam.so" -o "./output_http.so -w ./www"
    

    如果需要改变摄像头的帧率 以及大小 请自行修改启动脚本

    例如

    i "./input_raspicam.so" 这个可以带参数的 i "./input_raspicam.so -fps 3 -x 320 -y 240"
    

    启动之后

    默认访问地址是http://<树莓派IP>:8080访问的是索引

    通过nat123 可以实现内网映射,实现外网监控

    如果想修改端口请修改-o "./output_http.so -w ./www" 为 -o "./output_http.so -w ./www -p 81"

    即访问地址是 http://<树莓派IP>:81/

    附参数:

    MJPG Streamer Version.: 2.0
    raspicam input plugin: option '--x' requires an argument
     ---------------------------------------------------------------
     Help for input plugin..: raspicam input plugin
     ---------------------------------------------------------------
     The following parameters can be passed to this plugin:
    
     [-fps | --framerate]...: set video framerate, default 5 frame/sec 
     [-x | --width ]........: width of frame capture, default 640
     [-y | --height]........: height of frame capture, default 480 
     [-quality].............: set JPEG quality 0-100, default 85 
     [-usestills]...........: uses stills mode instead of video mode 
     [-preview].............: Enable full screen preview
     [-timestamp]...........: Get timestamp for each frame
     
     -sh  : Set image sharpness (-100 to 100)
     -co  : Set image contrast (-100 to 100)
     -br  : Set image brightness (0 to 100)
     -sa  : Set image saturation (-100 to 100)
     -ISO : Set capture ISO
     -vs  : Turn on video stablisation
     -ev  : Set EV compensation
     -ex  : Set exposure mode (see raspistill notes)
     -awb : Set AWB mode (see raspistill notes)
     -ifx : Set image effect (see raspistill notes)
     -cfx : Set colour effect (U:V)
     -mm  : Set metering mode (see raspistill notes)
     -rot : Set image rotation (0-359)
     -stats : Compute image stats for each picture (reduces noise for -usestills)
     -drc : Dynamic range compensation level (see raspistill notes)
     -hf  : Set horizontal flip
     -vf  : Set vertical flip
     ---------------------------------------------------------------
    input_init() return value signals to exit
    
    http://192.168.0.111:8080/?action=stream
    
    http://192.168.0.111:8080/index.html  看索引
    

    相关文章

      网友评论

          本文标题:树莓派4b+MJPGStreamer

          本文链接:https://www.haomeiwen.com/subject/uyqtsctx.html