Egress output types

Export content anywhere, in any format.

Supported Outputs

Egress TypeTranscodedPass-through (mp4, webm, ogg)HLS SegmentsRTMP streamSRT streamWebSocket stream
Room Composite
Web
Participant
Track Composite
Track✅ (audio-only)
Note

A very long-running Egress may hit our Egress time limits.

Composite and Participant Egress Outputs

Since Composite and Participant Egress are transcoded, they can be output to a wide range of formats and destinations.

Egress is optimized to transcode once while sending output to multiple destinations. For example, from the same Egress you may simultaneously:

  • Stream to one or more RTMP endpoints.
  • Record as HLS.
  • Record as MP4.
  • Generate thumbnails.

When creating a new Egress, set one or more of the following configuration fields:

FieldDescription
file_outputsRecord to a MP4 file.
stream_outputsStream to RTMP or SRT server.
segment_outputsRecord as HLS segments.
image_outputsGenerate thumbnails.
Note

While each output type is a list (*_outputs), Egress supports only a single item per type. i.e. It's not possible to output to two different files, but it is possible to output to both a file and a HLS segment.

{
... // source details
"file_outputs": [
{
"filepath": "my-test-file.mp4",
"s3": { ... },
"gcp": { ... },
"azure": { ... },
"aliOSS": { ... }
}
],
"stream_outputs": [
{
"protocol": "rtmp",
"urls": ["rtmp://my-rtmp-endpoint/path/stream-key"]
}
],
"segment_outputs": [
{
"filename_prefix": "my-output",
"playlist_name": "my-output.m3u8",
// when provided, we'll generate a playlist containing only the last few segments
"live_playlist_name": "my-output-live.m3u8",
"segment_duration": 2,
"s3": { ... },
"gcp": { ... },
"azure": { ... },
"aliOSS": { ... }
}
],
"image_outputs": [
{
"capture_interval": 5,
"filename_prefix": "my-image",
"filename_suffix": "IMAGE_SUFFIX_INDEX",
"s3": { ... },
"gcp": { ... },
"azure": { ... },
"aliOSS": { ... }
}
]
}

RTMP/SRT Streaming

Choosing RTMP ingest endpoints

RTMP streams do not perform well over long distances. Some stream providers include a region or location as part of your stream url, while others might use region-based routing.

  • When self-hosting, choose stream endpoints that are close to where your Egress servers are deployed.
  • With Cloud Egress, we will route your Egress request to a server closest to your RTMP endpoints.

Adding streams to non-streaming egress

Streams can be added and removed on the fly using the UpdateStream API.

To use the UpdateStream API, your initial request must include a StreamOutput. If the stream will start later, include a StreamOutput in the initial request with the correct protocol and an empty urls array.

Integration with Mux

Mux is LiveKit's preferred partner for HLS streaming. To start a Mux stream, all you need is your stream key. You can then use mux://<stream_key> as a url in your StreamOutput.

File/Segment outputs

Filename templating

When outputing to files, the filepath and filename_prefix fields support templated variables. The below templates can be used in request filename/filepath parameters:

Egress Type{room_id}{room_name}{time}{publisher_identity}{track_id}{track_type}{track_source}
Room Composite✔️✔️✔️
Web✔️
Participant✔️✔️✔️✔️
Track Composite✔️✔️✔️✔️
Track✔️✔️✔️✔️✔️✔️✔️
  • If no filename is provided with a request, one will be generated in the form of "{room_name}-{time}".
  • If your filename ends with a /, a file will be generated in that directory.
  • If your filename is missing an extension or includes the wrong extension, the correct one will be added.

Examples:

Request filenameOutput filename
""testroom-2022-10-04T011306.mp4
"livekit-recordings/"livekit-recordings/testroom-2022-10-04T011306.mp4
"{room_name}/{time}"testroom/2022-10-04T011306.mp4
"{room_id}-{publisher_identity}.mp4"10719607-f7b0-4d82-afe1-06b77e91fe12-david.mp4
"{track_type}-{track_source}-{track_id}"audio-microphone-TR_SKasdXCVgHsei.ogg

Image output

Image output allows you to create periodic snapshots from a recording or stream, useful for generating thumbnails or running moderation workflows in your application.

The configuration options are:

FieldDescription
capture_intervalThe interval in seconds between each snapshot.
filename_prefixThe prefix for each image file.
filename_suffixThe suffix for each image file. This can be a timestamp or an index.
width and heightThe dimensions of the image. If not provided, the image is the same size as the video frame.

Cloud storage configurations

S3

Egress supports any S3-compatible storage provider, including the following:

  • MinIO
  • Oracle Cloud
  • CloudFlare R2
  • Digital Ocean
  • Akamai Linode
  • Backblaze

When using non-AWS storage, set force_path_style to true. This ensures the bucket name is used in the path, rather than as a subdomain.

Configuration fields:

FieldDescription
access_keyThe access key for your S3 account.
secretThe secret key for your S3 account.
regionThe region where your S3 bucket is located (required when endpoint is not set).
bucketThe name of the bucket where the file will be stored.
endpointThe endpoint for your S3-compatible storage provider (optional). Must start with https://.
metadataKey/value pair to set as S3 metadata.
content_dispositionContent-Disposition header when the file is downloaded.
proxyHTTP proxy to use when uploading files. {url: "", username: "", password: ""}.
Note

If the endpoint field is left empty, it uses AWS's regional endpoints. The region field is required when endpoint is not set.

Google Cloud Storage

For Egress to upload to Google Cloud Storage, you'll need to provide credentials in JSON.

This can be obtained by first creating a service account that has permissions to create storage objects (i.e. Storage Object Creator). Then create a key for that account and export as a JSON file. We'll refer to this file as credentials.json.

Configuration fields:

FieldDescription
credentialsService account credentials serialized in a JSON file named credentials.json.
bucketThe name of the bucket where the file will be stored.
proxyHTTP proxy to use when uploading files. {url: "", username: "", password: ""}.

Azure

In order to upload to Azure Blob Storage, you'll need the account's shared access key.

Configuration fields:

FieldDescription
account_nameThe name of the Azure account.
account_keyThe shared access key for the Azure account.
container_nameThe name of the container where the file will be stored.