mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-08 17:11:08 +00:00
A capture device could previously be selected only by index or by name. Both are unreliable when multiple audio/video devices share a name or across reboots. AVFoundation reorders the device indices, and the USB video uniqueID embeds the macOS locationID, which can be reassigned on reboot or replug and can then resolve to a different physical device. Add -video_device_id and -audio_device_id, which take a prefixed identifier: uid:<unique ID> or serial:<USB serial number>. The USB serial number is the only identifier that stays pegged to a given physical unit. For video it is resolved to the device's current locationID via IOKit. For audio it is matched against the uniqueID, which already embeds it. The unique ID covers devices that have no serial, such as virtual camera/audio devices. -list_devices additionally prints each device's uniqueID and USB serial so the values can be discovered. IOKit is detected in configure and used only when available. Signed-off-by: Gabriel Balaich <ffmpeg@ninbura.com>