gpt4 book ai didi

ffmpeg - 使用 ffmpeg 在树莓派上录制 USB 摄像头 - USB 故障排除

转载 作者:行者123 更新时间:2023-12-04 23:26:16 28 4
gpt4 key购买 nike

我想从树莓派 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 通信进行故障排除?

最佳答案

我通过对/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

关于ffmpeg - 使用 ffmpeg 在树莓派上录制 USB 摄像头 - USB 故障排除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46253564/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com