edit-icon download-icon

Store live recordings in OSS

Last Updated: Jul 03, 2018

ApsaraVideo Live allows you to record source video streams. It supports m3u8 (.ts fragment files), mp4, and flv format, along with recording duration settings. Video files are saved in OSS. After a streaming ends, a recording index file for the streaming is generated automatically. The service also supports the generation of custom recording index files (m3u8, mp4, or flv files) based on your specified recording start time and end time.

Under a live video CDN domain name, the livestream recording settings are differentiated by the AppName of the livestream. That is, streams under the same AppName all perform recording operations following the settings for this AppName.

To facilitate the playback of your recorded content, the live recordings must be stored in OSS and your media bucket. If they are stored in the media bucket, you must first activate Media Transcoding (MTS) and then set the input and output media buckets. This document takes the recordings stored in OSS as an example. For recordings stored in media bucket, see Convert live recordings to media files.


Step 1. Create an OSS bucket

When creating a live recording service, you must store videos in an OSS bucket. Therefore, you must first create an OSS bucket.

  1. Log on to the OSS console and click Create Bucket.


  2. Enter the bucket information.

    Select the region where the live video domain name is located as the Region. The live video domain name is located in China East 2 (Shanghai). Therefore, you must select China East 2 (Shanghai).


    Note: After the bucket is created, check that the region of the bucket is consistent with that of the live video domain name. You can also create bucket folders as needed.

  3. In Files, click Create Directory.

    If you have many recording files, you can create folders to classify them so as to facilitate recording management.


  4. Enter the Directory Name and click OK.


    • Configure the CDN domain name.

      Recordings are stored in OSS. You can configure a CDN domain name and use CDN acceleration to view the recordings. CDN delivers videos stored in your OSS to nodes throughout China. Users can access the nearest CDN node to read files without accessing the original files in OSS and consuming OSS Internet traffic. By using CDN, the access rate and experience of your edge users are improved, and the CDN Internet traffic cost is only 50% of the OSS Internet traffic cost. This efficiently reduces the network fees for your applications.

      Click Domain Names > Bind User Domain to configure CDN domain name.


      You do not need to configure a CDN domain name if you only store your videos.

      Note: The CDN domain name and the live video domain name cannot be the same. Set different domain names.

Step 2. Create a live recording

  1. Log on to the ApsaraVideo Live console.

  2. Click Domains.

  3. Select the region.

  4. Select the expected domain name and click Detail at the right side.


  5. Click Recording settings and click Create Recording.


  6. Configure recording settings.


    1. In the recording settings window, enter the AppName and StreamName for which to enable the recording function.

      AppName: The name of the live app

      StreamName: The name of the live stream


      • AppName parameter and StreamName parameter support upper case letters, lower case letters, number, hyphen (-), underline (_) and period (.). The length is limited within 50 characters. Domain-level setting is supported by entering a wildcard (*) in the APPName, and all the streams under an AppName are recorded if you add a wildcard (*) in the StreamName.

      • The recording AppName and the AppName in the stream push address must be the same. For example, if the ‘AppName’ in your stream push address is set to ‘videolive-en’, the recording ‘AppName’ must also be ‘videolive-en’. For more information about the settings, see Live streaming.

    2. Record Format.

      Three record formats are supported: flv, mp4, and m3u8. Here, m3u8 format simultaneously outputs ts fragment addresses.

    3. Storage Rules.

      The default storage path for recordings is:





      In the example screenshot, the app name is AppName, so the m3u8 and ts recording files are stored in the following path:



      If the default recording file storage path cannot meet your requirements, you can change it.

    4. Set the Store Path.

      Click Select, then click Standard buckets in the dialogue box and select the expected bucket name.


    5. Recording Period.

      The system supports recording period from 15 to 360 minutes (6 hours). After a recording exceeds six hours, a new file is generated according to the recording naming rules. However, the default length of ts fragments is 30 seconds.

    6. Recording file names.

      Here, { } represents a variable. The flv, mp4, and m3u8 formats support names in the following format: {AppName}, {StreamName}, {Date}, {Sequence}, {StartTime} and {EndTime}. Except for {StartTime} and {EndTime} the other variables can be retained or deleted as needed. TS recording files supports names in the format: {AppName}, {StreamName}, {Date}, {Sequence}, {UnixTimestamp}. These variables can be retained or deleted as needed.

      • {date} classifies recording files into folders by date. The default date format is “YYY-MM-DD”.

      • {StreamName} automatically fetches the StreamName and uses it as the storage path. You can manually change this as needed. You can customize the {streamName} according to your needs.

      • {Sequence} is the sequence variable.

      • {StartTime} is the recording start time and {EndTime} is the end time. The parameters of flv, mp4, and m3u8 files must have these variables.

      • {UnixTimestamp}_{Sequence} is the timestamp and sequence variable. In the names of ts files, this variable is automatically specified based on the file generation time and sequence.

      To maintain compatibility with the streaming process, the recording system judge a livestream to have ended when an interruption caused by network jitter or another problem persists for 180 seconds and the stream is not restored. The system independently stores the default recording index files in the format:{AppName}/{StreamName}/{Date}.m3u8(m3u8 format).

  7. Click OK to complete recording settings.

    In the Recording Settings tab, all the recording settings under the selected domain name are listed.


    As a result, all the livestreams withAppNameas the AppName under the domain name follow these recording rules. Livestreams that occur before you finish configuring the settings do not trigger recording. Only new livestreams trigger recording (or an existing livestream that is interrupted for more than 180 seconds).

  8. Recording files playback.

    You can play back recorded videos on demand.

    Note: The AppName in the stream push address and the AppName in the playback address must be consistent with that in the recording template.

Step 3. View recording files

Recording files are stored in the OSS list. You can use OSS to view, download, and play the recordings. You can also perform list view and playback on the ApsaraVideo Live console.

  • View recording files on the OSS console.

    Find the video storage folder on the OSS console. Recording files are stored in OSS in compliance with the aforementioned rules. You can obtain the playback addresses from OSS.

    The complete video files are stored in the record/date/AppName/StreamName directory, which is the same as the directory for the TS fragment files. You can click Object Name to obtain the address for playback.


  • View recording files on the ApsaraVideo Live console.

    You can also use the Recording Indexes function on the ApsaraVideo Live console to view the recording files.


Thank you! We've received your feedback.