```req = api.RoomCompositeEgressRequest( room_...
# ask-ai
e
Copy code
req = api.RoomCompositeEgressRequest(
    room_name=self.room_name,
    audio_only=True,
    file_outputs=[
        api.EncodedFileOutput(
            file_type=api.EncodedFileType.MP4,
            filepath=filepath,
            s3=api.S3Upload(
                bucket=os.getenv("EGRESS_AWS_BUCKET_NAME"),
                region=os.getenv("EGRESS_AWS_REGION"),
                access_key=os.getenv("EGRESS_AWS_ACCESS_KEY_ID"),
                secret=os.getenv("EGRESS_AWS_SECRET_ACCESS_KEY"),
            ),
        )
    ],
)
What config should i add to record video not just audio in egress ?
t
Thanks for reaching out, Aditya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're setting
audio_only=True
, which disables video. Remove it or set it to False so both audio and video are recorded. Example:
Copy code
req = api.RoomCompositeEgressRequest(
    room_name=self.room_name,
    audio_only=False,   # remove or set False to enable video
    file_outputs=[
        api.EncodedFileOutput(
            file_type=api.EncodedFileType.MP4,  # MP4 supports video + audio
            filepath=filepath,
            s3=api.S3Upload(
                bucket=os.getenv("EGRESS_AWS_BUCKET_NAME"),
                region=os.getenv("EGRESS_AWS_REGION"),
                access_key=os.getenv("EGRESS_AWS_ACCESS_KEY_ID"),
                secret=os.getenv("EGRESS_AWS_SECRET_ACCESS_KEY"),
            ),
        )
    ],
)
Want the composite layout (grid, speaker, or custom) or specific video resolution/framerate options? I can show those next. Sources: RoomComposite Egress | LiveKit Docs
e
Yeah, the grid layout, where everyone speaks like a meeting at a low config to save costs.
t
Great — to record a meeting-style grid with both audio and video while keeping costs low, use the
grid
layout and lower the output resolution, framerate, and bitrate. Example Python request (RoomCompositeEgress) — set
audio_only=False
(or omit it), specify
layout="grid"
, and use a low-cost encoding preset or custom advanced settings:
Copy code
req = api.RoomCompositeEgressRequest(
    room_name=self.room_name,
    audio_only=False,
    layout="grid",
    file_outputs=[
        api.EncodedFileOutput(
            file_type=api.EncodedFileType.MP4,
            filepath=filepath,
            s3=api.S3Upload(
                bucket=os.getenv("EGRESS_AWS_BUCKET_NAME"),
                region=os.getenv("EGRESS_AWS_REGION"),
                access_key=os.getenv("EGRESS_AWS_ACCESS_KEY_ID"),
                secret=os.getenv("EGRESS_AWS_SECRET_ACCESS_KEY"),
            ),
            # optional: use a preset like H264_720P_30 for lower cost
            preset="H264_720P_30",
            # or use advanced custom encoding to reduce cost further
            advanced=api.EncodedFileOutputAdvanced(
                width=640,
                height=360,
                framerate=15,
                video_codec="H264_MAIN",
                video_bitrate=800,   # kbps
                audio_codec="AAC",
                audio_bitrate=64     # kbps
            ),
        )
    ],
)
Notes: •
layout="grid"
produces the tiled meeting view. • Lower resolution (e.g., 640x360), lower framerate (15 fps), and lower video bitrate (≈800 kbps) reduce processing and egress bandwidth. •
MP4
supports both audio and video;
preset="H264_720P_30"
is a convenient lower-quality option if you prefer predefined settings. Would you like a version tuned for more participants (larger grid) or instructions for HLS segment output to S3 instead? Sources: RoomComposite Egress | LiveKit Docs | Composite and web recordings | LiveKit docs | Egress API | LiveKit docs | A Tale of Two Protocols: WebRTC vs. HLS for Live Streaming | Egress examples | LiveKit docs