I'm currently attempting to move from a Windows audio/video capture rig to a 
Mac. On Windows, I relied heavily on FFmpeg & DirectShow to capture clean 
audio/video feeds from PCIe capture cards, as well as audio from my RME audio 
interfaces. I was hoping that I could do the same on macOS with FFmpeg & 
AVFoundation, but I'm surprised to find that audio captured via FFmpeg + 
AVFoundation is completely unusable. The resulting output is pitch shifted, 
riddled with pops and clicks, etc.

It doesn't seem to matter what codecs (aac, mp3, pcm_f32le, etc.) or options I 
use. Whether I'm capturing audio & video, or just audio. Whether I'm capturing 
a virtual audio device, or a standard audio device. Whether I'm using FFmpeg 
installed via Homebrew, or FFmpeg built from source/master. The result is 
always the same.

Here's an example command and its output:
./ffmpeg -y \
-thread_queue_size 9999 \
-indexmem 9999 \
-f avfoundation \
-i ":Live Gamer 4K 2.1-Audio" \
-c:a pcm_f32le \
-ar 48000 \
-ac 2 \
-vn \
~/Movies/ffmpeg-avfoundation-audio-test.wav

ffmpeg version N-119779-g6c291232cf Copyright (c) 2000-2025 the FFmpeg 
developers
built with Apple clang version 17.0.0 (clang-1700.0.13.5)
configuration: 
--prefix=/Users/ninbura/ffmpeg/builds/ffmpeg-master-comprehensive-20250531 
--cc=clang --enable-static --disable-shared --enable-pthreads --enable-version3 
--enable-gpl --enable-nonfree --enable-ffplay --enable-gnutls --enable-libaom 
--enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz 
--enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e 
--enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt 
--enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora 
--enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx 
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 
--enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype 
--enable-frei0r --enable-libass --enable-libopencore-amrnb 
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex 
--enable-libsoxr --enable-libzmq --enable-libzimg --enable-libfdk-aac 
--disable-libjack --disable-indev=jack -
 -enable-audiotoolbox --enable-videotoolbox --enable-neon 
--extra-cflags=-I/opt/homebrew/include --extra-ldflags='-L/opt/homebrew/lib 
-Wl,-ld_classic'
libavutil 60. 3.100 / 60. 3.100
libavcodec 62. 3.101 / 62. 3.101
libavformat 62. 0.102 / 62. 0.102
libavdevice 62. 0.100 / 62. 0.100
libavfilter 11. 0.100 / 11. 0.100
libswscale 9. 0.100 / 9. 0.100
libswresample 6. 0.100 / 6. 0.100
2025-05-31 17:54:12.654 ffmpeg[85023:6411645] WARNING: Add 
NSCameraUseContinuityCameraDeviceType to your Info.plist to use 
AVCaptureDeviceTypeContinuityCamera.
+++ 0x6000037900e0 0 1 424403882381791
2025-05-31 17:54:12.868 ffmpeg[85023:6411645] WARNING: 
AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras. Please use 
AVCaptureDeviceTypeContinuityCamera and add 
NSCameraUseContinuityCameraDeviceType to your Info.plist.
Input #0, avfoundation, from ':Live Gamer 4K 2.1-Audio':
Duration: N/A, start: 424404.154125, bitrate: 6144 kb/s
Stream #0:0: Audio: pcm_f32le, 48000 Hz, 4.0, flt, 6144 kb/s, Start 
424404.154125
Stream mapping:
Stream #0:0 -> #0:0 (pcm_f32le (native) -> pcm_f32le (native))
Press [q] to stop, [?] for help
Output #0, wav, to '/Users/ninbura/Movies/ffmpeg-avfoundation-audio-test.wav':
Metadata:
ISFT : Lavf62.0.102
Stream #0:0: Audio: pcm_f32le ([3][0][0][0] / 0x0003), 48000 Hz, stereo, flt, 
3072 kb/s
Metadata:
encoder : Lavc62.3.101 pcm_f32le
[out#0/wav @ 0x600003b9c180] video:0KiB audio:26116KiB subtitle:0KiB other 
streams:0KiB global headers:0KiB muxing overhead: 0.000344%
size= 26116KiB time=00:01:17.35 bitrate=2765.7kbits/s speed= 1x 
elapsed=0:01:17.36 Exiting normally, received signal 2.

Here is the resulting file:
https://drive.proton.me/urls/78BA8YCE8G#MTzDMH2cWWEA

For comparison as to how it should sound, here's a recording created using 
Ableton Live to capture audio from the same device:
https://drive.proton.me/urls/58Q12XF0XC#HZaHBD7AXVTU

Mac that I'm testing on:
Mac Studio w/ M3 Ultra & 96GB of Unified Memory | macOS v15.5

Additional Mac that I've tested on:
MacBook Pro w/ M3 Pro & 36GB of Unified Memory | macOS v15.5

I'd be grateful if anyone could point out that I'm doing something wrong, as 
that would obviously be the easiest fix. But it seems to be a bug? A fairly 
critical bug I would think... doesn't appear that there's any other method of 
capturing audio via FFmpeg on macOS.

A bit unsure as to how I should proceed, I found a ticket on trac.ffmpeg.org 
from 10 years ago (https://trac.ffmpeg.org/ticket/4513). But it was closed as 
duplicate with no link to the duplicate issue. Should I open a new issue there?

I would appreciate any advice regarding how to resolve this.
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to