在openwrt上安装webcam

在openwrt上安装webcam

访问html格式文档在 这里
文档源码在 这里

硬件环境

  1. 摄像头淘宝买的杂牌 lsusb结果
    Bus 001 Device 005: ID 0c45:6340 Microdia
  1. 路由器
  • 路由型号 NETGEAR WNDR3700v2
  • 固件版本 OpenWrt Backfire 10.03.1 / LuCI 0.10.0 Release (0.10.0)
  • 内核版本 2.6.32.27

参考文档

开工

根据硬件信息查参考1

SN9C* open source Microdia drivers under development

我猜想次摄像头kernel驱动应该叫SN9CXX 再查参考2

kmod-video-sn9c102	Kernel modules for supporting SN9C102 camera chips.

猜想可能是这个驱动,开工安装

opkg update
opkg install kmod-video-sn9c102 mjpg-streamer

按照参考三,直接启动mjpg-stearmer,然后报错

/etc/init.d/mjpg-streamer start
MJPG Streamer Version: svn rev: exported
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: MJPEG
Unable to set format: 1196444237 res: 640x480
 Init v4L2 failed !! exit fatal 
 i: init_VideoIn failed

找到参考4,发现以下命令可以让摄像头正常工作

mjpg_streamer -i "input_uvc.so -y -d /dev/video0 -r VGA -l on" -o "output_http.so -p 8080 -w /tmp/webcam"
MJPG Streamer Version: svn rev: exported
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 5
 i: Format............: YUV
 i: JPEG Quality......: 80
Adding control for Pan (relative)
Adding control for Tilt (relative)
Adding control for Pan Reset
Adding control for Tilt Reset
Adding control for Pan/tilt Reset
Adding control for Focus (absolute)
mapping control for Pan (relative)
mapping control for Tilt (relative)
mapping control for Pan Reset
mapping control for Tilt Reset
mapping control for Pan/tilt Reset
mapping control for Focus (absolute)
mapping control for LED1 Mode
mapping control for LED1 Frequency
mapping control for Disable video processing
mapping control for Raw bits per pixel
 o: www-folder-path...: /tmp/webcam/
 o: HTTP TCP port.....: 8080
 o: username:password.: disabled
 o: commands..........: enabled
^Csetting signal to stop
setting signal to stop
setting signal to stop
setting signal to stop
force cancellation of threads and cleanup resources
 o: cleaning up ressources allocated by server thread #00
force cancellation of threads and cleanup resources
 i: cleaning up ressources allocated by input thread
done

访问浏览器http://192.168.3.1:8080/?action=stream 一切正常

接着分析,如果命令行能够执行成功,并且有画面说明只要让启动脚本按照能够正常执行的命令方式运行就可以了 接着看/etc/init.d/mjpg-streamer,第十七行出现了问题

[ $enabled -gt 0 -a -c $device ] && sleep 3 && $SSD -S -m -p $PIDF -q -x $PROG -- --input "input_uvc.so --device ....

修改成下面的

[ $enabled -gt 0 -a -c $device ] && sleep 3 && $SSD -S -m -p $PIDF -q -x $PROG -- --input "input_uvc.so -y --device

再执行启动脚本就没问题了

记得要打开自启动

/etc/init.d/mjpg-streamer enable

录像

待续

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值