Camera Rasberry Pi-Raspbian-运动-USB摄像头-黑色图像
我最近买了一个Rasperry Pi,VersionB,我正试图让一个旧的USB摄像头与motion一起工作,这样我就可以通过http访问流。我正在使用Raspbian,更新/升级已经完成 我相当肯定相机会工作,因为我已经玩了相当长一段时间的motion.conf文件,并且多次拔下/重新插入usb相机,并且在某个时候录制了2秒的运动视频,但是,我不确定我做了什么使它暂时工作 此外,我能够访问控制端口8089,以及8081(在firefox中)的流,但是流是黑色背景,右下角有一个计数器 控制端口列出相机已连接且运动检测处于活动状态,但端口8081上的视频流为黑色 最后,当我通过控制端口(8089)手动捕获一个屏幕截图时,屏幕截图是一个黑色图像,就像相机被覆盖一样 也就是说,我决定转向堆栈向导 供参考:Camera Rasberry Pi-Raspbian-运动-USB摄像头-黑色图像,camera,linux-device-driver,raspberry-pi,motion,debian-based,Camera,Linux Device Driver,Raspberry Pi,Motion,Debian Based,我最近买了一个Rasperry Pi,VersionB,我正试图让一个旧的USB摄像头与motion一起工作,这样我就可以通过http访问流。我正在使用Raspbian,更新/升级已经完成 我相当肯定相机会工作,因为我已经玩了相当长一段时间的motion.conf文件,并且多次拔下/重新插入usb相机,并且在某个时候录制了2秒的运动视频,但是,我不确定我做了什么使它暂时工作 此外,我能够访问控制端口8089,以及8081(在firefox中)的流,但是流是黑色背景,右下角有一个计数器 控制端口列
lsusb
与摄像机相关的输出:
Bus 001 Device 005: ID 0c45:6288 Microdia PC Camera with Microphone (SN9C202 + OV9655)
-编辑:
dmesg
插入USB摄像头后收到的输出:
[ 269.597235] usb 1-1.2: new high-speed USB device number 5 using dwc_otg
[ 269.700498] usb 1-1.2: New USB device found, idVendor=0c45, idProduct=6288
[ 269.700530] usb 1-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 269.700546] usb 1-1.2: Product: USB20 Camera
[ 269.784573] media: Linux media interface: v0.10
[ 269.810131] Linux video capture interface: v2.00
[ 269.819113] gspca_main: v2.14.0 registered
[ 269.826148] gspca_main: gspca_sn9c20x-2.14.0 probing 0c45:6288
[ 271.897401] gspca_sn9c20x: OV9655 sensor detected
[ 271.905922] input: gspca_sn9c20x as /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/input/input0
[ 271.910445] usbcore: registered new interface driver gspca_sn9c20x
[ 272.078022] 5:2:1: cannot get freq at ep 0x84
[ 272.091857] usbcore: registered new interface driver snd-usb-audio
[ 278.190887] gspca_sn9c20x: Set 640x480
[ 279.187333] gspca_sn9c20x: Set 640x480
[ 280.158810] gspca_main: ISOC data error: [23] len=0, status=-63
sudo运动的输出-n
[0] Processing thread 0 - config file /etc/motion/motion.conf
[0] Motion 3.2.12 Started
[0] ffmpeg LIBAVCODEC_BUILD 3482368 LIBAVFORMAT_BUILD 3478785
[0] Thread 1 is from /etc/motion/motion.conf
[0] httpd bind(): Address already in use
[1] Thread 1 started
[0] httpd thread exit
[1] cap.driver: "gspca_sn9c20x"
[1] cap.card: "USB20 Camera "
[1] cap.bus_info: "usb-bcm2708_usb-1.3"
[1] cap.capabilities=0x85000001
[1] - VIDEO_CAPTURE
[1] - READWRITE
[1] - STREAMING
[1] Test palette JPEG (640x480)
[1] Using palette JPEG (640x480) bytesperlines 640 sizeimage 154190 colorspace 00000007
[1] found control 0x00980900, "Brightness", range 0,255
[1] "Brightness", default 127, current 127
[1] found control 0x00980901, "Contrast", range 0,255
[1] "Contrast", default 127, current 127
[1] found control 0x00980902, "Saturation", range 0,255
[1] "Saturation", default 127, current 127
[1] found control 0x00980903, "Hue", range -180,180
[1] "Hue", default 0, current 0
[1] found control 0x0098090e, "Red Balance", range 0,127
[1] "Red Balance", default 40, current 40
[1] found control 0x0098090f, "Blue Balance", range 0,127
[1] "Blue Balance", default 40, current 40
[1] found control 0x00980910, "Gamma", range 0,255
[1] "Gamma", default 16, current 16
[1] found control 0x00980911, "Exposure", range 0,6016
[1] "Exposure", default 51, current 5864
[1] found control 0x00980912, "Gain, Automatic", range 0,1
[1] "Gain, Automatic", default 1, current 1
[1] found control 0x00980913, "Gain", range 0,28
[1] "Gain", default 0, current 0
[1] Error requesting buffers 4 for memory map. VIDIOC_REQBUFS: Device or resource busy
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
[1] Could not fetch initial image from camera
[1] Motion continues using width and height from config file(s)
[1] Resizing pre_capture buffer to 1 items
[1] bind(): Address already in use
[1] Problem enabling stream server in port 8088: Address already in use
[1] Thread exiting
[0] Motion thread 1 restart
[1] Thread 1 started
""""
""""
""""
""""
来自lsmod的输出
Module Size Used by
snd_bcm2835 16165 0
snd_usb_audio 116191 0
snd_usbmidi_lib 18267 1 snd_usb_audio
snd_hwdep 5968 1 snd_usb_audio
snd_seq_midi 4682 0
snd_seq_midi_event 6551 1 snd_seq_midi
snd_rawmidi 21357 2 snd_usbmidi_lib,snd_seq_midi
snd_pcm 81593 2 snd_bcm2835,snd_usb_audio
snd_page_alloc 5156 1 snd_pcm
snd_seq 53769 2 snd_seq_midi_event,snd_seq_midi
snd_seq_device 6473 3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer 20133 2 snd_pcm,snd_seq
snd 58895 9 snd_bcm2835,snd_usb_audio,snd_hwdep,snd_timer,snd_pcm,snd_seq,snd_rawmidi,snd_usbmidi_lib,snd_seq_device
evdev 9325 1
arc4 1683 2
rt2800usb 16720 0
rt2800lib 67499 1 rt2800usb
rt2x00usb 11492 1 rt2800usb
rt2x00lib 44180 3 rt2x00usb,rt2800lib,rt2800usb
gspca_sn9c20x 25601 1
gspca_main 23579 2 gspca_sn9c20x
mac80211 315610 3 rt2x00lib,rt2x00usb,rt2800lib
videodev 111230 3 gspca_sn9c20x,gspca_main
cfg80211 209273 2 mac80211,rt2x00lib
media 13467 1 videodev
crc_ccitt 1529 1 rt2800lib
leds_gpio 2059 0
rfkill 19138 2 cfg80211
led_class 3688 2 leds_gpio,rt2x00lib
如果有关系,我已经设置了作为守护进程运行的运动
还有什么我应该检查/更改以使事情正常工作的吗
另外,很明显,我是linux/debian noob,所以请对我放松。在低端笔记本电脑上也有同样的问题。pi上可用的总USB带宽是有限的,您已经在使用一些用于网络连接
我建议您降低运动处理的图像分辨率和帧速率
首先,我假设您安装了最新版本的motion
sudo apt-get update
sudo apt-get install motion
然后我们确认USB摄像头已被识别为v4l2设备
lsusb
ls /dev/video*
v4l2-ctl --list-devices
确保在每个输出中都能看到预期的摄像头。记下摄像机的名称,我假设/dev/video0
现在我们将编辑运动配置
sudo nano /etc/motion/motion.conf
在“捕获设备选项”标题下,您应该拥有与现有设备匹配的摄像头。e、 g.videodevice/dev/video0
接下来确保帧率和分辨率是好的和低的。你可以在以后增加这些直到运动再次中断,只要从有效的开始
width 320
height 240
framerate 2
对于调试,最好打开实时网络摄像头服务器,使其能够从笔记本电脑上查看。只需查看/etc/motion/motion.conf
文件,直到找到该部分
webcam_motion on
webcam_localhost off
现在我们需要打开一个不同的文件来启用运动守护进程
sudo nano /etc/default/motion
将该值更改为start\u motion\u daemon=yes
现在我们可以运行运动了
sudo service motion start
我们将在Firefox中查看摄像头的提要。首先使用ifconfig查找pi的IP地址,如果您是wifi等,则查找wlan0
ifconfig
我假设pi IP地址是192.168.1.123
现在,从笔记本电脑打开firefox,在地址栏中输入192.168.1.123:8081
。您将看到运动提要的预览!!如果您没有,请将分辨率降低,并确保您的笔记本电脑连接良好,并且与pi位于同一网络上。您还记得如何解决此问题吗