I am currently capturing a room composite egress, ...
# ask-ai
r
I am currently capturing a room composite egress, and I'd like to additionally capture a composite for just one participant. What is the best way to do this?
t
Thanks for reaching out, Riley. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're already capturing a room composite — to also capture just one participant, use either Participant Egress (recommended) or Track Composite Egress. • Participant Egress — simplest: specify the participant identity and output (file/S3). It records that participant's audio+video, handles mute/leave, and needs no track IDs. • Track Composite Egress — more control: supply explicit audio/video track IDs (tracks must be published before starting egress). Both can run alongside your Room Composite Egress without conflict. Which do you prefer — simple identity-based recording (Participant Egress) or precise track-level control (Track Composite)? If you want, tell me the participant identity or the track IDs and I’ll give the exact request example you should use. Sources: Recording participants | LiveKit docs | Universal Egress | Recording and export | LiveKit docs
r
I'm confused about how to specify which participant to record. Right now I'm specifying the egress config as part of the access token that we generate on the server:
Copy code
token = (
    livekit_api.AccessToken(api_key=config.LIVEKIT_API_KEY, api_secret=config.LIVEKIT_API_SECRET)
    .with_identity(candidate_email)
    .with_room_config(egress=livekit_api.RoomEgress(
      room=livekit_api.RoomCompositeEgressRequest()
      # participant=??? What should this be?
    ))
)
I do not see any fields in the
AutoParticipantEgress
config that specify what participant to record
t
You're right to look at the token config — but Participant Egress cannot be started via the access token's auto-egress. The access-token RoomConfiguration supports auto room or track egress, but it doesn't let you target a specific participant identity. To record one participant, call the server-side API after the participant is in the room. Use StartParticipantEgress and supply the room name and the participant's identity. Example (Python-style):
Copy code
from livekit.api import ParticipantEgressRequest

info = await lkapi.egress.start_participant_egress(
    ParticipantEgressRequest(
        room_name="my-room",
        identity="participant-to-record",
        # add Output (file/S3) and other options here
    )
)
If you prefer auto-start behavior for room/track composites, keep that in the token; for selective participant recording, start Participant Egress from your backend when you want the individual recording to begin. Do you want the exact request fields for file vs S3 output or help wiring this into your existing backend call? Sources: Auto egress | LiveKit docs | Egress examples | LiveKit docs
r
Please show me what a TWIRP client request to start a participant egress would look like
t
You're asking for a TWIRP client request example to start Participant Egress. Below is a minimal working HTTP/TWIRP JSON request you can send to the LiveKit Egress service. Replace host, token, room and identity values and add your desired output config. HTTP request: POST https://<your-livekit-host>/twirp/livekit.Egress/StartParticipantEgress Content-Type: application/json Authorization: Bearer <YOUR_ACCESS_TOKEN> JSON body: { "room_name": "my-room", "identity": "participant-identity", "audio_only": false, "video_only": false, "file_outputs": [ { "filepath": "recordings/my-room/participant-identity.mp4", "s3": { "access_key": "YOUR_S3_ACCESS_KEY", "secret": "YOUR_S3_SECRET", "bucket": "your-bucket", "region": "us-east-1" } } ], "preset": "H264_720P_30" } Notes: • The request must be sent as a POST to the TWIRP endpoint path shown. • The Authorization bearer token needs the roomRecord permission. • You can replace
file_outputs
with
stream_outputs
,
segment_outputs
, or
image_outputs
as needed. • Set
audio_only
or
video_only
to true if you want only one media type. Would you like the same example using a different output (GCP/Azure) or with
audio_only
/
video_only
enabled? Sources: Egress API | LiveKit docs | Recording participants | LiveKit docs | Egress output types | LiveKit docs
r
Thank you. How does auto participant egress work? We only expect our rooms to have one human participant, one agent participant, and an egress participant. Given that we will only have 1 human participant, can we use auto participant to only capture that participant's audio? Or will that also record the agent's audio?
t
You're welcome. To answer your question directly: • There is no "auto participant egress" that will automatically record a selected role. Participant Egress must be started explicitly and is targeted by the participant's identity. • If you want to record only the human participant in a room containing human, agent, and egress participants, call StartParticipantEgress with the human participant's identity. That egress will capture only that identity's tracks — it will not record the agent's audio if you do not start egress for the agent. • To capture audio-only for that human, set
audio_only: true
(or
video_only: true
as needed) in the Participant Egress request. Example JSON body for a TWIRP StartParticipantEgress call: POST https://<your-livekit-host>/twirp/livekit.Egress/StartParticipantEgress Authorization: Bearer <YOUR_ACCESS_TOKEN> Content-Type: application/json { "room_name": "my-room", "identity": "human-identity", "audio_only": true, "file_outputs": [ { "filepath": "recordings/my-room/human-identity-audio.mp4", "s3": { /* your S3 config */ } } ] } • Implementation notes: ◦ The backend must call StartParticipantEgress (you cannot configure this per-participant via the access token). ◦ The egress will wait for that participant to join and publish before recording. ◦ Run this alongside your Room Composite Egress; they do not conflict. Would you like a concrete TWIRP example with your expected S3 fields or the exact Python/RPC client code to call StartParticipantEgress? Sources: Auto egress | LiveKit docs | Recording participants | LiveKit docs | How to set a fixed participant for agent audio processing