Auto-Record to AWS S3

In this guide you will learn how to use auto-record-to-S3 for your live streams.

Step 1. Recording Configuration

Before you can set up a stream for recording, you must create a recording-configuration. This is a resource which specifies an Amazon S3 location where the recorded streams for your account are stored. The S3 location must be in the US East (N. Virginia) us-east-1 region.

  1. Log in to the AuroraLive console.

  2. In the left navigation pane, choose Recording Configuration.

    Recording Configuration
  3. Set Recording Configuration parameters.

    Important: The configured AK/SK needs the following permissions for the bucket:

    "s3:ListBucket",
    "s3:PutObject",
    "s3:GetObject",
    "s3:AbortMultipartUpload",
    "s3:PutObjectAcl",
    "s3:ListMultipartUploadParts"

DEMO

{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"record-demo",
"Effect":"Allow",
"Principal":{
"AWS":"*"
},
"Action":[
"s3:ListBucket",
"s3:PutObject",
"s3:GetObject",
"s3:AbortMultipartUpload",
"s3:PutObjectAcl",
"s3:ListMultipartUploadParts"
],
"Resource":[
"arn:aws:s3:::record-demo-bucket/*",
"arn:aws:s3:::record-demo-bucket"
]
}
]
}

Step 2. Enabling recording for a stream

Enable the Auto-Record to AWS S3 button when you create a live stream.

Recording Configuration

S3 Prefix

The S3 prefix is a unique directory structure for each live stream that is recorded. All media and metadata files for the live stream are written within this directory.

The S3 prefix has the following format:

<bucket>/AuroraLive/v1/<stream_key>/<year>/<month>/<day>/<hours>/<minutes>/<recording_id>

Where:

  • bucket is an parameter created when you setup your account.

  • stream_key is name of the transfer stream, unique under the same live stream.

  • //// is a UTC timestamp when recording starts.

  • recording_id is a unique ID generated for each recording session.

For example:

aws-demo-bucket/AuroraLive/v1/1b2c41eb-7310-46c3-9d10-d7f78406046f/2022/8/29/4/10/c4e956db-7fdc-46e0-9ff6-331c4d5f901c/

Recording Contents

When recording starts, video segments and metadata files are written to the S3 bucket that is configured for the channel. These contents are available for post-processing or playback as on-demand video.

Note that after a live stream starts and the Recording Start EventBridge event is emitted, there is a slight delay before the manifest files and video segments are written. We recommend that you play back or process recorded streams only after the Recording End event is sent.

The following is a sample directory structure and contents of a recording of a live AuroraLive session:

aws-demo-bucket/AuroraLive/v1/1b2c41eb-7310-46c3-9d10-d7f78406046f/2022/8/29/4/10/c4e956db-7fdc-46e0-9ff6-331c4d5f901c/
events
recording-started.json
recording-ended.json
media
hls

The events folder contains the metadata files corresponding to the recording event. JSON metadata files are generated when recording starts, ends successfully:

events/recording-started.json
events/recording-ended.json

A given events folder will contain recording-started.json and recording-ended.json.

These contain metadata related to the recorded session and its output formats. JSON details are given below.

The media folder contains all supported media contents, in two subfolders:

hls contains all media and manifest files generated during the live session and is playable with a video player.

Important: The contents within the media folder are dynamically generated and determined by the characteristics of the first received video segments; the folder contents may not represent the end characteristics (e.g., rendition quality). It's best to not make any assumptions about the static path. To discover the HLS renditions available and its path, use the JSON metadata files described in the following section.

Metadata Files is in JSON format. It comprises the following information.

FieldTypeRequiredDescription
mediaobjectYesObject that contains the enumerated objects of media content available for this recording. Valid values: "hls".
hlsobjectYesEnumerated field that describes the Apple HLS format output.
pathstringYesRelative path from the S3 prefix where HLS content is stored.
playliststringYesName of the HLS master playlist file.
renditionsobjectYesArray of renditions (HLS variant) of metadata objects. There always is at least one rendition.
pathstringYesRelative path from the S3 prefix where HLS content is stored for this rendition.
playliststringYesName of the media playlist file for this rendition.
resolution_heightintConditionalPixel resolution height of the encoded video. This is available only when the rendition contains a video track.
resolution_widthintConditionalPixel resolution width of the encoded video. This is available only when the rendition contains a video track.
recording_started_atstringYesRFC 3339 UTC timestamp when the recording started.See the note above for recording_ended_at.
recording_statusstringYesStatus of the recording. Valid values: "RECORDING_STARTED", "RECORDING_ENDED".

Example

{
"vision":"v1",
"recording_started_at":"2022-08-29 04:10:18",
"recording_status":"RECORDING_STARTED",
"media":{
"hls":{
"path":"media/hls",
"playlist":"playlist.m3u8",
"renditions":[
{
"path":"audio",
"playlist":"playlist.m3u8",
"resolution_height":"0",
"resolution_width":"0"
},
{
"path":"480P",
"playlist":"playlist.m3u8",
"resolution_height":"854",
"resolution_width":"480"
},
{
"path":"720P",
"playlist":"playlist.m3u8",
"resolution_height":"1280",
"resolution_width":"720"
}
]
}
}
}
{
"vision":"v1",
"recording_ended_at":"2022-08-29 04:11:22",
"recording_started_at":"2022-08-29 04:10:18",
"recording_status":"RECORDING_ENDED",
"media":{
"hls":{
"path":"media/hls",
"playlist":"playlist.m3u8",
"renditions":[
{
"path":"audio",
"playlist":"playlist.m3u8",
"resolution_height":"0",
"resolution_width":"0"
},
{
"path":"480P",
"playlist":"playlist.m3u8",
"resolution_height":"854",
"resolution_width":"480"
},
{
"path":"720P",
"playlist":"playlist.m3u8",
"resolution_height":"1280",
"resolution_width":"720"
}
]
}
}
}