Skip to content

audio_mixing parameter (DUAL_CHANNEL_AGENT / DUAL_CHANNEL_ALTERNATE) not working in RoomCompositeEgress - both channels contain identical mixed audio #4462

@sperdices

Description

@sperdices

Bug Description

Description

The audio_mixing parameter in RoomCompositeEgressRequest is not being applied by the egress service. When setting audio_mixing=DUAL_CHANNEL_AGENT or audio_mixing=DUAL_CHANNEL_ALTERNATE, the resulting recording still contains identical mixed audio in both L and R channels instead of separating the audio streams.

Code

from livekit.protocol.egress import (
RoomCompositeEgressRequest,
EncodedFileOutput,
EncodedFileType,
AudioMixing,
)

req = RoomCompositeEgressRequest(
room_name=room_name,
layout="speaker",
audio_only=True,
audio_mixing=AudioMixing.DUAL_CHANNEL_AGENT,
file_outputs=[file_output],
)

info = await api.egress.start_room_composite_egress(req)

Evidence

The server acknowledges receiving the audio_mixing parameter correctly.

Waveform analysis of the output file shows both channels contain identical audio:

Image
  • Top (Red) = Left channel
  • Bottom (Green) = Right channel
  • Both waveforms are identical, proving no channel separation occurred

Expected Behavior

According to the documentation and protocol definition:

DUAL_CHANNEL_AGENT:

  • Left channel: Agent audio only
  • Right channel: All other participants' audio

DUAL_CHANNEL_ALTERNATE:

  • Each new audio track alternates between left and right channels

Actual Behavior

Both L and R channels contain the same mixed audio (all participants mixed together), regardless of which AudioMixing mode is set.

Additional Context

  • Tested with both AudioMixing.DUAL_CHANNEL_AGENT and AudioMixing.DUAL_CHANNEL_ALTERNATE - same issue
  • The EgressInfo response confirms the server received audio_mixing=1, so the parameter is being transmitted correctly
  • The agent's ParticipantKind is correctly set to 4 (AGENT)
  • The implementation in pkg/pipeline/builder/audio.go checks ParticipantKind == ParticipantAgent to determine channel routing

Reproduction Steps

1. Start a room composite egress with `audio_mixing=DUAL_CHANNEL_AGENT` and `audio_only=True`
2. Have an agent (ParticipantKind=AGENT) and a regular participant in the room
3. Both participants speak
4. Stop the egress and examine the resulting audio file

Operating System

macOS

Models Used

No response

Package Versions

deployed in livekit cloud
 
livekit-agents: 1.3.10

Session/Room/Call IDs

No response

Proposed Solution

Additional Context

No response

Screenshots and Recordings

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions