#11015 closed defect (fixed)
Mac arm64, AVFoundation not listing video device part of usb cameras, Logitech?
Reported by: | Dave | Owned by: | Thilo Borgmann |
---|---|---|---|
Priority: | important | Component: | undetermined |
Version: | 7.0 | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
On two arm64 Macs, M1 Max and M3 Pro, each with a different Logitech camera, respectively: C920 HD, and Brio, only the audio is detected and not the video devices.
M1 Max, Monterey 12.6, Logitech c920
M3 Pro, Sonoma 14.4, Logitech Brio
M1 max:
% ffmpeg -hide_banner -f avfoundation -list_devices true -i dummy [AVFoundation indev @ 0x14ae066d0] AVFoundation video devices: [AVFoundation indev @ 0x14ae066d0] [0] FaceTime HD Camera [AVFoundation indev @ 0x14ae066d0] [1] Capture screen 0 [AVFoundation indev @ 0x14ae066d0] AVFoundation audio devices: [AVFoundation indev @ 0x14ae066d0] [0] BlackHole 64ch [AVFoundation indev @ 0x14ae066d0] [1] BoomAudio [AVFoundation indev @ 0x14ae066d0] [2] MacBook Pro Microphone [AVFoundation indev @ 0x14ae066d0] [3] Yeti Stereo Microphone [AVFoundation indev @ 0x14ae066d0] [4] USB PnP Audio Device [AVFoundation indev @ 0x14ae066d0] [5] HD Pro Webcam C920 <-- audio [in#0 @ 0x14ae06290] Error opening input: Input/output error Error opening input file dummy. Error opening input files: Input/output error
M3 Pro:
% ffmpeg -hide_banner -f avfoundation -list_devices true -i dummy 2024-05-15 07:02:33.216 ffmpeg[7260:1451488] WARNING: Add NSCameraUseContinuityCameraDeviceType to your Info.plist to use AVCaptureDeviceTypeContinuityCamera. [AVFoundation indev @ 0x11ef04be0] AVFoundation video devices: [AVFoundation indev @ 0x11ef04be0] [0] FaceTime HD Camera [AVFoundation indev @ 0x11ef04be0] [1] Capture screen 0 [AVFoundation indev @ 0x11ef04be0] [2] Capture screen 1 [AVFoundation indev @ 0x11ef04be0] AVFoundation audio devices: [AVFoundation indev @ 0x11ef04be0] [0] MacBook Pro Microphone [AVFoundation indev @ 0x11ef04be0] [1] External Microphone [AVFoundation indev @ 0x11ef04be0] [2] Logitech BRIO [in#0 @ 0x600000624000] Error opening input: Input/output error Error opening input file dummy. Error opening input files: Input/output error
M1 Max homebrew ffmpeg info:
% brew info ffmpeg ==> ffmpeg: stable 7.0 (bottled), HEAD Play, record, convert, and stream audio and video https://ffmpeg.org/ Installed /opt/homebrew/Cellar/ffmpeg/6 (8 files, 1002B) Poured from bottle using the formulae.brew.sh API on 2024-04-27 at 08:16:35 /opt/homebrew/Cellar/ffmpeg/7.0_1 (286 files, 52.9MB) * Poured from bottle using the formulae.brew.sh API on 2024-04-29 at 14:49:36 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/f/ffmpeg.rb License: GPL-2.0-or-later ==> Dependencies Build: pkg-config ✔ Required: aom ✔, aribb24 ✔, dav1d ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, harfbuzz ✔, jpeg-xl ✔, lame ✔, libass ✔, libbluray ✔, librist ✔, libsoxr ✔, libssh ✔, libvidstab ✔, libvmaf ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, openvino ✔, opus ✔, rav1e ✔, rubberband ✔, sdl2 ✘, snappy ✔, speex ✔, srt ✔, svt-av1 ✔, tesseract ✔, theora ✔, webp ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔, zeromq ✔, zimg ✔ ==> Options --HEAD Install HEAD version ==> Analytics install: 125,981 (30 days), 420,768 (90 days), 1,198,670 (365 days) install-on-request: 115,535 (30 days), 376,106 (90 days), 1,031,357 (365 days) build-error: 62 (30 days)
M3 Pro homebrew ffmpeg info
% brew info ffmpeg ==> ffmpeg: stable 7.0 (bottled), HEAD Play, record, convert, and stream audio and video https://ffmpeg.org/ Installed /opt/homebrew/Cellar/ffmpeg/7.0_1 (286 files, 51.9MB) * Poured from bottle using the formulae.brew.sh API on 2024-05-12 at 23:01:24 From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/f/ffmpeg.rb License: GPL-2.0-or-later ==> Dependencies Build: pkg-config ✘ Required: aom ✔, aribb24 ✔, dav1d ✔, fontconfig ✔, freetype ✔, frei0r ✔, gnutls ✔, harfbuzz ✔, jpeg-xl ✔, lame ✔, libass ✔, libbluray ✔, librist ✔, libsoxr ✔, libssh ✔, libvidstab ✔, libvmaf ✔, libvorbis ✔, libvpx ✔, opencore-amr ✔, openjpeg ✔, openvino ✔, opus ✔, rav1e ✔, rubberband ✔, sdl2 ✔, snappy ✔, speex ✔, srt ✔, svt-av1 ✔, tesseract ✔, theora ✔, webp ✔, x264 ✔, x265 ✔, xvid ✔, xz ✔, zeromq ✔, zimg ✔ ==> Options --HEAD Install HEAD version ==> Analytics install: 125,981 (30 days), 420,768 (90 days), 1,198,670 (365 days) install-on-request: 115,535 (30 days), 376,106 (90 days), 1,031,357 (365 days) build-error: 62 (30 days)
As a test I plugged in another USB camera which is a very generic camera with no audio device in it and it is also not detected on either machine.
Here is the ioreg -p IOUSB command to show the hardware USB connections:
% ioreg -p IOUSB +-o Root <class IORegistryEntry, id 0x100000100, retain 37> +-o AppleT8122USBXHCI@02000000 <class AppleT8122USBXHCI, id 0x10000063b, registered, matched, active, busy 0 (122 ms), retain 152> | +-o USB2.0 Hub@02100000 <class IOUSBHostDevice, id 0x100001bad, registered, matched, active, busy 0 (34 ms), retain 30> | | +-o USB-C Digital AV Multiport Adapter@02120000 <class IOUSBHostDevice, id 0x100001bed, registered, matched, active, busy 0 (13 ms), retain 24> | +-o USB3.1 Hub@02200000 <class IOUSBHostDevice, id 0x100001bc0, registered, matched, active, busy 0 (94 ms), retain 28> | +-o Logitech BRIO@02210000 <class IOUSBHostDevice, id 0x1000068f9, registered, matched, active, busy 0 (76 ms), retain 55> +-o AppleT8122USBXHCI@01000000 <class AppleT8122USBXHCI, id 0x1000003ff, registered, matched, active, busy 0 (3 ms), retain 37> +-o AppleT8122USBXHCI@00000000 <class AppleT8122USBXHCI, id 0x10000060f, registered, matched, active, busy 0 (206 ms), retain 85> +-o USB2.0 Hub@00100000 <class IOUSBHostDevice, id 0x100001261, registered, matched, active, busy 0 (67 ms), retain 32> | +-o USB-C Digital AV Multiport Adapter@00120000 <class IOUSBHostDevice, id 0x10000128c, registered, matched, active, busy 0 (31 ms), retain 25> | +-o USB2.0 PC CAMERA@00110000 <class IOUSBHostDevice, id 0x10000b89a, registered, matched, active, busy 0 (18 ms), retain 26> +-o USB3.1 Hub@00200000 <class IOUSBHostDevice, id 0x100001264, registered, matched, active, busy 0 (148 ms), retain 28>
Change History (12)
comment:1 by , 5 months ago
Owner: | set to |
---|---|
Status: | new → open |
comment:2 by , 5 months ago
Well, interesting:
ffmpeg 6.1.1_1, homebrew
% /opt/homebrew/Cellar/ffmpeg@6/6.1.1_1/bin/ffmpeg -hide_banner -f avfoundation -list_devices true -i dummy [AVFoundation indev @ 0x150105350] AVFoundation video devices: [AVFoundation indev @ 0x150105350] [0] Logitech BRIO [AVFoundation indev @ 0x150105350] [1] USB2.0 PC CAMERA [AVFoundation indev @ 0x150105350] [2] FaceTime HD Camera [AVFoundation indev @ 0x150105350] [3] Capture screen 0 [AVFoundation indev @ 0x150105350] [4] Capture screen 1 [AVFoundation indev @ 0x150105350] AVFoundation audio devices: [AVFoundation indev @ 0x150105350] [0] MacBook Pro Microphone [AVFoundation indev @ 0x150105350] [1] External Microphone [AVFoundation indev @ 0x150105350] [2] Logitech BRIO [in#0 @ 0x600002730300] Error opening input: Input/output error Error opening input file dummy. Error opening input files: Input/output error
Appears that something between this version and the latest version (at least in homebrew) has broken loading USB devices into this list.
And to answer your question directly - yes, the cameras do work in other apps and on web pages.
comment:3 by , 5 months ago
Then its a regression and we should be able to fix it.
Can you build FFmpeg and test custom patches for me?
Alternatively make the hardware available somehow (via remote connection maybe)?
comment:4 by , 5 months ago
Hey, I ran into this problem too. I can test a patch. The problem is not specific to arm64. Running macOS 12.7 on my M1 machine and 14.5 on the Intel. Setting up a remote connection might prove difficult, but I can buy you a Logitech webcam.
I think commit e37b15e26fbc7bc31a86a4a2c7c798e20d4f4c2c is suspicious.
Under if (mediaType == AVMediaTypeVideo) {
it starts out with only AVCaptureDeviceTypeBuiltInWideAngleCamera
(see "BuiltIn")
and it never adds AVCaptureDeviceTypeExternal
.
Also, my iPhone does not appear as it did in previous versions either (AVCaptureDeviceTypeContinuityCamera
).
I will test a change like
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index e558ad7d90..90dbf1a755 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -783,20 +783,23 @@ static NSArray* getDevicesWithMediaType(AVMediaType mediaType) { #if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000) [deviceTypes addObject: AVCaptureDeviceTypeDeskViewCamera]; #endif + #if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000) + [deviceTypes addObject: AVCaptureDeviceTypeExternal]; + #endif #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150400) [deviceTypes addObject: AVCaptureDeviceTypeBuiltInLiDARDepthCamera]; #endif - #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) + #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) [deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera]; #endif } else if (mediaType == AVMediaTypeAudio) { - #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) + #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeMicrophone]]; #else deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInMicrophone]]; #endif } else if (mediaType == AVMediaTypeMuxed) { - #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) + #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternal]]; #elif (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternalUnknown]];
comment:5 by , 5 months ago
A problem is that this new API AVCaptureDeviceDiscoverySession
should not be used on older macOS versions. AVCaptureDeviceTypeExternal
is for macOS 14+, but I am building and testing on a system with 12.7 where it was working fine. I can confirm this is working with the USB webcam on 12.7:
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index e558ad7d90..b4624658da 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -764,7 +764,7 @@ static int get_audio_config(AVFormatContext *s) } static NSArray* getDevicesWithMediaType(AVMediaType mediaType) { -#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)) +#if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000)) NSMutableArray *deviceTypes = nil; if (mediaType == AVMediaTypeVideo) { deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInWideAngleCamera]]; @@ -786,17 +786,17 @@ static NSArray* getDevicesWithMediaType(AVMediaType mediaType) {
It will take more time for me to verify that iPhone continuity camera is fixed with the parenthesis in the macro.
comment:6 by , 5 months ago
The #5 above gives the deprecation warning on devicesWithMediaType
the commit fixed. Here is a version of my change that also works and compiles without warning:
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index e558ad7d90..abce705d25 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -783,20 +783,25 @@ static NSArray* getDevicesWithMediaType(AVMediaType mediaType) { #if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000) [deviceTypes addObject: AVCaptureDeviceTypeDeskViewCamera]; #endif + #if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000) + [deviceTypes addObject: AVCaptureDeviceTypeExternal]; + #elif (TARGET_OS_OSX) + [deviceTypes addObject: AVCaptureDeviceTypeExternalUnknown]; + #endif #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150400) [deviceTypes addObject: AVCaptureDeviceTypeBuiltInLiDARDepthCamera]; #endif - #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) + #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) [deviceTypes addObject: AVCaptureDeviceTypeContinuityCamera]; #endif } else if (mediaType == AVMediaTypeAudio) { - #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) + #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeMicrophone]]; #else deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeBuiltInMicrophone]]; #endif } else if (mediaType == AVMediaTypeMuxed) { - #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000 || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) + #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 170000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 140000)) deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternal]]; #elif (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED < 140000) deviceTypes = [NSMutableArray arrayWithArray:@[AVCaptureDeviceTypeExternalUnknown]];
comment:7 by , 5 months ago
Nice work!
I can revisit this and test your patch on Wednesday or Thursday.
I might have another webcam to test, so maybe everything will get fixed then.
If that turns out to be true and you want to receive credit for your work, feel free to send your patch to ffmpeg-devel@ and I could push it reflecting your authorship.
comment:8 by , 4 months ago
Created an account just so I could log in and confirm I had the same issue (MacBook Air M1, various Logitech webcams x 3) and the patch has fixed it for me. First time I've actually done a patch + compile from source too, but it went smoothly thanks to the very fine doco. Cheers! :)
comment:9 by , 4 months ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Sorry for delay, tested and ok'd today. Pushing soon and closing this ticket.
Thanks @all!
comment:10 by , 4 months ago
Thank you. Is it possible to also add this to the release/7.0 branch in git since it was a regression?
Hard to tell anything without having the hardware at hand.
Did you test with FFmpeg 6.1 as well?
I guess it works in your browser using zoom/etc?
Any chance you could make this hardware available?