rapid-van-16677
01/01/2026, 8:42 AMtall-airline-16756
01/01/2026, 8:42 AMtall-airline-16756
01/01/2026, 8:42 AMBucket name
◦ Region
◦ AWS AccessKey and Secret (or use injected/instance credentials for production)
◦ Filepath (path/name to write, you can include variables like ${room_name}_${time})
Example fields: FileType: MP4, Filepath: recordings/${room_name}_${time}, S3: {AccessKey, Secret, Bucket, Region}
1. (Optional) Automate: listen for room_started webhook and trigger StartRoomCompositeEgress; handle egress_ended webhook to get final S3 location/metadata.
Notes and best practices:
• Egress is started from the server side only (not from client JS).
• For single participant recordings, use Track Composite (synchronized A/V) or Track Egress for raw track files; both support S3 outputs similarly.
• Don’t hardcode AWS keys in code—use environment variables, IAM roles, or secret management for production.
• Ensure the credentials you provide have S3 write permissions for the target bucket.
If you’d like, tell me:
• Which SDK/language you use (Go, Node, Python),
• Whether you want Room Composite or Track Egress,
and I’ll provide a concrete code example and the exact request payload.
Sources: Universal Egress | server-sdk-js | livekit/livekit_composite | DeepWikirapid-van-16677
01/01/2026, 8:48 AMtall-airline-16756
01/01/2026, 8:48 AMrapid-van-16677
01/01/2026, 8:49 AMtall-airline-16756
01/01/2026, 8:49 AM# install: pip install livekit-api-client # or your project's LiveKit Python SDK package
import asyncio
from livekit import LiveKitAPI
from livekit import RoomCompositeEgressRequest, EncodedFileOutput, S3Upload
async def start_audio_room_recording():
api = LiveKitAPI(
url="<https://YOUR_LIVEKIT_HOST>", # your LiveKit host (https)
api_key="YOUR_API_KEY",
api_secret="YOUR_API_SECRET",
)
req = RoomCompositeEgressRequest(
room_name="your-room-name",
audio_only=True, # mix all participant audio into one stream
file_outputs=[
EncodedFileOutput(
file_type="OGG", # Opus in OGG container (good for audio/voice)
filepath="recordings/call_${room_name}_${time}.ogg",
s3=S3Upload(
access_key="YOUR_S3_ACCESS_KEY",
secret="YOUR_S3_SECRET",
region="us-east-1",
bucket="your-s3-bucket-name",
),
)
],
)
resp = await api.egress.start_room_composite(request=req)
print("egress_id:", resp.egress_id)
# optional: poll status
status = await api.egress.get_egress(egress_id=resp.egress_id)
print("state:", status.state)
if __name__ == "__main__":
asyncio.run(start_audio_room_recording())
Notes and best practices
• Set audio_only=True to get a mixed single audio file of the room.
• OGG with Opus is recommended for voice; you can choose other formats supported by the SDK.
• Provide S3 credentials in the egress request, or prefer environment/instance credentials or an IAM role instead of hardcoding.
• Start egress from your server (not client-side).
• Use webhooks: start recording on room_started and check egress_ended for final metadata (S3 path).
• Ensure the IAM credentials used have S3 PutObject permission for the target bucket.
If you want, I can:
• Provide the exact pip package name and imports if your project uses a specific LiveKit Python SDK version.
• Show how to trigger this automatically from a room_started webhook and parse the egress_ended webhook to get the final S3 URL. Which would you prefer? Sources: Universal Egress | sip | livekit/livekit_composite | DeepWiki | Python SDKs | livekit/livekit_composite | DeepWiki