我想在树莓派3上保存外部USB摄像头的视频。为了避免电压降问题,我使用了官方的覆盆子电源(2.5安培)并通过一个独立供电的USB集线器连接所有USB设备:
pi@raspi:~/appdev/ffmpeg $ lsusb
Bus 001 Device 037: ID 046d:09a1 Logitech, Inc. QuickCam Communicate MP/S5500
Bus 001 Device 036: ID 046d:c03f Logitech, Inc. M-BT85 [UltraX Optical Mouse]
Bus 001 Device 035: ID 04d9:1503 Holtek Semiconductor, Inc. Shortboard Lefty
Bus 001 Device 012: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
当我尝试通过运行以下bash脚本(代码段)来测试功能时:
function capture
{
capfile=$(date +%F_%Hh%Mm%Ss)
echo saving to $wdir/$capfile.mp4
echo $PATH
ffmpeg -video_size 320x240 -i /dev/video0 \
-vf drawtext="fontsize=18:x=10:y=220:fontcolor=red:\
fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf:\
text=%{localtime}" -t 10 $wdir/$capfile.mp4
# change -t to 3600 = 1h
}
for i in $(seq 1 10)
do
echo
echo Pass $i ...
capture
done
经过几次循环运行后,我总是看到设备错误:
Pass 5 ...
saving to /home/pi/appdev/ffmpeg/2017-09-16_13h31m00s.mp4
/usr/local/bin:/usr/bin/ffmpeg:/usr/bin:/bin:/sbin
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.2 (Raspbian 4.9.2-10)
configuration: --arch=armhf --target-os=linux --enable-gpl --enable-libfreetype --enable-mmal --enable-nonfree --enable-omx --enable-omx-rpi
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
/dev/video0: Input/output error
内核消息日志显示usb cam已被重置:
pi@raspi:~/appdev/ffmpeg $ dmesg | grep usb
[ 4497.358195] usb 1-1.2.4: new high-speed USB device number 37 using dwc_otg
[ 4497.573440] usb 1-1.2.4: New USB device found, idVendor=046d, idProduct=09a1
[ 4497.573466] usb 1-1.2.4: New USB device strings: Mfr=0, Product=0, SerialNumber=2
[ 4497.573481] usb 1-1.2.4: SerialNumber: A032D310
[ 4497.605698] input: UVC Camera (046d:09a1) as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2.4/1-1.2.4:1.0/input/input15
[ 4497.625582] usb 1-1.2.4: Warning! Unlikely big volume range (=3072), cval->res is probably wrong.
[ 4497.625606] usb 1-1.2.4: [5] FU [Mic Capture Volume] ch = 1, val = 4608/7680/1
[ 5268.123764] usb 1-1.2.4: reset high-speed USB device number 37 using dwc_otg
下次启动脚本时,usb cam断开连接,/ dev / viedo0消失:
pi@raspi:~/appdev/ffmpeg $ dmesg | grep usb
[ 5621.216896] usb 1-1.2.4: USB disconnect, device number 37
[ 5621.586804] usb 1-1.2.4: new full-speed USB device number 38 using dwc_otg
[ 5621.686694] usb 1-1.2.4: device descriptor read/64, error -32
[ 5621.896583] usb 1-1.2.4: device descriptor read/64, error -32
[ 5622.106572] usb 1-1.2.4: new full-speed USB device number 39 using dwc_otg
[ 5622.206574] usb 1-1.2.4: device descriptor read/64, error -32
[ 5622.416577] usb 1-1.2.4: device descriptor read/64, error -32
[ 5622.626586] usb 1-1.2.4: new full-speed USB device number 40 using dwc_otg
[ 5623.046583] usb 1-1.2.4: device not accepting address 40, error -32
[ 5623.146583] usb 1-1.2.4: new full-speed USB device number 41 using dwc_otg
[ 5623.566603] usb 1-1.2.4: device not accepting address 41, error -32
[ 5623.566670] usb 1-1.2-port4: unable to enumerate USB device
是否有人遇到类似问题并可以提供修复方法?
我可以使用哪些工具来解决pi上的usb通信问题?
答案 0 :(得分:0)
我通过对/boot/cmdline.txt进行以下编辑来运行它: dwc_otg.fiq_enable = 1 dwc_otg.fiq_fsm_enable = 1 dwc_otg.fiq_fsm_mask = 0x3
源: https://volumio.org/forum/solution-pops-and-clicks-t772.html