openSUSE Leap 15.2を実行しているRaspberry Pi 4で2つのUSB Webカメラを同時に実行するには?

openSUSE Leap 15.2を実行しているRaspberry Pi 4で2つのUSB Webカメラを同時に実行するには?

openSUSE Leap 15.2を実行しているRaspberry Pi 4で2つのUSB Webカメラを同時に実行するには?

私は最終的にそれが動作することを願っていますスポーツコマンドラインでもffplayを成功せずに使用しているので、問題が削除されたようです。

私には2つありますウェブカメラに入れる電源が供給されるUSBハブ。 2つのウェブカメラは独立して動作しますが、一緒には機能しません。テストとして、WebカメラをPiに直接接続するか、ハブから取り外して次のことができました。デバイス記述子の読み取り/64エラー-110だからハーブはい正しい電源。

次のように最初のカメラを起動すると、写真が撮影されます。

# ffplay -f v4l2 /dev/video0

ただし、2番目のタスクを開始すると、画像は表示されません(最初のタスクは引き続き機能します)。ここで待つだけでタイムアウトが発生しないようです(1秒以上待ったとは言えません)。ほんの数分で):

# ffplay -loglevel debug -f v4l2 /dev/video2
ffplay version 3.4.8 Copyright (c) 2003-2020 the FFmpeg developers
  built with gcc 7 (SUSE Linux)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libx264 --enable-libx265 --enable-libxvid
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Initialized opengl renderer.
[video4linux2,v4l2 @ 0xffff40000b50] fd:11 capabilities:84a000010   
[video4linux2,v4l2 @ 0xffff40000b50] Current input_channel: 0, input_name: Camera 1, input_std: 0
[video4linux2,v4l2 @ 0xffff40000b50] Querying the device for the current frame size
[video4linux2,v4l2 @ 0xffff40000b50] Setting frame size to 1280x720
[video4linux2,v4l2 @ 0xffff40000b50] The V4L2 driver changed the pixel format from 0x32315559 to 0x47504A4D
[video4linux2,v4l2 @ 0xffff40000b50] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0xffff40000b50] The V4L2 driver changed the pixel format from 0x32315559 to 0x47504A4D
[video4linux2,v4l2 @ 0xffff40000b50] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0xffff40000b50] The V4L2 driver changed the pixel format from 0x32315659 to 0x47504A4D
[video4linux2,v4l2 @ 0xffff40000b50] Trying to set codec:rawvideo pix_fmt:yuv422p
[video4linux2,v4l2 @ 0xffff40000b50] The V4L2 driver changed the pixel format from 0x50323234 to 0x47504A4D
[video4linux2,v4l2 @ 0xffff40000b50] Trying to set codec:rawvideo pix_fmt:yuyv422
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0

dmesgには何もありません。最初のカムが起動すると、Journalctlは次のように表示します。

Dec 29 16:23:17 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Scheduling inhibition from ":1.14" "My SDL application" with cookie 18 and reason "Playing a game"
Dec 29 16:23:22 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Enforcing inhibition from ":1.14" "My SDL application" with cookie 18 and reason "Playing a game"
Dec 29 16:23:22 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Added change screen settings
Dec 29 16:23:22 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Added interrupt session
Dec 29 16:23:22 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Disabling DPMS due to inhibition
Dec 29 16:23:22 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Can't contact ck

...そして2回目が始まると

Dec 29 16:24:07 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Scheduling inhibition from ":1.14" "My SDL application" with cookie 19 and reason "Playing a game"
Dec 29 16:24:12 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Enforcing inhibition from ":1.14" "My SDL application" with cookie 19 and reason "Playing a game"
Dec 29 16:24:12 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Added change screen settings
Dec 29 16:24:12 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Added interrupt session
Dec 29 16:24:12 shed-pi4.xxx.xxx org_kde_powerdevil[2497]: powerdevil: Can't contact ck

これが鍵でも、赤いニシンでもあるかもしれません。 Googleによると、陪審員団はまだ出ていません!

最初のカメラ(video0)のffplayを停止すると、2番目の「hang」セッション(video2)がすぐに開始されます。

その他の情報:

# ls -lah /dev/v4l/by-path/
total 0
drwxr-xr-x 2 root root 120 Oct 21 15:01 .
drwxr-xr-x 4 root root  80 Oct 21 15:01 ..
lrwxrwxrwx 1 root root  12 Oct 21 15:01 platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4.3:1.0-video-index0 -> ../../video0
lrwxrwxrwx 1 root root  12 Oct 21 15:01 platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4.3:1.0-video-index1 -> ../../video1
lrwxrwxrwx 1 root root  12 Oct 21 15:01 platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4.4:1.0-video-index0 -> ../../video2
lrwxrwxrwx 1 root root  12 Oct 21 15:01 platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.4.4:1.0-video-index1 -> ../../video3

# ls -lah /dev/v4l/by-id/
total 0
drwxr-xr-x 2 root root 80 Oct 21 15:01 .
drwxr-xr-x 4 root root 80 Oct 21 15:01 ..
lrwxrwxrwx 1 root root 12 Oct 21 15:01 usb-HD_Camera_Manufacturer_USB_2.0_Camera-video-index0 -> ../../video0
lrwxrwxrwx 1 root root 12 Oct 21 15:01 usb-HD_Camera_Manufacturer_USB_2.0_Camera-video-index1 -> ../../video1

# hwinfo --usb [Edit]
03: USB 00.1: 0000 Unclassified device
  [Created at usb.122]
  Unique ID: VfPh.nrd9O+1TtQ3
  Parent ID: 33sj.xvTGa+XkbXF
  SysFS ID: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.1
  SysFS BusID: 1-1.4.4:1.1
  Hardware Class: unknown
  Model: "ARC International USB 2.0 Camera"
  Hotplug: USB
  Vendor: usb 0x05a3 "ARC International"
  Device: usb 0x9310 "USB 2.0 Camera"
  Driver: "uvcvideo"
  Driver Modules: "uvcvideo"
  Speed: 480 Mbps
  Module Alias: "usb:v05A3p9310d0000dcEFdsc02dp01ic0Eisc02ip00in01"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #4 (Hub)

05: USB 00.2: 0000 Unclassified device
  [Created at usb.122]
  Unique ID: Wi1b.nrd9O+1TtQ3
  Parent ID: 33sj.xvTGa+XkbXF
  SysFS ID: /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.2
  SysFS BusID: 1-1.4.3:1.2
  Hardware Class: unknown
  Model: "ARC International USB 2.0 Camera"
  Hotplug: USB
  Vendor: usb 0x05a3 "ARC International"
  Device: usb 0x9310 "USB 2.0 Camera"
  Driver: "snd-usb-audio"
  Driver Modules: "snd_usb_audio"
  Speed: 480 Mbps
  Module Alias: "usb:v05A3p9310d0000dcEFdsc02dp01ic01isc01ip00in02"
  Driver Info #0:
    Driver Status: snd_usb_audio is active
    Driver Activation Cmd: "modprobe snd_usb_audio"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #4 (Hub)


# lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 2: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 8, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 1: Dev 8, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 3: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 3: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 4: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 4: Dev 7, If 1, Class=Video, Driver=uvcvideo, 480M
            |__ Port 4: Dev 7, If 2, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 4: Dev 7, If 0, Class=Video, Driver=uvcvideo, 480M
            |__ Port 4: Dev 7, If 3, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 3: Dev 6, If 2, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 3: Dev 6, If 0, Class=Video, Driver=uvcvideo, 480M
            |__ Port 3: Dev 6, If 3, Class=Audio, Driver=snd-usb-audio, 480M
            |__ Port 3: Dev 6, If 1, Class=Video, Driver=uvcvideo, 480M
     
# v4l2-ctl --list-devices --verbose
USB 2.0 Camera: HD USB Camera (usb-0000:01:00.0-1.4.3):
        /dev/video0
        /dev/video1

USB 2.0 Camera: HD USB Camera (usb-0000:01:00.0-1.4.4):
        /dev/video2
        /dev/video3

VIDIOC_QUERYCAP: ok

午後を通してインターネット検索をしてみましたが、これまでは空の内容が出てきました。 2台のカメラを同時に操作するにはどうすればよいですか? ffplayで動作させることができれば、Motionでも動作できることを願っています。

よろしくお願いします。

ベストアンサー1

わかりました…問題が解決したようです。今私が探しているものを知ることができ、答えは次のとおりです。どこでも

最初のカメラを1280×720の解像度に設定しましたが、PiのCPU使用率が20%未満で見事に実行されたので、他のカメラを接続してもまだ空き容量があると思いました。

いいえ、ボトルネックはCPUではなくUSBのようです。

まず、複数のUSB2デバイスをUSB3ハブに接続すると、すべてのUSB2デバイスは480Mbsのスペースを共有しますが、それぞれ新しいスペースを取得するわけではありません。私はこれを暗黙的に知っていましたが、明示的に示しました! (あ!)

第2に、第1のカメラは必要な帯域幅だけでなく、利用可能な全ての帯域幅を占めるように見えるので、後続のカメラは帯域幅を全く得ない。私が思う限り、エラーや警告はありません。ただ座って待つだけです。待つ。この問題はフラグを設定することで解決できます。UVC_QUIRK_FIX_BANDWIDTH次のように:

# rmmod uvcvideo
# modprobe uvcvideo quirks=128

そして永久に作りましょう

# cat /etc/modprobe.d/uvcvideo.conf
options uvcvideo quirks=128

第三に、残念ながらこれだけでは不足して解像度を640x480に、フレームレートを20に下げなければなりませんでした。

今、Motionは両方のカメラを一緒に使用します。楽しい運動でしたが、発見するまでuvcvideoの欠点そして入れてそれGoogleに戻って、私はこの質問が実際によく知られており、以前にも何度も答えられたことに気づきました。 ...しかし、異常な点を見つけるには、異常な点を理解する必要があります。

こんにちは!

おすすめ記事