List macOS Screen Capture Devices with FFmpeg
This article provides a quick and straightforward guide on how to list all available screen capture, video, and audio input devices on macOS using the FFmpeg command-line tool. By leveraging the native system frameworks, you can easily identify the device indices or names required to configure screen recording and streaming.
To discover the available capture devices on macOS, you must query
the avfoundation device multiplexer, which is the native
framework used by FFmpeg for multimedia input on Apple platforms.
Open your Terminal application and run the following command:
ffmpeg -f avfoundation -list_devices true -i ""Understanding the Output
When you run this command, FFmpeg will query your system and output a list of detected inputs divided into two main categories:
- AVFoundation video devices: This section lists your physical cameras (such as the FaceTime HD Camera), virtual cameras, and available displays for screen capture (typically labeled as “Capture screen 0”, “Capture screen 1”, etc.).
- AVFoundation audio devices: This section lists available microphones, system audio capture interfaces, and plugged-in audio peripherals.
Each detected device will be displayed with an index number in brackets. The output will look similar to this:
[AVFoundation input device @ 0x7fa2f3404800] AVFoundation video devices:
[AVFoundation input device @ 0x7fa2f3404800] [0] FaceTime HD Camera
[AVFoundation input device @ 0x7fa2f3404800] [1] Capture screen 0
[AVFoundation input device @ 0x7fa2f3404800] AVFoundation audio devices:
[AVFoundation input device @ 0x7fa2f3404800] [0] Built-in Microphone
How to Use the Identified Devices
Once you know the index number or the exact name of your screen capture device, you can reference it in your FFmpeg recording commands.
To capture your screen using the identified device index, map the
video and audio inputs using the format
"[video_index]:[audio_index]".
For example, to record “Capture screen 0” (video index 1) and the “Built-in Microphone” (audio index 0), run:
ffmpeg -f avfoundation -i "1:0" output.mp4Alternatively, you can use the precise device names instead of index numbers:
ffmpeg -f avfoundation -i "Capture screen 0:Built-in Microphone" output.mp4