Recording

Updated at:

The Real-time Media Processing recording service allows you to record live streams to Alibaba Cloud OSS or VOD. The recorded files are automatically registered in the IMS media library, allowing you to process the content. This topic explains the recording feature and its usage.

Feature overview

Overview

Real-time recording captures the original live stream and packages it into M3U8, FLV, or MP4 format. You can store the recordings in Alibaba Cloud OSS or VOD, and they are automatically registered in the IMS media library. Key features of Real-time Media Processing recording include:

  • Live stream recording only changes the container format of the audio and video (for example, from RTMP to TS, FLV, or MP4) without re-encoding the content.

  • Recorded files are automatically registered in the IMS media library, where you can search for and manage them.

Limitations

  • Each account supports a maximum of 100 concurrent recording jobs. If you need a higher limit, contact your Alibaba Cloud account manager.

  • The input live stream for a recording job must use the RTMP protocol.

  • Because real-time recording involves segmenting the live stream into TS files, the encoding format of the input stream must be compatible with the TS container format. Based on FLV and ISO/IEC 13818-1 standards, real-time recording currently supports only the following encoding formats:

    Audio/video

    Encoding format

    Video

    H.264, HEVC, MPEG-4

    Audio

    AAC, MP3

Usage notes

  • We recommend starting your live stream before you submit the recording job, or submitting the job no more than 3 minutes before the stream begins. If the recording job cannot pull the live stream after 3 minutes, it stops automatically. You must then start a new job.

  • If the live stream is active, a recording file is generated and registered in the IMS media library when the specified recording cycle is complete.

  • If the live stream is interrupted for less than 3 minutes, the recording continues. If the interruption lasts for more than 3 minutes, the recording job stops automatically, generates a recording file, and registers it in the IMS media library.

Create a recordingtemplate

Console

  1. Log on to the Intelligent Media Services console.

  2. In the top-left corner, select the appropriate region.

  3. In the left-side navigation pane, choose Real-time Media Processing> Template Management.

  4. On the Recording tab, create a recording template.

    Parameter

    Description

    Template name

    Enter a name for the recording template.

    Storage rule

    M3U8

    Recording file name

    The name of the M3U8 file. The naming convention is record/{JobId}/{EscapedStartTime}_{EscapedEndTime}.

    TS slice name

    The name of the TS slice. The naming convention is record/{JobId}/{UnixTimeStamp}_{Sequence}.

    Single TS duration

    The duration of a single slice, in seconds. The value must be an integer from 5 to 30.

    Recording cycle

    The recording cycle, in minutes. The value must be an integer from 15 to 360.

    If the live stream duration exceeds the specified recording cycle, a new file is generated.

    FLV

    Recording file name

    The name of the FLV file. The naming convention is record/{JobId}/{EscapedStartTime}_{EscapedEndTime}.

    Recording cycle

    The recording cycle, in minutes. The value must be an integer from 15 to 360.

    If the live stream duration exceeds the specified recording cycle, a new file is generated.

    MP4

    Recording file name

    The name of the MP4 file. The naming convention is record/{JobId}/{EscapedStartTime}_{EscapedEndTime}.

    Recording cycle

    The recording cycle, in minutes. The value must be an integer from 15 to 360.

    If the live stream duration exceeds the specified recording cycle, a new file is generated.

OpenAPI

Call the CreateLiveRecordTemplate operation and set the Format parameter as needed to create a custom template.

Create arecording job

Console

  1. Log on to the Intelligent Media Services console.

  2. In the top-left corner, select the appropriate region.

  3. In the left-side navigation pane, choose Real-time Media Processing> Task Management.

  4. On the Recording tab, create a recording job.

    Parameter

    Description

    Job name

    Enter a name for the recording job.

    Storage location

    Select a storage location for the recorded files. You can store them in Alibaba Cloud OSS or VOD. If no storage location is available, you must configure one. For more information, see Configure storage locations.

    Select template

    Select a recording template.

    Live stream

    Enter a valid live stream URL. Only the RTMP protocol is supported.

    Callback URL

    Enter a callback URL. This URL is valid only for the current job. If you leave this parameter empty, the system uses the URL specified in your callback settings.

OpenAPI

Call the SubmitLiveRecordJob operation to submit a real-time media recording job.

Query recording job details

Callbacks

Query recording job details by receiving callbacks for Live Recording File Generation and Live Recording Status events. For more information, see Callback event overview.

OpenAPI

Call the GetLiveRecordJob operation to query the details of a real-time media recording job.

View recorded files

After a recording job completes, you can view the recorded files.

Console

  1. Log on to the Intelligent Media Services console.

  2. In the top-left corner, select the appropriate region.

  3. In the left-side navigation pane, choose Real-time Media Processing> File Management.

  4. On the Recording tab, find the recording job and click View Recorded Files in the Actions column to view the recorded files from the live stream.

OpenAPI

Call the ListLiveRecordFiles operation to view the recorded files of a live stream. Call the DeleteLiveRecordFiles operation to delete recorded files.

Delete files (OSS permissions)

To also delete recorded files stored in OSS, you must first grant the required permissions to Intelligent Media Services.

  1. Log on to the RAM console.

  2. Create a custom permission policy.

    1. In the left navigation bar, select Permissions > Policy.

    2. Click Create Policy.

    3. On the JSON tab, create the following policy.

      {
          "Version": "1",
          "Statement": [
              {
                  "Action": "oss:DeleteObject",
                  "Resource": "*",
                  "Effect": "Allow"
              }
          ]
      }
      Note

      Resource specifies the OSS storage path of the real-time recording files. The asterisk (*) indicates all files.

    4. Enter a policy name. We recommend that you name it AliyunICEMediaResourcesAccessRole. Click OK.

  3. Find the AliyunICEDefaultRole role and grant permissions to it.

    1. In the left navigation bar, select Identities > Roles.

    2. In the search box, enter AliyunICEDefaultRole to find the role. If the role is not found, you have not yet activated Intelligent Media Services. You must activate the service first. For more information, see Activate Intelligent Media Services.

    3. In the Actions column for AliyunICEDefaultRole, click Add Permissions. For Permission Type, select Custom Policy. For Policy Name, enter the name of the custom policy from Step 2.

  4. Click OK to complete the configuration.

Queryrecording job usage

  1. Log on to the Intelligent Media Services console.

  2. In the left-side navigation pane, choose Data Center > Usage.

  3. On the Real-time Task Usage tab, in the Live Recording section, you can query or export detailed usage data for your jobs.

    Note

    To ensure data security, the download link for the exported file is valid for 30 minutes. If the link expires, refresh the page to generate a new one.

API reference

Real-time media recording API operations