在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

錄像

待續

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章