acceptable-dream-85180
07/30/2025, 5:57 PMtall-airline-16756
07/30/2025, 5:57 PMtall-airline-16756
07/30/2025, 5:58 PMfrom livekit import api
# Set up recording request
req = api.RoomCompositeEgressRequest(
room_name="my-room",
layout="speaker",
preset=api.EncodingOptionsPreset.H264_720P_30,
audio_only=False, # Set to True for audio-only recording
# Configure output destination (cloud storage required)
)
# Start recording
lkapi = api.LiveKitAPI()
res = await lkapi.egress.start_room_composite_egress(req)
Note: Recording requires access to a cloud storage provider to upload the recording files. Supported providers include:
• Amazon S3 and S3-compatible storage
• Google Cloud Storage
• Azure Blob Storage
Available methods for recording include:
• start_room_composite_egress() - Composite recording of a room
• start_participant_egress() - Recording of a participant
• start_track_egress() - Recording of a single track
• start_track_composite_egress() - Composite recording with audio and video tracks
• stop_egress() - Stop an active recording
• list_egress() - List active and recent recordings
Let me know if you need further details on any specific recording method or setup!
Sources: Session recording and transcripts | LiveKit Docs | livekit-api/livekit/api/egress_service.py | Recording agent sessions | LiveKit Docsacceptable-dream-85180
07/30/2025, 6:00 PMtall-airline-16756
07/30/2025, 6:01 PMstart_room_composite_egress()
• Participant Recording: Focuses on recording a specific participant with start_participant_egress()
• Track Composite Recording: Records composite audio and video tracks via start_track_composite_egress()
• Individual Track Recording: Records just a single track using start_track_egress()
Here’s a simple example of setting up video recording with the livekit-api package:
from livekit import api
# Create LiveKit API client
lkapi = api.LiveKitAPI()
# Set up room composite recording
req = api.RoomCompositeEgressRequest(
room_name="my-room",
layout="speaker",
preset=api.EncodingOptionsPreset.H264_720P_30,
audio_only=False, # Switch to True if you want audio-only recording
# Don’t forget to configure your output destination (cloud storage needed)
)
# Start the recording
res = await lkapi.egress.start_room_composite_egress(req)
Just a couple of things to keep in mind:
• You’ll need access to a cloud storage provider like Amazon S3, Google Cloud Storage, or Azure Blob Storage to save your recordings
• Make sure you have the right authentication credentials set up for your storage provider
The recording kicks off as soon as participants join the room, capturing all the audio and video shared, and it wraps up automatically when everyone leaves. Pretty handy, right?
Sources: livekit-api/livekit/api/egress_service.py | Session recording and transcripts | LiveKit Docs | Recording agent sessions | LiveKit Docsacceptable-dream-85180
07/30/2025, 6:11 PMtall-airline-16756
07/30/2025, 6:12 PMegress field to either record the whole room as a composite or capture each published track separately. This setup only needs to be done once during room creation, and then recording kicks off automatically.
Here’s a simple example showing how to configure auto egress to record all tracks to S3 when creating a room:
{
"name": "my-room",
"egress": {
"tracks": {
"filepath": "bucket-path/{room_name}-{publisher_identity}-{time}",
"s3": {
"access_key": "",
"secret": "",
"bucket": "mybucket",
"region": ""
}
}
}
}
Another option: If you’d rather have more control, you can always start recording manually after the room is created using the egress API. For example, you might start a room composite recorder when participants join the room.
Using auto egress makes things easier by taking away the hassle of setting up recording every time, since the configuration happens automatically during room creation.acceptable-dream-85180
07/30/2025, 6:35 PMtall-airline-16756
07/30/2025, 6:38 PMacceptable-dream-85180
07/30/2025, 6:57 PM{
"name": "my-room",
"egress": {
"tracks": {
"filepath": "bucket-path/{room_name}-{publisher_identity}-{time}",
"s3": {
"access_key": "",
"secret": "",
"bucket": "mybucket",
"region": ""
}
}
}
}
But it saved all tracks separately