acceptable-dream-85180
08/19/2025, 8:18 PMtall-airline-16756
08/19/2025, 8:18 PMtall-airline-16756
08/19/2025, 8:19 PMacceptable-dream-85180
08/19/2025, 8:22 PMtall-airline-16756
08/19/2025, 8:23 PMimport asyncio
# Start room composite egress
room_egress_task = egress_service.start_room_composite_egress(
RoomCompositeEgressRequest(
room_name="my-room",
file_outputs=[EncodedFileOutput(filepath="room-{time}.mp4")]
)
)
# Start track egress
track_egress_task = egress_service.start_track_egress(
TrackEgressRequest(
room_name="my-room",
track_id="track-id",
file=DirectFileOutput(filepath="track-{time}.mp4")
)
)
# Wait for both to start
room_info, track_info = await asyncio.gather(
room_egress_task,
track_egress_task
)
Just a heads-up: each egress will have its own unique ID, and since they run independently, make sure your server can handle both at once. If you hit any bumps or want to chat more about this, I’m here to help!
Sources: pkg/service/egress.go | packages/livekit-server-sdk/src/EgressClient.ts | src/test/kotlin/io/livekit/server/EgressServiceClientTest.kt | livekit-api/livekit/api/egress_service.py | protobufs/livekit_egress.protoacceptable-dream-85180
08/19/2025, 8:28 PMtall-airline-16756
08/19/2025, 8:29 PMsid
field—that’s the unique ID for the track. For example: trackId = trackPublication.sid
.
• Server API: You can also use the LiveKit server API to list all participants and their tracks. This will give you the track IDs for every track in the room.
• By Name or Source: If you know the track’s name or source, you can find the track publication and then get its sid
.
If you want, I’m happy to walk you through any of these methods step-by-step—just let me know!
Sources: Universal Egress | libwebrtc/src/media_stream.rs | findMicroTrackId | LiveKit Agents | lib/src/types/track_identifier.dart | Core API primitives | LiveKit Docs