openwrt 掛載攝像頭

openwrt 掛載攝像頭  

2010-07-14 08:11:22|  分類: Linux Openwrt |舉報 |字號 訂閱

openwrt 掛載 UVC攝像頭
opkg update

opkg install kmod-usb-ohci           #一般BCM用的是ohci USB控制器
#opkg install kmod-usb-uhci      #UHCI USB控制器
opkg install kmod-usb-video
opkg install kmod-video-gspca-core
opkg install kmod-video-core
opkg install kmod-video-uvc            #免驅攝像頭
opkg install kmod-video-gspca-zc3xx    #中微星攝像頭 如zc301 zc303 zc305
opkg install kmod-i2c-core
opkg install kmod-input-core
opkg install motion

攝像頭用motion做監控非常棒!

畫面上只要有變化,就會保存照片到置頂位置。太適合做監控了

我在三個路由實現了該監控,分別是mi424wr,db120,7231-4p.其中7231-4p是使用dd-wrt 其餘兩個使用openwrt-backfire.
首先在http://downloads.openwrt.org/backfire/10.03   根據硬件平臺下載安裝motion及相關的ipk包,
然後編輯vi /overlay/etc/motion.conf, 我的編輯文件內容如下
# Rename this distribution example file to motion.conf
#
# This config file was generated by motion "3.2.11.1"


############################################################
# Daemon
############################################################

# Start in daemon (background) mode and release terminal (default: off)
daemon off

# File to store the process ID, also called pid file. (default: not defined)
process_id_file /var/run/motion/motion.pid

############################################################
# Basic Setup Mode
############################################################

# Start in Setup-Mode, daemon disabled. (default: off)
setup_mode off

###########################################################
# Capture device options
############################################################

# Videodevice to be used for capturing   (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video0

                                       
                                                                                 
# Image width (pixels). Valid range: Camera dependent, default: 352            
width 320                                                                         
                                                                                 
# Image height (pixels). Valid range: Camera dependent, default: 288            
height 240                                                   
              
                                                                                 
                                                                        
                                                                     
                                                                                   

# Motion Detection Settings:
############################################################

# Threshold for number of changed pixels in an image that
# triggers motion detection (default: 1500)
threshold 1500 這個是改變探測靈敏度,越小越靈敏
# Automatically tune the threshold down if possible (default: off)
threshold_tune off

# Noise threshold for the motion detection (default: 32)
noise_level 32

# Automatically tune the noise threshold (default: on)
noise_tune on







# Live Webcam Server
############################################################

# The mini-http server listens to this port for requests (default: 0 = disabled)
webcam_port 8081   #遠程端口
# Quality of the jpeg images produced (default: 50)
webcam_quality 50

# Output frames at 1 fps when no motion is detected and increase to the
# rate given by webcam_maxrate when motion is detected (default: off)
webcam_motion off

# Maximum framerate for webcam streams (default: 1)
webcam_maxrate 1

# Restrict webcam connections to localhost only (default: on)
webcam_localhost off #必須改成off才能通過pc訪問

# Limits the number of images per connection (default: 0 = unlimited)
# Number can be defined by multiplying actual webcam rate by desired number of seconds
# Actual webcam rate is the smallest of the numbers framerate and webcam_maxrate
webcam_limit 0

target_dir /tmp/cam1       #保存目錄

############################################################
# HTTP Based Control
############################################################

# TCP/IP port for the http server to listen on (default: 0 = disabled)
control_port 8080

# Restrict control connections to localhost only (default: on)
control_localhost on

# Output for http server, select off to choose raw text plain (default: on)
control_html_output on

# Authentication for the http based control. Syntax username:password
# Default: not defined (Disabled)
; control_authentication username:password

##############################################################
# Thread config files - One for each camera.
# Except if only one camera - You only need this config file.
# If you have more than one camera you MUST define one thread
# config file for each camera in addition to this config file.
##############################################################

# Remember: If you have more than one camera you must have one
# thread file for each camera. E.g. 2 cameras requires 3 files:
# This motion.conf file AND thread1.conf and thread2.conf.
# Only put the options that are unique to each camera in the
# thread config files.
thread /etc/thread1.conf
thread /etc/thread2.conf
# thread /etc/thread3.conf
# thread /etc/thread4.conf
   #如果有多個攝像頭要把使用這部分,否則全部註釋掉

因爲字符限制,上面只是把需要修改的地方寫上了
修改好後,在/etc目錄下 輸入 motion -c motion.conf

這時候只要攝像頭畫面有變化,就出現採集圖片到設置目錄了.

在windows下也可以使用palantir (在這裏下載http://www.fastpath.it/products/palantir/pub/pclient.exe) 的pc客戶端 連接 192.168.1.1:8081就可以看到圖片了,這個完全是一張張圖片播放的 所以不連貫.

開機自啓動

/etc/init.d/motion

#!/bin/sh /etc/rc.common
# Copyright (C) 2006-2010 OpenWrt.org
# Copyright (C) 2006 Carlos Sobrinho


START=80
STOP=50
start()
{
   motion&
}

stop()
{
killall motion
}

/etc/init.d/motion start     啓動

/etc/init.d/motion enabel 是自啓動

dmesg | grep uvcvideo
spcacat
libpthread
libmjpg

opkg install usbutils
lsusb
dmesg | grep usb

cat /dev/video0 > /tmp/1.jpg


Palantir 、motion、Mjpg-streamer

openwrt 掛載ZCXX攝像頭

1、先修改opkg源爲openwrt.cn, 安裝openwrt.cn中文網提供的kmod-usb-video、kmod-video-gspca-core;
opkg update
opkg install http://www.openwrt.org.cn/downloads/backfire/10.03/brcm63xx/packages/kmod-usb-video_2.6.32.10-1_brcm63xx.ipk
opkg install kmod-video-core
opkg install http://www.openwrt.org.cn/downloads/backfire/10.03/brcm63xx/packages/kmod-video-gspca-core_2.6.32.10-1_brcm63xx.ipk
opkg install http://downloads.x-wrt.org/xwrt/backfire/10.03/brcm63xx/packages/kmod-video-gspca-zc3xx_2.6.32.10-1_brcm63xx.ipk

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