[FFmpeg-trac] #9420(avdevice:new): DirectShow (dshow) audio input limited to 44.1 kHz / 16-bit

FFmpeg trac at avcodec.org
Tue Sep 14 03:26:49 EEST 2021


#9420: DirectShow (dshow) audio input limited to 44.1 kHz / 16-bit
-------------------------------------+-------------------------------------
             Reporter:  Brad Isbell  |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avdevice     |                  Version:  git-
             Keywords:  dshow        |  master
  directshow audio                   |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Most sound cards support sample rates of 48 kHz and above, with bit depths
 often 24-bit, some even higher.  Yet, when using FFmepg to capture from
 these devices via DirectShow (`dshow`) input, FFmpeg doesn't support
 higher than 16-bit and 44.1 kHz.

 For example, here's a sound device that supports 2 channels at 96 kHz,
 32-bit, but `-list_devices=true` says otherwise:

 {{{
 ffmpeg -v 9 -loglevel 99 -f dshow -list_options true -i audio="DVS Receive
 1-2 (Dante Virtual Soundcard)"
 ffmpeg version 2021-09-11-git-3e127b595a-essentials_build-www.gyan.dev
 Copyright (c) 2000-2021 the FFmpeg developers
   built with gcc 10.3.0 (Rev5, 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-zlib
 --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth
 --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-
 libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-
 libass --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-libgme --enable-libopenmpt
 --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora
 --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb
 --enable-libopus --enable-libspeex --enable-libvorbis --enable-
 librubberband
   libavutil      57.  5.100 / 57.  5.100
   libavcodec     59.  7.103 / 59.  7.103
   libavformat    59.  5.100 / 59.  5.100
   libavdevice    59.  0.101 / 59.  0.101
   libavfilter     8.  9.100 /  8.  9.100
   libswscale      6.  1.100 /  6.  1.100
   libswresample   4.  0.100 /  4.  0.100
   libpostproc    56.  0.100 / 56.  0.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'dshow'.
 Reading option '-list_options' ... matched as AVOption 'list_options' with
 argument 'true'.
 Reading option '-i' ... matched as input url with argument 'audio=DVS
 Receive  1-2 (Dante Virtual Soundcard)'.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Successfully parsed a group of options.
 Parsing a group of options: input url audio=DVS Receive  1-2 (Dante
 Virtual Soundcard).
 Applying option f (force format) with argument dshow.
 Successfully parsed a group of options.
 Opening an input file: audio=DVS Receive  1-2 (Dante Virtual Soundcard).
 [dshow @ 0000026f4e2bd880] DirectShow audio only device options (from
 audio devices)
 [dshow @ 0000026f4e2bd880]  Pin "Capture" (alternative pin name "Capture")
 [dshow @ 0000026f4e2bd880]   min ch=1 bits=8 rate= 11025 max ch=2 bits=16
 rate= 44100
     Last message repeated 22 times
 [dshow @ 0000026f4e2bd880] Selecting pin Capture on audio only
 audio=DVS Receive  1-2 (Dante Virtual Soundcard): Immediate exit requested
 }}}

 If you try to set 48 kHz as a sample rate anyway, you get the error,
 "Could not set audio only options":

 {{{
 ffmpeg -v 9 -loglevel 99 -f dshow -ar 48000 -i audio="DVS Receive  1-2
 (Dante Virtual Soundcard)"
 ffmpeg version 2021-09-11-git-3e127b595a-essentials_build-www.gyan.dev
 Copyright (c) 2000-2021 the FFmpeg developers
   built with gcc 10.3.0 (Rev5, 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-zlib
 --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth
 --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-
 libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-
 libass --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-libgme --enable-libopenmpt
 --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora
 --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb
 --enable-libopus --enable-libspeex --enable-libvorbis --enable-
 librubberband
   libavutil      57.  5.100 / 57.  5.100
   libavcodec     59.  7.103 / 59.  7.103
   libavformat    59.  5.100 / 59.  5.100
   libavdevice    59.  0.101 / 59.  0.101
   libavfilter     8.  9.100 /  8.  9.100
   libswscale      6.  1.100 /  6.  1.100
   libswresample   4.  0.100 /  4.  0.100
   libpostproc    56.  0.100 / 56.  0.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'dshow'.
 Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
 (in Hz)) with argument '48000'.
 Reading option '-i' ... matched as input url with argument 'audio=DVS
 Receive  1-2 (Dante Virtual Soundcard)'.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Successfully parsed a group of options.
 Parsing a group of options: input url audio=DVS Receive  1-2 (Dante
 Virtual Soundcard).
 Applying option f (force format) with argument dshow.
 Applying option ar (set audio sampling rate (in Hz)) with argument 48000.
 Successfully parsed a group of options.
 Opening an input file: audio=DVS Receive  1-2 (Dante Virtual Soundcard).
 [dshow @ 00000260e12bd800] Could not set audio only options
 [dshow @ 00000260e12bd800] Searching for audio device within video devices
 for DVS Receive  1-2 (Dante Virtual Soundcard)
 [dshow @ 00000260e12bd800] Could not find audio only device with name [DVS
 Receive  1-2 (Dante Virtual Soundcard)] among source devices of type
 video.
 audio=DVS Receive  1-2 (Dante Virtual Soundcard): I/O error
 }}}

 This problem happens regardless of what sound device I use.  I know these
 devices support 48 kHz, because that's the sample rate I'm currently
 running at.  Windows also shows me in the control panel (mmsys.cpl):

 [[Image(https://i.imgur.com/Xeeyw9i.png)]]

 I know that these higher sample rates are supported on these devices via
 DirectSound because Audacity (which uses PortAudio internally) is able to
 record at these higher sample rates.

 So, as best as I can tell, the problem lies somewhere in the FFmpeg
 implementation, but while skimming through the relevant code I did not see
 anything obvious.  Anyone familiar with the details of DirectShow might
 have an idea?

 Some related external posts:

  - https://stackoverflow.com/q/68298723/362536
  - https://superuser.com/q/1638424/48624
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9420>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list