none
How do you capture desktop audio using DirectShow?

    Вопрос

  • I'm new to using DirectShow so please excuse my newbie question, but I couldn't seem to find the answer anywhere on the forums or in the Microsoft DirectShow documentation.

    I'd like to capture the desktop audio ( i.e. if a game is running, I'd like to record the audio it's producing) and write it out to an avi file, but I can't seem to set up the filter graph correctly using GraphEdit because the avi file produced is the correct length, but there is nothing audible.

    Here's a run down of the filters in my GraphEdit setup
    1)  SigmaTel Audio - Capture Source
    2)  AVI Mux
    3)  Filewriter

    The graph is setup like:
    SigmaTelAudio -> AVI Mux -> Filewriter

    Questions regarding my setup

    1) The SigmaTel Audio filter is the only filter that shows up under the Audio Capture Sources category, so I assume that all the sounds being produced will eventually be routed through the SigmaTelAudio filter and should be able to be captured.  Perhaps I am mistaken about this.

    2) If the SigmaTel Audio filter is not actually my sound card, do I have to create a custom audio capture filter that would have its buffer filled by the desired audio source?

    3) I guess my most important question is: Is there a central place where all audio must pass before it is outputed to external devices like speakers or headphone?  If such a place exists, it would be the ideal place to capture audio.

    Thank you in advance for your help.
    Tim
    29 ноября 2007 г. 0:32

Ответы

  • You have to ensure that your sound card driver supports Stereo Mix and enable it from the sound settings. This then captures any audio that parses over the sound card. (Wave Out).

     

    29 ноября 2007 г. 20:28
  •  drewdb wrote:

    I may be wrong but i believe that all sound cards have that ability. it depends on whether the driver enables it or not. I had a laptop with a sigmatel (not sure which one) and it wasn't enabled. my boss wanted me to program an audio recording program so i googled and found a device driver that enabled the stereo mix. may be worth having a look out there before you outlay money?



    Yeah, you're absolutely right, I was able to find SigmaTel drivers that supported Stereo Mix, although the drivers were originally intended for SigmaTel sound cards in laptops. 

    Please note that I've only got these drivers working on my Dell Precision 380, so I'm not sure if they work on other computers Dell or not.

    Here's a link to the instructions that I followed to enable Stereo Mix on my sound card.

    http://www.ekhoury.com/2006/08/25/sigmatel-stereo-mix-support-for-dells/


    3 декабря 2007 г. 20:24

Все ответы

  • Hi Tim,
    I'm still quite new at this as well and I could be mistaken, but from my understanding the sound will not be routed through the SigmaTel Audio filter. I don't think e.g the game would have any reason to load a DS Capture source and send it's audio through it. Recording software would load an audio capture source, since that is the goal of the software and that functionality is explicitly coded into the software. Keep in mind that the sound card when used in the context of a capture source is an input device. What you're looking for is to insert some kind of capture device which you can insert before the output of the software.

    I remember building an example a while ago which recorded whatever was on the screen and wrote it to file. Maybe that would be a good starting point since it does the same thing with video as you want to do with audio. Does anyone else remember the name of the example?
    29 ноября 2007 г. 8:21
  • Found it Wink
    It's the Filter Graph library available at THM's website. The ScrnCap exe allows you to capture Screen and Sound so I guess this must be pretty much what you looking for (or at least a starting point)
    29 ноября 2007 г. 9:25
  • You have to ensure that your sound card driver supports Stereo Mix and enable it from the sound settings. This then captures any audio that parses over the sound card. (Wave Out).

     

    29 ноября 2007 г. 20:28

  • Hi Ralf,

    Thanks for your suggestions.  It's interesting that you mention the Filter Graph lib from THM's website, because I used it as the basis for my custom video capture filter, although I still need to figure out this whole desktop audio capture thing.

    I've been playing with the ScreenCap.exe example and under the Audio Input Line category the only options listed are
    1) Line in
    2) Rear Mic
    3) Microphone

    I'm not really sure what "Line in" means, but it looks like there is no global sound equivalent which could be used to capture all the sound being produced by ever application.

    I guess what I have to do is create a custom audio capture filter that will have its audio buffer filled by our game's sound engine (FMOD in this case).

    Thanks again for your help.  I'll continue looking into ways of doing some sort of global audio capture.

    -Tim
    29 ноября 2007 г. 20:31

  • Unfortunately I don't think that my sound card is high end enough to contain any Stereo Mix features.

    I looked for the Stereo Mix option under the "Sound and Audio Devices" category in Windows XP, but I couldn't find anything that looked remotely similar.

    Perhaps I'm not looking in the right place, but I wouldn't be surprised if my SigmaTel Audio card wasn't fully featured because it was the cheap default that came with the computer.

    Does anyone have any suggestions for higher end sound cards that would be useful and have the Stereo Mix feature?

    Thanks again,
    Tim
    29 ноября 2007 г. 21:22
  • I may be wrong but i believe that all sound cards have that ability. it depends on whether the driver enables it or not. I had a laptop with a sigmatel (not sure which one) and it wasn't enabled. my boss wanted me to program an audio recording program so i googled and found a device driver that enabled the stereo mix. may be worth having a look out there before you outlay money?

    30 ноября 2007 г. 9:54
  •  drewdb wrote:

    I may be wrong but i believe that all sound cards have that ability. it depends on whether the driver enables it or not. I had a laptop with a sigmatel (not sure which one) and it wasn't enabled. my boss wanted me to program an audio recording program so i googled and found a device driver that enabled the stereo mix. may be worth having a look out there before you outlay money?



    Yeah, you're absolutely right, I was able to find SigmaTel drivers that supported Stereo Mix, although the drivers were originally intended for SigmaTel sound cards in laptops. 

    Please note that I've only got these drivers working on my Dell Precision 380, so I'm not sure if they work on other computers Dell or not.

    Here's a link to the instructions that I followed to enable Stereo Mix on my sound card.

    http://www.ekhoury.com/2006/08/25/sigmatel-stereo-mix-support-for-dells/


    3 декабря 2007 г. 20:24
  • It's funny, now looking at that post, it's the same one i found ages ago when i needed it. I would say that if some computers come with Stereo Mix dissabled and a driver can unlock it, logic would suggest to me that all sound cards have that ability. I guess it's just a matter of finding a driver (be it the brand or not) that works. Don't you just love the internet Smile All you need do now is itterate the output pins for the stereo mix pin and connect it up. I have found though that the quality of the recording be it WAV or MP3 was a bit tinnier than the original so some sound processing filters come in very handy.

     

    4 декабря 2007 г. 6:22
  • Try this:

     

    Open Sound properties, Recording tab... one way is through Control Panel, or right-click on your system tray Volume icon and choose Recording Devices.

     

    In the device pane, right click and select "Show Disabled Devices".  If Stereo Mix, Wave-Out Mix, Wave, What U Hear, or something similar appears, do a little happy-dance, then right click on that entry and choose enable!!!

     

    [Windows Vista OS... you may also have to set this device as the default]

    1 января 2008 г. 22:45
  • THNX. didnt' know this. worked with QT audio recording
    4 декабря 2009 г. 7:27
  • if you don't have waveout as an option, I made this dshow input device:

    https://github.com/rdp/virtual-audio-output-sniffer

    24 апреля 2012 г. 20:17