Skip to main content

API

The Egress API is available within our server SDKs and CLI:

Important

Requests to the Egress API need the roomRecord permission on the access token.

Start every new egress with StartEgress, which takes one source (a layout template, a web page, or tracks from a room) and one or more outputs. The five source-specific egress APIs it replaces are deprecated.

You can also use curl to interact with the Egress APIs. To do so, POST the arguments in JSON format to:

https://<your-livekit-host>/twirp/livekit.Egress/<MethodName>

For example:

% curl -X POST https://<your-livekit-host>/twirp/livekit.Egress/StartEgress \
-H 'Authorization: Bearer <livekit-access-token>' \
-H 'Content-Type: application/json' \
-d '{"room_name": "your-room", "template": {"layout": "grid"}, "outputs": [{"segments": {"filename_prefix": "your-hls-playlist", "playlist_name": "your-hls-playlist.m3u8"}}], "storage": {"s3": {"access_key": "<key>", "secret": "<secret>", "bucket": "<bucket>", "region": "<bucket-region>"}}}'
{"egress_id":"EG_MU4QwhXUhWf9","room_id":"<room-id>","room_name":"your-room","status":"EGRESS_STARTING"...}
Tip

All RPC definitions and options can be found here .

StartEgress

Starts an egress. Configure a source and one or more outputs: the source determines what is captured, and the outputs determine where it is sent. It replaces the five source-specific egress APIs below.

Availability

StartEgress is available on LiveKit Cloud, and requires LiveKit server v1.13.5 or later when self-hosting. Use the latest version of your server SDK or the LiveKit CLI.

ParameterTypeRequiredDescription
room_namestringWith template or media.Room to capture. Required when using template or media. A web source records an arbitrary URL, so it doesn't need one.
templateTemplateSourceComposite the room using a layout template. Set exactly one of template, web, or media.
webWebSourceRecord any URL in a headless browser. Set exactly one of template, web, or media.
mediaMediaSourceCapture tracks directly through the SDK. Set exactly one of template, web, or media.
presetEncodingOptionsPresetEncoding preset. Defaults to H264_720P_30. Set PASSTHROUGH to skip transcoding. Set at most one of preset or advanced.
advancedEncodingOptionsExplicit encoding options. Set at most one of preset or advanced.
outputsarray<Output>yesWhere to write the result. At least one.
storageStorageConfigDefault storage for outputs that don't set their own.
webhooksWebhookConfig[]Extra webhooks to send on egress events for this request.

Each deprecated API can be replaced with StartEgress using a specific source type:

By default a MediaSource decodes and re-encodes what it captures. To export a track without transcoding, as StartTrackEgress did, set preset to PASSTHROUGH. Egress then writes the track in its native container and skips codec negotiation entirely.

Passthrough captures exactly one track to one file, so it has its own constraints:

  • The source must be a MediaSource. Template and web sources are rejected.
  • Select exactly one track by ID: either video_track_id or a single AudioRoute matching on track_id. Selecting both or neither is rejected, as are participant_video, capture_all, more than one route, and routes matching on identity or kind.
  • Give exactly one output, and it must be a FileOutput. Stream, segment, and image outputs are rejected.
  • Leave file_type unset. Egress picks the container from the codec of the track, and an explicit type is rejected.

The StartTrackEgress API also streams raw audio to a websocket_url. To do this with StartEgress, use a StreamOutput with the WEBSOCKET protocol. Note that this transcodes, since passthrough and stream outputs can't be combined.

StartRoomCompositeEgress (deprecated)

Deprecated

StartRoomCompositeEgress is deprecated and will be removed in a future release. Use StartEgress with a TemplateSource instead.

Starts a new Composite Recording using a web browser as the rendering engine.

ParameterTypeRequiredDescription
room_namestringyesName of room to record.
layoutstringLayout parameter that is passed to the template.
audio_onlyboolTrue if resulting output should only contain audio. To get the audio-only billing rate , also leave layout and custom_base_url empty.
audio_mixingAudioMixingAudio mixing mode to use when audio_only is true. Defaults to DEFAULT_MIXING: All users are mixed together.
video_onlyboolTrue if resulting output should only contain video.
custom_base_urlstringURL to the page that would composite tracks, uses embedded templates if left blank.
file_outputsEncodedFileOutput[]Output to MP4 file. Currently only supports a single entry.
segment_outputsSegmentedFileOutput[]Output to HLS segments. Currently only supports a single entry.
stream_outputsStreamOutput[]Output to a stream. Currently only supports a single entry, though it could include multiple destination URLs.
image_outputsImageOutput[]Output to a succession of snapshot images taken at a given interval (thumbnails). Currently only supports a single entry.
presetEncodingOptionsPresetEncoding preset to use. Only one of preset or advanced could be set.
advancedEncodingOptionsAdvanced encoding options. Only one of preset or advanced could be set.
webhooksWebhookConfig[]Extra webhooks to send on egress events for this request.

StartParticipantEgress (deprecated)

Deprecated

StartParticipantEgress is deprecated and will be removed in a future release. Use StartEgress with a MediaSource and participant_video instead.

Starts a new Participant Egress.

ParameterTypeRequiredDescription
room_namestringyesName of room to record.
identitystringyesIdentity of the participant to record.
screen_shareboolTrue to record the participant's screen share instead of their camera.
file_outputsEncodedFileOutput[]Output to MP4 file. Currently only supports a single entry.
stream_outputsStreamOutput[]Output to a stream. Currently only supports a single entry, though it could include multiple destination URLs.
segment_outputsSegmentedFileOutput[]Output to HLS segments. Currently only supports a single entry.
image_outputsImageOutput[]Output to a succession of snapshot images taken at a given interval (thumbnails). Currently only supports a single entry.
presetEncodingOptionsPresetEncoding preset to use. Only one of preset or advanced could be set.
advancedEncodingOptionsAdvanced encoding options. Only one of preset or advanced could be set.
webhooksWebhookConfig[]Extra webhooks to send on egress events for this request.

StartTrackCompositeEgress (deprecated)

Deprecated

StartTrackCompositeEgress is deprecated and will be removed in a future release. Use StartEgress with a MediaSource instead, setting video_track_id and routing audio with AudioConfig.

Starts a new Track Composite.

ParameterTypeRequiredDescription
room_namestringyesName of room to record.
audio_track_idstringID of audio track to composite.
video_track_idstringID of video track to composite.
file_outputsEncodedFileOutput[]Output to MP4 file. Currently only supports a single entry.
segment_outputsSegmentedFileOutput[]Output to HLS segments. Currently only supports a single entry.
stream_outputsStreamOutput[]Output to a stream. Currently only supports a single entry, though it could include multiple destination URLs.
image_outputsImageOutput[]Output to a succession of snapshot images taken at a given interval (thumbnails). Currently only supports a single entry.
presetEncodingOptionsPresetEncoding preset to use. Only one of preset or advanced could be set.
advancedEncodingOptionsAdvanced encoding options. Only one of preset or advanced could be set.
webhooksWebhookConfig[]Extra webhooks to send on egress events for this request.

StartTrackEgress (deprecated)

Deprecated

StartTrackEgress is deprecated and will be removed in a future release. Use StartEgress with a MediaSource instead, setting preset to PASSTHROUGH to export the track without transcoding.

Starts a new Track Egress.

ParameterTypeRequiredDescription
room_namestringyesName of room to record.
track_idstringID of track to record.
fileDirectFileOutputOnly one of file or websocket_url can be set.
websocket_urlstringURL to websocket to receive audio output. Only one of file or websocket_url can be set.
webhooksWebhookConfig[]Extra webhooks to send on egress events for this request.

StartWebEgress (deprecated)

Deprecated

StartWebEgress is deprecated and will be removed in a future release. Use StartEgress with a WebSource instead.

Starts a new Web Egress.

ParameterTypeRequiredDescription
urlstringyesURL of the web page to record.
audio_onlyboolTrue if resulting output should only contain audio.
video_onlyboolTrue if resulting output should only contain video.
file_outputsEncodedFileOutput[]Output to MP4 file. Currently only supports a single entry.
segment_outputsSegmentedFileOutput[]Output to HLS segments. Currently only supports a single entry.
stream_outputsStreamOutput[]Output to a stream. Currently only supports a single entry, though it could include multiple destination URLs.
image_outputsImageOutput[]Output to a succession of snapshot images taken at a given interval (thumbnails). Currently only supports a single entry.
presetEncodingOptionsPresetEncoding preset to use. Only one of preset or advanced could be set.
advancedEncodingOptionsAdvanced encoding options. Only one of preset or advanced could be set.
webhooksWebhookConfig[]Extra webhooks to send on egress events for this request.

UpdateLayout

Used to change the web layout on an active RoomCompositeEgress.

ParameterTypeRequiredDescription
egress_idstringyesEgress ID to update.
layoutstringyesLayout to update to.
lk egress update-layout --id <EGRESS_ID> --layout speaker
import { LiveKitAPI } from 'livekit-server-sdk';
const api = new LiveKitAPI();
const info = await api.egress.updateLayout(egressId, 'grid-light');
from livekit import api
async with api.LiveKitAPI() as lkapi:
info = await lkapi.egress.update_layout(
api.UpdateLayoutRequest(egress_id=egress_id, layout="grid-light")
)
require 'livekit'
lkapi = LiveKit::LiveKitAPI.new
lkapi.egress.update_layout(egress_id, 'grid-light')
import lksdk "github.com/livekit/server-sdk-go/v2"
api, err := lksdk.NewLiveKitAPI()
info, err := api.Egress().UpdateLayout(ctx, &livekit.UpdateLayoutRequest{
EgressId: egressID,
Layout: "grid-light",
})
import io.livekit.server.LiveKitAPI
val api = LiveKitAPI.createClient(host, apiKey, secret)
val info = api.egress.updateLayout(egressId, "grid-light").execute().body()
use livekit_api::services::LiveKitApi;
let api = LiveKitApi::with_api_key(host, api_key, api_secret);
let info = api.egress().update_layout(egress_id, "grid-light").await?;

UpdateStream

Used to add or remove stream URLs from an active stream.

Note: you can only add outputs to an Egress that was started with stream_outputs set.

ParameterTypeRequiredDescription
egress_idstringyesEgress ID to update.
add_output_urlsstring[]URLs to add to the egress as output destinations.
remove_output_urlsstring[]URLs to remove from the egress.
lk egress update-stream \
--id <EGRESS_ID> \
--add-urls "rtmp://a.rtmp.youtube.com/live2/stream-key"
import { LiveKitAPI, StreamOutput, StreamProtocol } from 'livekit-server-sdk';
const api = new LiveKitAPI();
const streamOutput = new StreamOutput({
protocol: StreamProtocol.RTMP,
urls: ['rtmp://live.twitch.tv/app/<stream-key>'],
});
let info = await api.egress.startRoomCompositeEgress('my-room', { stream: streamOutput });
const streamEgressId = info.egressId;
info = await api.egress.updateStream(streamEgressId, [
'rtmp://a.rtmp.youtube.com/live2/stream-key',
]);
from livekit import api
async with api.LiveKitAPI() as lkapi:
info = await lkapi.egress.start_room_composite_egress(
api.RoomCompositeEgressRequest(
room_name="my-room",
layout="speaker",
stream_outputs=[api.StreamOutput(
protocol=api.StreamProtocol.RTMP,
urls=["rtmp://live.twitch.tv/app/<stream-key>"],
)],
)
)
info = await lkapi.egress.update_stream(
api.UpdateStreamRequest(
egress_id=info.egress_id,
add_output_urls=["rtmp://a.rtmp.youtube.com/live2/stream-key"],
)
)
require 'livekit'
lkapi = LiveKit::LiveKitAPI.new
# to add and remove streams
lkapi.egress.update_stream(
'egress-id',
add_output_urls: ['rtmp://new-url'],
remove_output_urls: ['rtmp://old-url']
)
import lksdk "github.com/livekit/server-sdk-go/v2"
api, err := lksdk.NewLiveKitAPI()
streamRequest := &livekit.RoomCompositeEgressRequest{
RoomName: "my-room",
Layout: "speaker",
StreamOutputs: []*livekit.StreamOutput{{
Protocol: livekit.StreamProtocol_RTMP,
Urls: []string{"rtmp://live.twitch.tv/app/<stream-key>"},
}},
}
info, err := api.Egress().StartRoomCompositeEgress(ctx, streamRequest)
streamEgressID := info.EgressId
info, err = api.Egress().UpdateStream(ctx, &livekit.UpdateStreamRequest{
EgressId: streamEgressID,
AddOutputUrls: []string{"rtmp://a.rtmp.youtube.com/live2/stream-key"},
})
import io.livekit.server.LiveKitAPI
val api = LiveKitAPI.createClient(host, apiKey, secret)
val info = api.egress.updateStream(
"egressId",
listOf("rtmp://new-url"),
listOf("rtmp://old-url"),
).execute().body()
use livekit_api::services::LiveKitApi;
let api = LiveKitApi::with_api_key(host, api_key, api_secret);
let info = api
.egress()
.update_stream(
"egress-id",
vec!["rtmp://new-url".to_string()],
vec!["rtmp://old-url".to_string()],
)
.await?;

ListEgress

Used to list active egress. Does not include completed egress.

lk egress list
import { LiveKitAPI } from 'livekit-server-sdk';
const api = new LiveKitAPI();
const res = await api.egress.listEgress();
from livekit import api
async with api.LiveKitAPI() as lkapi:
res = await lkapi.egress.list_egress(api.ListEgressRequest())
require 'livekit'
lkapi = LiveKit::LiveKitAPI.new
# to list egress on myroom
lkapi.egress.list_egress(room_name: 'myroom')
# to list all egresses
lkapi.egress.list_egress
import lksdk "github.com/livekit/server-sdk-go/v2"
api, err := lksdk.NewLiveKitAPI()
res, err := api.Egress().ListEgress(ctx, &livekit.ListEgressRequest{})
import io.livekit.server.LiveKitAPI
val api = LiveKitAPI.createClient(host, apiKey, secret)
val egressInfos = api.egress.listEgress().execute().body()
use livekit_api::services::{egress::EgressListOptions, LiveKitApi};
let api = LiveKitApi::with_api_key(host, api_key, api_secret);
let res = api.egress().list_egress(EgressListOptions::default()).await?;

StopEgress

Stops an active egress.

lk egress stop --id <EGRESS_ID>
import { LiveKitAPI } from 'livekit-server-sdk';
const api = new LiveKitAPI();
const info = await api.egress.stopEgress(egressId);
from livekit import api
async with api.LiveKitAPI() as lkapi:
info = await lkapi.egress.stop_egress(
api.StopEgressRequest(egress_id=egress_id)
)
require 'livekit'
lkapi = LiveKit::LiveKitAPI.new
lkapi.egress.stop_egress('egress-id')
import lksdk "github.com/livekit/server-sdk-go/v2"
api, err := lksdk.NewLiveKitAPI()
info, err := api.Egress().StopEgress(ctx, &livekit.StopEgressRequest{
EgressId: egressID,
})
import io.livekit.server.LiveKitAPI
val api = LiveKitAPI.createClient(host, apiKey, secret)
val info = api.egress.stopEgress("egressId").execute().body()
use livekit_api::services::LiveKitApi;
let api = LiveKitApi::with_api_key(host, api_key, api_secret);
let info = api.egress().stop_egress("egress-id").await?;

Types

The Egress service includes the following types.

ListEgressResponse

FieldTypeDescription
itemsarray<EgressInfo>List of egress endpoints.

EgressInfo

Returned by start, update, list, and stop operations. Describes the egress and its status.

FieldTypeDescription
egress_idstringUnique egress ID.
room_idstringRoom ID.
room_namestringRoom name.
source_typeEgressSourceTypeWhether the egress was started from web or SDK.
statusEgressStatusCurrent egress status.
started_atint64When the egress started.
ended_atint64When the egress ended.
updated_atint64Last update timestamp.
detailsstringAdditional status details.
errorstringError message, if any.
error_codeint32Error code, if any.
requestStartEgressRequest | ExportReplayRequest | RoomCompositeEgressRequest | WebEgressRequest | ParticipantEgressRequest | TrackCompositeEgressRequest | TrackEgressRequestThe request that started this egress. StartEgressRequest for egresses started with StartEgress. The five source-specific requests are deprecated.
stream_resultsarray<StreamInfo>Results per stream output.
file_resultsarray<FileInfo>Results per file output.
segment_resultsarray<SegmentsInfo>Results per segmented output.
image_resultsarray<ImagesInfo>Results per image output.
manifest_locationstringLocation of the manifest file, if applicable.
backup_storage_usedboolWhether backup storage was used.

EgressStatus

Enum. Egress lifecycle status:

NameValueDescription
EGRESS_STARTING0Egress is starting.
EGRESS_ACTIVE1Egress is active and recording or streaming.
EGRESS_ENDING2Egress is shutting down.
EGRESS_COMPLETE3Egress completed successfully.
EGRESS_FAILED4Egress failed.
EGRESS_ABORTED5Egress was aborted.
EGRESS_LIMIT_REACHED6Egress limit was reached.

EgressSourceType

Enum. Source of the egress:

NameValueDescription
EGRESS_SOURCE_TYPE_WEB0Started from the web (e.g. Cloud dashboard).
EGRESS_SOURCE_TYPE_SDK1Started from the SDK or API.

StreamInfo

Per-stream output result.

FieldTypeDescription
urlstringStream URL.
started_atint64When the stream started.
ended_atint64When the stream ended.
durationint64Duration in nanoseconds.
statusStreamInfo.StatusStream status.
errorstringError message, if any.
last_retry_atint64Last retry timestamp.
retriesuint32Number of retries.

StreamInfo.Status

Enum. Stream output status:

NameValueDescription
ACTIVE0Stream is active.
FINISHED1Stream finished.
FAILED2Stream failed.

FileInfo

Per-file output result.

FieldTypeDescription
filenamestringOutput filename.
started_atint64When the file recording started.
ended_atint64When the file recording ended.
durationint64Duration in nanoseconds.
sizeint64File size in bytes.
locationstringStorage location (e.g. S3 URL).

SegmentsInfo

Per-segmented-output result (e.g. HLS).

FieldTypeDescription
playlist_namestringPlaylist filename.
live_playlist_namestringLive playlist path, if configured.
durationint64Total duration in nanoseconds.
sizeint64Total size in bytes.
playlist_locationstringPlaylist storage location.
live_playlist_locationstringLive playlist storage location.
segment_countint64Number of segments.
started_atint64When the recording started.
ended_atint64When the recording ended.

ImagesInfo

Per-image-output result.

FieldTypeDescription
filename_prefixstringPrefix used for image filenames.
image_countint64Number of images captured.
started_atint64When capture started.
ended_atint64When capture ended.

TemplateSource

Composites a room using a layout template rendered in a headless browser. The service generates a token, builds the recorder URL, and waits for the template to signal that it's ready.

FieldTypeDescription
layoutstringOptional. Layout name passed to the template.
audio_onlyboolOptional. Record audio only.
video_onlyboolOptional. Record video only.
custom_base_urlstringOptional. URL of a custom template. Uses the embedded templates when empty.

To get the audio-only billing rate , set audio_only and leave both layout and custom_base_url empty. Those three conditions together let the service capture the room directly instead of starting a browser.

WebSource

Records any URL in a headless browser. Unlike TemplateSource, it isn't tied to a room, so it can record content that isn't a LiveKit session.

FieldTypeDescription
urlstringRequired. Page to record. Must be http:// or https://.
audio_onlyboolOptional. Record audio only.
video_onlyboolOptional. Record video only.
await_start_signalboolOptional. Wait for the page to signal that it's ready before recording.

MediaSource

Captures tracks directly from a room through the SDK, with no browser. Unifies the deprecated Participant, TrackComposite, and Track egress requests.

FieldTypeDescription
video_track_idstringOptional. Captures exactly this track. Set at most one of video_track_id or participant_video.
participant_videoParticipantVideoOptional. Captures one participant's camera or screen share. Set at most one of video_track_id or participant_video.
audioAudioConfigOptional. Which audio to capture, and which channel each track lands in.

Omit audio to capture video only, or omit the video selector to capture audio only. A request that selects neither fails.

ParticipantVideo

Selects one participant's video track.

FieldTypeDescription
identitystringRequired. Identity of the participant to capture.
prefer_screen_shareboolOptional. Capture the participant's screen share instead of their camera. When set, only a screen share track is captured. There's no fallback to the camera.

AudioConfig

Selects which audio to capture and routes it to output channels.

FieldTypeDescription
capture_allboolOptional. Capture every audio track that no route matches, mixed into both channels.
routesarray<AudioRoute>Optional. Per-track and per-participant channel assignments.

Routes are evaluated in order and the first match wins, so list the most specific matches first. A track matched by a route is captured and mixed into the channel that route specifies. A track no route matches is captured only when capture_all is set, and then lands in both channels.

To record an agent and a caller on separate channels, route the agent to the left channel and standard participants to the right. This replaces the deprecated AudioMixing modes: DEFAULT_MIXING is equivalent to setting capture_all alone, while dual-channel recording becomes explicit routes. StartEgress has no equivalent of DUAL_CHANNEL_ALTERNATE, which assigned channels in subscription order at runtime. Assign channels per participant or per track instead.

AudioRoute

Matches audio and assigns it to a channel.

FieldTypeDescription
track_idstringMatches one track by ID. Set exactly one of track_id, participant_identity, or participant_kind.
participant_identitystringMatches every audio track from one participant. Set exactly one of track_id, participant_identity, or participant_kind.
participant_kindParticipantInfo.KindMatches every audio track from participants of this kind, such as AGENT or SIP. Set exactly one of track_id, participant_identity, or participant_kind.
channelAudioChannelChannel the matched audio is mixed into. Defaults to both.

AudioChannel

Enum. Output channel for matched audio:

NameValueDescription
AUDIO_CHANNEL_BOTH0Mix into both channels.
AUDIO_CHANNEL_LEFT1Mix into the left channel only.
AUDIO_CHANNEL_RIGHT2Mix into the right channel only.

AudioMixing

Enum. Audio mixing mode when recording audio only:

NameValueDescription
DEFAULT_MIXING0All users are mixed together.
DUAL_CHANNEL_AGENT1Agent audio in the left channel, all other audio in the right channel.
DUAL_CHANNEL_ALTERNATE2Each new audio track alternates between left and right channels.

Output

One output destination. Every StartEgress request needs at least one.

FieldTypeDescription
fileFileOutputRecord to a single file. Set exactly one of file, stream, segments, or images.
streamStreamOutputStream to RTMP, SRT, or WebSocket. Set exactly one of file, stream, segments, or images.
segmentsSegmentedFileOutputRecord as HLS segments. Set exactly one of file, stream, segments, or images.
imagesImageOutputCapture thumbnails at an interval. Set exactly one of file, stream, segments, or images.
storageStorageConfigOptional. Storage for this output. Overrides the request-level storage.

Behavior

Output handling follows a few rules:

  • A request can combine one file output, one stream output, one segment output, and any number of image outputs. Egress transcodes once and writes to all of them. Requesting two of the same kind fails, except for images.
  • A WebSocket stream output carries audio only. If the request also selects video, Egress drops the video and streams the audio rather than returning an error.
  • An image-only request records video only, and its audio is ignored.

FileOutput

Records to a single file. Replaces the deprecated EncodedFileOutput and DirectFileOutput. Unlike those, it carries no storage fields of its own: set storage with StorageConfig on the output or on the request.

FieldTypeDescription
file_typeEncodedFileTypeOptional. Output format. Chosen from the codecs when unset.
filepathstringOptional. Path and filename within the storage bucket. Supports templating.
disable_manifestboolOptional. Don't upload the JSON manifest file. Defaults to false.

EncodedFileType

Enum. Encoded file format:

NameValueDescription
DEFAULT_FILETYPE0File type chosen based on codecs.
MP41MP4 container.
OGG2OGG container.
MP33MP3 audio.

EncodedFileOutput

FieldTypeDescription
file_typeEncodedFileTypeOptional. Output file type. Default chosen from codecs.
filepathstringOutput path. See egress docs for templating. Default {room_name}-{time}.
disable_manifestboolIf true, do not upload manifest file. Default false.
s3S3UploadS3-compatible storage. Only one storage output.
gcpGCPUploadGoogle Cloud Storage. Only one storage output.
azureAzureBlobUploadAzure Blob Storage. Only one storage output.
aliOSSAliOSSUploadAlibaba Cloud OSS. Only one storage output.

DirectFileOutput

FieldTypeDescription
filepathstringOutput path. See egress docs for templating. Default {track_id}-{time}.
disable_manifestboolIf true, do not upload manifest file. Default false.
s3S3UploadS3-compatible storage. Only one storage output.
gcpGCPUploadGoogle Cloud Storage. Only one storage output.
azureAzureBlobUploadAzure Blob Storage. Only one storage output.
aliOSSAliOSSUploadAlibaba Cloud OSS. Only one storage output.

SegmentedFileProtocol

Enum. Segmented output protocol:

NameValueDescription
DEFAULT_SEGMENTED_FILE_PROTOCOL0Protocol chosen by server.
HLS_PROTOCOL1HLS.

SegmentedFileSuffix

Enum. Suffix for segment filenames:

NameValueDescription
INDEX0Numeric index (1, 2, 3, ...).
TIMESTAMP1UTC timestamp.

SegmentedFileOutput

FieldTypeDescription
protocolSegmentedFileProtocolOptional. Segmented protocol. Default chosen by server.
filename_prefixstringOptional. Prefix for each segment (include paths here).
playlist_namestringOptional. Name of the m3u8 playlist. When empty, matches filename_prefix.
live_playlist_namestringOptional. Path for a live playlist. Omitted if not set.
segment_durationuint32Segment length in seconds. Optional.
filename_suffixSegmentedFileSuffixOptional. INDEX or TIMESTAMP. Default INDEX.
disable_manifestboolIf true, do not upload manifest file. Default false.
s3S3UploadS3-compatible storage. Only one storage output.
gcpGCPUploadGoogle Cloud Storage. Only one storage output.
azureAzureBlobUploadAzure Blob Storage. Only one storage output.
aliOSSAliOSSUploadAlibaba Cloud OSS. Only one storage output.

StreamProtocol

Enum. Stream output protocol:

NameValueDescription
DEFAULT_PROTOCOL0Protocol chosen from URLs.
RTMP1RTMP.
SRT2SRT.
WEBSOCKET3Raw audio over a WebSocket. Audio only.

StreamOutput

FieldTypeDescription
protocolStreamProtocolRequired. Stream protocol (e.g. RTMP).
urlsarray<string>Required. Destination URLs.

ImageFileSuffix

Enum. Suffix for image filenames:

NameValueDescription
IMAGE_SUFFIX_INDEX0Numeric index (1, 2, 3, ...).
IMAGE_SUFFIX_TIMESTAMP1Timestamp.
IMAGE_SUFFIX_NONE_OVERWRITE2No suffix; overwrite the same file with the latest image.

ImageOutput

FieldTypeDescription
capture_intervaluint32Required. Seconds between each snapshot.
widthint32Optional. Image width. Defaults to track width.
heightint32Optional. Image height. Defaults to track height.
filename_prefixstringOptional. Prefix for each image filename (include paths here).
filename_suffixImageFileSuffixOptional. INDEX, TIMESTAMP, or NONE_OVERWRITE. Default INDEX.
image_codecImageCodecOptional. Image codec (e.g. JPEG).
disable_manifestboolIf true, do not upload manifest file. Default false.
s3S3UploadS3-compatible storage. Only one storage output.
gcpGCPUploadGoogle Cloud Storage. Only one storage output.
azureAzureBlobUploadAzure Blob Storage. Only one storage output.
aliOSSAliOSSUploadAlibaba Cloud OSS. Only one storage output.

StorageConfig

Specifies where Egress stores output files. Set it on a StartEgress request to apply the same storage configuration to every output, or on an individual Output to override the request-level configuration.

FieldTypeDescription
s3S3UploadS3-compatible storage. Set at most one of s3, gcp, azure, or aliOSS.
gcpGCPUploadGoogle Cloud Storage. Set at most one of s3, gcp, azure, or aliOSS.
azureAzureBlobUploadAzure Blob Storage. Set at most one of s3, gcp, azure, or aliOSS.
aliOSSAliOSSUploadAlibaba Cloud OSS. Set at most one of s3, gcp, azure, or aliOSS.

Egress resolves storage in three steps and uses the first one set: the storage set on the output, then the storage set on the request, then the storage configured on the server. On LiveKit Cloud, local storage isn't available, so a request that resolves to no storage fails.

The deprecated source-specific requests, along with SegmentedFileOutput and ImageOutput, still take s3, gcp, azure, and aliOSS fields directly. Those fields are deprecated. Use StorageConfig instead.

S3Upload

FieldTypeDescription
access_keystringS3 access key.
secretstringS3 secret key.
session_tokenstringOptional. Session token for temporary credentials.
assume_role_arnstringOptional. ARN of role to assume for upload (LiveKit Cloud feature when enabled).
assume_role_external_idstringOptional. External ID for assume role.
regionstringBucket region. Optional.
endpointstringCustom S3 endpoint URL. Optional.
bucketstringDestination bucket.
force_path_styleboolIf true, keep bucket in path (no subdomain). Optional.
metadatamap<string, string>Metadata key-value pairs. Optional.
taggingstringS3 object tagging. Optional.
content_dispositionstringContent-Disposition header. Optional.
proxyProxyConfigProxy for uploads. Optional.

GCPUpload

FieldTypeDescription
credentialsstringService account credentials JSON (credentials.json).
bucketstringDestination bucket.
proxyProxyConfigProxy for uploads. Optional.

AzureBlobUpload

FieldTypeDescription
account_namestringAzure storage account name.
account_keystringAzure storage account key.
container_namestringDestination container.

AliOSSUpload

FieldTypeDescription
access_keystringAlibaba Cloud access key.
secretstringAlibaba Cloud secret key.
regionstringBucket region.
endpointstringCustom endpoint URL. Optional.
bucketstringDestination bucket.

EncodingOptions

FieldTypeDescription
widthint32Output width. Default 1920.
heightint32Output height. Default 1080.
depthint32Color depth. Default 24.
framerateint32Frame rate. Default 30.
audio_codecAudioCodecAudio codec. Default OPUS.
audio_bitrateint32Audio bitrate in kbps. Default 128.
audio_qualityint32Audio encoder quality setting. Optional.
audio_frequencyint32Sample rate in Hz. Default 44100.
video_codecVideoCodecVideo codec. Default H264_MAIN.
video_bitrateint32Video bitrate in kbps. Default 4500.
video_qualityint32Video encoder quality setting. Optional.
key_frame_intervaldoubleKey frame interval in seconds. Default 4 for streaming; segment duration for segmented output; encoder default for files.

EncodingOptionsPreset

Enum. Encoding presets (H.264_MAIN / OPUS unless noted):

NameValueDescription
H264_720P_3001280×720, 30 fps, 3000 kbps.
H264_720P_6011280×720, 60 fps, 4500 kbps.
H264_1080P_3021920×1080, 30 fps, 4500 kbps.
H264_1080P_6031920×1080, 60 fps, 6000 kbps.
PORTRAIT_H264_720P_304720×1280, 30 fps, 3000 kbps.
PORTRAIT_H264_720P_605720×1280, 60 fps, 4500 kbps.
PORTRAIT_H264_1080P_3061080×1920, 30 fps, 4500 kbps.
PORTRAIT_H264_1080P_6071080×1920, 60 fps, 6000 kbps.
PASSTHROUGH8Skip transcoding and write the track in its native container. Valid only with a MediaSource selecting a single track, and a single FileOutput. See StartEgress for the full constraints.

ProxyConfig

Proxy server for uploads (S3 and GCP). Use to work around network restrictions to destination buckets.

FieldTypeDescription
urlstringProxy URL.
usernamestringUsername for basic auth. Optional.
passwordstringPassword for basic auth. Optional.

WebhookConfig

Extra webhooks for a specific egress request. Called for egress lifecycle events in addition to project webhooks. See Webhooks.

FieldTypeDescription
urlstringWebhook URL.
signing_keystringAPI key to sign the request. Must be defined for the project.