树莓派使用mjpg实现网页摄像头监控(USB/CSI摄像头都可以)

树莓派使用mjpg实现网页摄像头监控(USB/CSI摄像头都可以)

转载  https://blog.csdn.net/qq_36798753/article/details/78082006  

 

第一步,下载源码

wget https://github.com/jacksonliam/mjpg-streamer/archive/master.zip

 

第二步,安装相关依赖包

sudo apt-get install libjpeg8-dev

sudo apt-get install cmake

 

第三步,解压,编译

unzip master.zip

cd mjpg-streamer-master/mjpg-streamer-experimental

make clean all

 

第四步,制作启动脚本

cd 进去主目录

vi jk.sh

将下面两条命令复制进去(红色命令二选一)

 

cd mjpg-streamer-master/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
 

  • 1
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 9
    评论
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值