Skip to content

Application Loopback Sample is unable to record from Microsft Teams App #414

@lmengnr

Description

@lmengnr

I wanted to try making a system recording application based on the application loopback sample provided by windows classic samples. But I have observed that this code works for all processes but is unable to record from the Microsoft teams app.

I also asked a question on stack overflow: https://stackoverflow.com/questions/79832526/wasapi-application-loopback-is-unable-to-record-ms-teams

My goal is to use process loopback (via AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK) so that I can capture the system mix through the Windows audio engine.

In my main use case I want to record audio from all applications except my own app, so I’m using PROCESS_LOOPBACK_MODE_EXCLUDE_TARGET_PROCESS_TREE. I have also tested with PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE just to rule that out.

What Works

Using the ApplicationLoopback approach with VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK, my capture app successfully records audio for:

  • Slack
  • Zoom
  • Google Meet in Chrome/Edge
  • Microsoft Teams meetings in a browser (Edge/Chrome)
  • Youtube videos in the browser

On all of these, the output WAV contains valid audio as expected.

What Fails

The problem is only with the Microsoft Teams desktop application (ms-teams.exe):

  • With process loopback (ApplicationLoopback-style):
    • The recording has the correct duration and format.
    • But the audio buffer is effectively all zeros (silence) whenever the audio source is a Teams desktop meeting.

Multiple Output streams for Microsoft Teams

One strange thing I have observed is that the Microsoft teams app has two output streams shown.

I wrote a small diagnostic tool that enumerates audio sessions for a given process using IAudioSessionManager2 and reads the peak levels via IAudioMeterInformation.

For the output device used by Teams during a meeting, I see the following:

  • Two render sessions for ms-teams.exe on the same render device, plus one capture session.
  • Both render sessions:
    • Have the same process ID (ms-teams.exe).
    • Show non-zero peak and average levels while meeting audio is playing.
    • Often have identical or very similar metering values.

For example (simplified sample output):

// Source - https://stackoverflow.com/q/79832526
// Posted by fahdIm
// Retrieved 2025-12-03, License - CC BY-SA 4.0

Session [0]:
  Session GUID:     {0.0.0.00000000}.{6474f13d-839f-4be8-b36c-f653233effdd}|\Dev...
  Grouping GUID:    {C82CDF72-3957-4B52-ABF2-9ACA5F8153A1}
  Samples w/ Audio: 32 / 50 (64%)
  Max Peak Level:   49.6552%
  Avg Peak Level:   12.5515%
  *** THIS SESSION HAS SIGNIFICANT AUDIO ACTIVITY ***

Session [1]:
  Session GUID:     {0.0.0.00000000}.{6474f13d-839f-4be8-b36c-f653233effdd}|\Dev...
  Grouping GUID:    {C82CDF72-3957-4B52-ABF2-9ACA5F8153A1}
  Samples w/ Audio: 32 / 50 (64%)
  Max Peak Level:   49.6552%
  Avg Peak Level:   12.642%
  *** THIS SESSION HAS SIGNIFICANT AUDIO ACTIVITY ***

I also wrote a session enumerator which lists all audio sessions opened for a device and it also shows the same thing:

// Source - https://stackoverflow.com/q/79832526
// Posted by fahdIm
// Retrieved 2025-12-03, License - CC BY-SA 4.0

=== Render Devices ===
Speakers (Realtek(R) Audio) [48000 Hz, 32-bit, 2 ch (Float)] : 0 active sessions
  ID: {0.0.0.00000000}.{357dc357-13e3-4cdb-90c9-ab54f23dedcf}
XG27ACS (Intel(R) Display Audio) [48000 Hz, 32-bit, 2 ch (Float)] : 0 active sessions
  ID: {0.0.0.00000000}.{4af2ff2a-e7bf-4a47-8de4-876e9ba2d6ce}
Speakers (Razer BlackShark V2 HS 2.4) [48000 Hz, 32-bit, 2 ch (Float)] [Default: Console, Multimedia, Communications] : 2 active sessions
  ID: {0.0.0.00000000}.{6474f13d-839f-4be8-b36c-f653233effdd}
  - ms-teams.exe PID: 10596
  - ms-teams.exe PID: 10596
CABLE Input (VB-Audio Virtual Cable) [48000 Hz, 32-bit, 2 ch (Float)] : 0 active sessions
  ID: {0.0.0.00000000}.{65fbe74c-81c9-4c39-8a75-55033aa39f4c}
CABLE In 16ch (VB-Audio Virtual Cable) [48000 Hz, 32-bit, 2 ch (Float)] : 0 active sessions
  ID: {0.0.0.00000000}.{a2a0ed57-95c3-4689-b0ff-efabb8c3efe1}

For all other apps like Slack, Zoom, Chrome, etc., I only see one render session per process on the same device in this scenario. Even if I have multiple videos playing on YouTube or through a media player like VLC, I always see only one stream per process. Here's a sample of 2 VLC sessions playing audio running simultaneously, you can see that 2 different processes:

=== Render Devices ===
Headphones (OnePlus Buds 3) [48000 Hz, 32-bit, 2 ch (Float)] [Default: Console, Multimedia, Communications] : 2 active sessions
  ID: {0.0.0.00000000}.{19c0ada4-d680-46a9-919c-dca80bee9807}
  - vlc.exe PID: 7100
  - vlc.exe PID: 5984

Device loopback works for Microsoft teams

I have observed that the device loopback ( https://learn.microsoft.com/en-us/windows/win32/coreaudio/loopback-recording ) can successfully capture the output audio from the Microsoft teams app.

What I’ve checked

  • Multiple machines (different manufacturers, different audio hardware): same behavior.
  • Different Teams versions, including at least 25306.804.4102.7193 (and slightly earlier versions): same behavior.

Repro steps

  • Start a Teams desktop meeting with remote audio playing.
  • Run the ApplicationLoopback sample targeting ms-teams.exe (both include and exclude modes tested).
  • Check the recorded wav file, the audio will be silent.
  • Repeat with Slack/Zoom/Chrome → WAV has valid audio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions