microsoft / microsoft/Windows-classic-samples

Application Loopback Sample is unable to record from Microsft Teams App

Open
#414 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
5.7k
Forks
3.3k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Windows classic samples ApplicationLoopback sample and reproduce the reported silence with a Microsoft Teams desktop meeting, testing both include and exclude process-loopback modes. Compare the result with device loopback and inspect the Teams render sessions using the IAudioSessionManager2 and IAudioMeterInformation diagnostics described in the issue. Done means identifying the cause of the silent capture or establishing the limitation clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.