记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

openwrt 挂载摄像头

openwrt 挂载摄像头

openwrt 挂载 UVC摄像头
opkg update
opkg install kmod-usb-video
opkg install kmod-video-gspca-core
opkg install kmod-video-core
opkg install kmod-video-uvc
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

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):