以下操作及配置均基于Logitech Quickcam Pro for Notebooks (2007)的摄像头。在Trunk开发版本的OpenWrt测试成功。

ipkg install kmod-video-uvc kmod-usb2 uvc-streamer

UCI的配置文件和uvc-streamer的初始化脚本:

/etc/config/uvc-streamer

config uvc-streamer
        option device          '/dev/video0'
        option resolution      '640x480'
        option framespersecond '5'
        option port            '8080'
        option enabled         '1'

/etc/init.d/uvc-streamer

#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
START=50
SSD=start-stop-daemon
NAME=uvc_stream
PIDF=/var/run/$NAME.pid
PROG=/sbin/$NAME
append_bool() {
        local section="$1"
        local option="$2"
        local value="$3"
        local _val
        config_get_bool _val "$section" "$option" '0'
        [ "$_val" -gt 0 ] && append args "$3"
}
append_string() {
        local section="$1"
        local option="$2"
        local value="$3"
        local _val
        config_get _val "$section" "$option"
        [ -n "$_val" ] && append args "$3 $_val"
}
start_service() {
        local section="$1"
        args=""
        append_string "$section" device "-d"
        append_string "$section" resolution "-r"
        append_bool "$section" framespersecond "-f"
        append_string "$section" port "-p"
        config_get_bool "enabled" "$section" "enabled" '1'
        [ "$enabled" -gt 0 ] && $SSD -S -p $PIDF -q -x $PROG -- -b $args
}
stop_service() {
        killall $NAME 2>&1 > /dev/null
        # FIXME: Fix Busybox start-stop-daemon to work with multiple PIDs
        # $SSD -K -p $PIDF -q
}
start() {
        config_load "uvc-streamer"
        config_foreach start_service "uvc-streamer"
}
stop() {
        config_load "uvc-streamer"
        config_foreach stop_service "uvc-streamer"
}

赋予uvc-streamer可执行权限:

chmod a+x /etc/init.d/uvc-streamer

若有必要,请自行更改相关配置参数。

Start uvc-streamer

/etc/init.d/uvc-streamer start

让uvc-streamer开机自启动:

/etc/init.d/uvc-streamer enable

现在,在浏览器输入 http://192.168.1.1:8080/地址,或在VLC查看MJPEG stream。 同见webcamWIKI页,假如您需要其他摄像头的驱动程序。

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2011/05/30 03:20
  • by 127.0.0.1