ffmpeg detects incorrect audio options for dshow Dante Via virtual audio device
I use Dante Via virtual audio device which operates in it's own Dante audio network. I'm using it's WDM audio interface not ASIO, because currently ffmpeg doesn't support it. By default Dante should operate in 24-bit and 48000 Hz mode. Windows CP shows this information correctly: enter image description here
Problem
ffmpeg identifies incorrect audio device parameters and shows only max ch=2 bits=16 rate= 44100:
ffmpeg -f dshow -list_options true -i audio="Dante Via Receive (Dante Via)"
Output:
ffmpeg version 2021-03-16-git-9383885c0d-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 68.100 / 56. 68.100
libavcodec 58.132.100 / 58.132.100
libavformat 58. 74.100 / 58. 74.100
libavdevice 58. 12.100 / 58. 12.100
libavfilter 7.109.100 / 7.109.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
[dshow @ 000002503e5daa40] DirectShow audio only device options (from audio devices)
[dshow @ 000002503e5daa40] Pin "Capture" (alternative pin name "Capture")
[dshow @ 000002503e5daa40] min ch=1 bits=8 rate= 11025 max ch=2 bits=16 rate= 44100
Last message repeated 22 times
audio=Dante Via Receive (Dante Via): Immediate exit requested
In consequence if I try to record with default settings ffmpeg provided:
ffmpeg.exe -f dshow -i audio="Dante Via Receive (Dante Via)" D:\test.mp3
my record starts to begin popping more and more becoming distorted and after 18 mins silents. Looks like this behavior indicates ffmpeg is trying to record at 44100 Hz while dshow truly outputs 48000 Hz.
Tried
Edit: options tried below with -ar option are incorrect by definition because -ar is not an option for dshow input device: http://ffmpeg.org/ffmpeg-devices.html#dshow
If I change input sample rate manually to 48000 Hz:
ffmpeg_rc.exe -f dshow -ar 48000 -i audio="Dante Via Receive (Dante Via)" D:\test.mp3
gives error:
[dshow @ 0000021fe4c0e540] Could not set audio only options
[dshow @ 0000021fe4c0e540] Searching for audio device within video devices for Dante Via Receive (Dante Via)
[dshow @ 0000021fe4c0e540] Could not enumerate audio only devices (or none found).
audio=Dante Via Receive (Dante Via): I/O error
If I change input sample rate manually to 11025 Hz:
ffmpeg_rc.exe -f dshow -ar 11025 -i audio="Dante Via Receive (Dante Via)" D:\test.mp3
Audio quality drops significantly as it should but popping and distortion starts and behaves the same.
If i try to convert sample rate of the output:
ffmpeg_rc.exe -f dshow -i audio="Dante Via Receive (Dante Via)" -ar 48000 D:\test.mp3
problem stays the same. It looks like ffdshow can't correctly understand what sample rate Dante Via is giving.
I tried several different builds.
Is this some kind of bug, limitation or my lack of knowledge how to use this tool?
This has been fixed. You should see it in builds of Git master FFmpeg in a few days.
ffmpeg -f dshow -list_options true -i audio="DVS Receive 1-2 (Dante Virtual Soundcard)"
ffmpeg version git-2021-11-03-25e34ef Copyright (c) 2000-2021 the FFmpeg developers
built with Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30136 for x64
configuration: --prefix=./../../installed --toolchain=msvc --arch=x86_64 --enable-x86asm --enable-asm --disable-shared --enable-static --enable-gpl --enable-debug=3 --extra-ldflags='-LIBPATH:./../../installed/lib/' --extra-cflags='-I./../../installed/include/ -DDSHOWDEBUG -DDEBUG -DTRACE'
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 12.100 / 59. 12.100
libavformat 59. 8.100 / 59. 8.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 16.101 / 8. 16.101
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
[dshow @ 000002637D32FBC0] DirectShow audio only device options (from audio devices)
[dshow @ 000002637D32FBC0] Pin "Capture" (alternative pin name "Capture")
[dshow @ 000002637D32FBC0] ch= 2, bits=16, rate= 44100
Last message repeated 1 times
[dshow @ 000002637D32FBC0] ch= 1, bits=16, rate= 44100
[dshow @ 000002637D32FBC0] ch= 2, bits=16, rate= 32000
[dshow @ 000002637D32FBC0] ch= 1, bits=16, rate= 32000
[dshow @ 000002637D32FBC0] ch= 2, bits=16, rate= 22050
[dshow @ 000002637D32FBC0] ch= 1, bits=16, rate= 22050
[dshow @ 000002637D32FBC0] ch= 2, bits=16, rate= 11025
[dshow @ 000002637D32FBC0] ch= 1, bits=16, rate= 11025
[dshow @ 000002637D32FBC0] ch= 2, bits=16, rate= 8000
[dshow @ 000002637D32FBC0] ch= 1, bits=16, rate= 8000
[dshow @ 000002637D32FBC0] ch= 2, bits= 8, rate= 44100
[dshow @ 000002637D32FBC0] ch= 1, bits= 8, rate= 44100
[dshow @ 000002637D32FBC0] ch= 2, bits= 8, rate= 22050
[dshow @ 000002637D32FBC0] ch= 1, bits= 8, rate= 22050
[dshow @ 000002637D32FBC0] ch= 2, bits= 8, rate= 11025
[dshow @ 000002637D32FBC0] ch= 1, bits= 8, rate= 11025
[dshow @ 000002637D32FBC0] ch= 2, bits= 8, rate= 8000
[dshow @ 000002637D32FBC0] ch= 1, bits= 8, rate= 8000
[dshow @ 000002637D32FBC0] ch= 2, bits=16, rate= 48000
[dshow @ 000002637D32FBC0] ch= 1, bits=16, rate= 48000
[dshow @ 000002637D32FBC0] ch= 2, bits=16, rate= 96000
[dshow @ 000002637D32FBC0] ch= 1, bits=16, rate= 96000
audio=DVS Receive 1-2 (Dante Virtual Soundcard): Immediate exit requested
See also:
- Trac #9420: DirectShow (dshow) audio input limited to 44.1 kHz / 16-bit
- https://github.com/FFmpeg/FFmpeg/commit/d9a9b4c877b85fea5a5bad74c3d592a756047f79