how to configure livekit cloud egress recording se...
# ask-ai
p
how to configure livekit cloud egress recording service and manage its lifecycle?
t
Thanks for reaching out, Abijah. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you’re asking how to configure LiveKit Cloud Egress recording and how to manage its lifecycle. I’ll summarize the main options and the exact actions you can take (start/update/list/stop), then ask one quick question so I can tailor any example to your setup. Overview — which egress types to choose • Room Composite: records an entire room with a rendered layout (grid, speaker, single-speaker, etc.). Good for full-session recordings (MP4, HLS, thumbnails). • Track Composite: exports synchronized audio+video using track IDs (useful when you need combined tracks but not full room layout). • Participant: record a specific participant by identity (optionally capture screen share). • Track: export a single raw track (no transcoding). • Web: record any web page via a URL (headless browser render). How to configure (what you must provide) • Identify egress type and room/track/identity or URL. • Choose outputs: file (S3/GCP/Azure/OSS), segment/HLS, stream (RTMP), or images. • Provide storage credentials and destination (bucket/container, region, keys) in the egress request. • Select encoding preset if needed (e.g., H264_720P_30). Basic JSON fields you’ll use • Room Composite:
room_name
,
layout
,
preset
,
file_outputs
/
segment_outputs
/
stream_outputs
. • Track Composite:
room_name
,
audio_track_id
,
video_track_id
,
file_outputs
. • Participant:
room_name
,
identity
,
screen_share
, output arrays. • Track:
room_name
,
track_id
,
file
(S3/GCP/Azure). • Web:
url
,
preset
, outputs. Start egress • CLI example: a. Create an egress JSON config (see fields above). b. Run:
lk egress start --type room-composite egress.json
• SDK / Twirp: call the corresponding Start*Egress RPC (StartRoomCompositeEgress, StartTrackEgress, etc.). • Ensure the access token includes
roomRecord
permission. Update an active egress • Change layout (Room Composite): ◦ CLI:
lk egress update-layout --id <egress_id> --layout speaker
◦ SDK/API: call UpdateLayout for the active egress. • Modify streaming targets: ◦ Add/remove RTMP URLs with
UpdateStream
(CLI or API). List active egresses • CLI:
lk egress list
• API: call
ListEgress
to get active jobs and their IDs/status. Stop egress • CLI:
lk egress stop --id <egress_id>
• API: call
StopEgress
with the egress ID. Auto-Egress (start recording when room is created) • Include an
egress
block in
CreateRoom
specifying room/tracks outputs to automatically start recording on room creation. Storage backends supported • S3-compatible (S3, MinIO, R2), GCP, Azure Blob, AliOSS — include respective credentials in the output config. Permissions & notes • All egress operations require appropriate API credentials and an access token with
roomRecord
. • You can use CLI, SDKs (Go/JS/Python), or Twirp HTTP API depending on your integration. Would you like: • A ready-to-use example JSON for a specific egress type (Room Composite → S3, RTMP stream, or HLS)? • Instructions for generating an access token with
roomRecord
? • A sample CLI or SDK call in a specific language (Go/JS/Python)? Tell me which egress type and output you plan to use and I’ll send a tailored example. Sources: Egress examples | LiveKit docs | RoomComposite Egress | LiveKit Docs | Egress API | LiveKit docs | Recording participants | LiveKit docs | Track egress | LiveKit docs
p
I'm interested in room egress, it seems to be always recording even if I specifically start recording when the call is already ongoing, where could this behavior come from?
t
Thanks — I’m looking into why Room Composite egress appears to always be recording even when you explicitly start it mid-call. A few likely causes and quick checks will narrow this down. Quick checks (please confirm these) • Do you set an
egress
block in your
CreateRoom
request (auto‑egress)? If yes, auto‑egress will start recording when the room is created. • Are you using any server or orchestration process that calls
StartRoomCompositeEgress
automatically on room events (room.created or participant.join)? • When you inspect active egresses (
lk egress list
or
ListEgress
), do you see an egress started earlier than your manual start time? If so, note its
egress_id
and `reason`/`start_time`. • Is your client using a long‑lived access token with
roomRecord
that a background job might reuse? What this behavior usually means • If auto‑egress is enabled in
CreateRoom
, recordings start automatically on room creation — so a later manual start looks redundant because an active egress already exists. • If a server process listens to room events and starts egress automatically, that will also make egress always active. • A previously started egress not stopped (or restarted by automation) will remain active until explicitly stopped or completed. Immediate actions to confirm/resolve 1. Check room creation code/config for an
egress
block and remove/disable it if you want manual starts only. 2. Run
lk egress list
or call
ListEgress
and compare
start_time
and
type
to your manual starts to find the originating job. 3. Search your backend for any automated calls to
StartRoomCompositeEgress
(webhooks, event handlers). 4. If you find an auto egress you don’t want, stop it with
lk egress stop --id <egress_id>
. If you’d like, share: • Whether you use
CreateRoom
with an
egress
section, or • The output of
lk egress list
(egress IDs and start times), or • A snippet of how you start recording (CLI/SDK/Twirp JSON) I can then point to the exact field or line to change and give a tailored example to disable the automatic recording.