[FFmpeg-user] Audio captured via AVFoundation is unusable

FFmpeg ffmpeg at ninbura.com
Fri Jun 6 11:13:59 EEST 2025


> Diff patch attached. Use `git apply` .
> 
> Initially test with
> 
> -f avfoundation \
> -audio_probe_wait 2 \
> -i ... \
> 
> 
> Check till values of 15 or so.

Thank you for the patch Gyan, I applied it, verified that the changes applied in the libavdevice/avfoundation.m file, and rebuilt. Unfortunately the result is the same. Even with an extreme audio_probe_wait value of 500 the result is unaffected.

I started with 2 as you requested, incrementing by one each run. After I hit 15 with no change I set it to 500 to see if I could witness the delay in the command's startup, which was fairly obvious.

Command:
./ffmpeg -y \
  -thread_queue_size 9999 \
  -indexmem 9999 \
  -f avfoundation \
  -audio_probe_wait 500 \
  -i ":Elgato 4K X" \
  -c:a pcm_f32le \
  -ar 48000 \
  -ac 2 \
  -vn \
  ~/Movies/avfoundation-audio_probe_wait-test.wav

Result:
https://drive.proton.me/urls/VXH108YTY4#mDRx4NCHyGlO

Full output:
./ffmpeg -y \
  -thread_queue_size 9999 \
  -indexmem 9999 \
  -f avfoundation \
  -audio_probe_wait 500 \
  -i ":Elgato 4K X" \
  -c:a pcm_f32le \
  -ar 48000 \
  -ac 2 \
  -vn \
  ~/Movies/avfoundation-audio_probe_wait-test.wav
ffmpeg version N-119824-g17729aa80c 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-20250606-014159 --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-06-06 02:09:41.707 ffmpeg[58687:445781] WARNING: Add NSCameraUseContinuityCameraDeviceType to your Info.plist to use AVCaptureDeviceTypeContinuityCamera.
+++	0x600001afb560	0	1	9084836670208
2025-06-06 02:09:41.891 ffmpeg[58687:445781] WARNING: AVCaptureDeviceTypeExternal is deprecated for Continuity Cameras. Please use AVCaptureDeviceTypeContinuityCamera and add NSCameraUseContinuityCameraDeviceType to your Info.plist.
Input #0, avfoundation, from ':Elgato 4K X':
  Duration: N/A, start: 9090.534625, bitrate: 3072 kb/s
  Stream #0:0: Audio: pcm_f32le, 48000 Hz, stereo, flt, 3072 kb/s, Start 9090.534625
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/avfoundation-audio_probe_wait-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 @ 0x6000016c4000] video:0KiB audio:13168KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.000682%
size=   13168KiB time=00:00:39.36 bitrate=2740.7kbits/s speed=   1x elapsed=0:00:39.36    
Exiting normally, received signal 2.


More information about the ffmpeg-user mailing list