Record Delivery | 0.16.5.0+

Record Delivery is supported starting with OvenMediaEngine Enterprise 0.16.5.0-1.

Describes how to record a live stream using OvenMediaEngine and transfer the recorded files to Object Storage.

In this guide, we will practice the following:

  • Setting up OvenMediaEngine and OvenMediaEngine Delivery to enable recording file delivery.

  • Using the automatic recording feature of OvenMediaEngine or the recording REST API to start recording and delivering.

  • Monitoring the recording delivery status.

Step 1: Configuring Recording in OvenMediaEngine

Enable the stream recording feature by activating the File Publisher feature of OvenMediaEngine.

Configuration File Path:

  • The File Publisher can be enabled in /usr/share/ovenmediaengine/conf/Server.xml.

Automatic Recording Settings

Configure OvenMediaEngine to automatically start recording and delivering as soon as the stream broadcast begins.

Example Server.xml:

<Applications>
  <Application>
    <Name>app</Name>
    ...
    <Publishers>
      <FILE>
        <RootPath>/mnt/shared_volumes/records</RootPath>
        <StreamMap>
          <Enable>true</Enable>
          <Path>./record_map.xml</Path>
        </StreamMap>
      </FILE>
    </Publishers>
    ...
  </Application>
</Applications>

To enable OvenMediaEngine to automatically record and deliver, define the recording file path, format, and Object Storage information in the FILE.StreamMap.Path file.

Create the record_map.xml file as specified in Server.xml:

  • Path: /usr/share/ovenmediaengine/conf/record_map.xml

Example record_map.xml:

<RecordInfo>
  <Record>
    <Enable>true</Enable>
    <StreamName>stream</StreamName>
    <VariantNames>video_1080, aac_audio</VariantNames>
    <FilePath>${VirtualHost}/${Application}/${Stream}-${StartTime:YYYYMMDDhhmmss}_${EndTime:YYYYMMDDhhmmss}.mp4</FilePath>
    <InfoPath>${VirtualHost}/${Application}/${Stream}-${StartTime:YYYYMMDDhhmmss}_${EndTime:YYYYMMDDhhmmss}.xml</InfoPath>
    <Metadata>aws_access_key_id='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',aws_secret_access_key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',endpoint='https://object.storage.com',region='us-east-1',bucket_name='bucket_name',object_dir='my/vod/path/',delete='true'</Metadata>
  </Record>
</RecordInfo>

In Metadata, set the delivery information in the format key='value',key='value',....

Basic format:

aws_access_key_id='****',aws_secret_access_key='****',endpoint='https://object.storage.com',region='us-east-1',bucket_name='record-bucket',object_dir='/my/vod/path/',delete='true'
  • aws_access_key_id (required): Specify the access key ID to access Object Storage.

  • aws_secret_access_key (required): Specify the secret access key to access Object Storage.

  • endpoint (optional): Specify the connection endpoint of Object Storage. If empty, the AWS S3 endpoint is used.

  • region (optional): Specify the region of Object Storage. If empty, the default region of AWS S3 is used.

  • bucket_name (required): Enter the bucket name to which the recorded file will be delivered.

  • object_dir (required): Specify the path within the bucket to deliver the recorded file.

  • delete (optional): Specify true or false for whether to delete the recorded file created in the RootPath of Server.xml after the delivery is complete.

For more details on the recording format, see OvenMediaEngine Recording.

Recording Settings Using REST API

Configure OvenMediaEngine to record and deliver streams using the recording REST API.

(Note: The recording format and Object Storage information can be set when calling the recording start REST API.)

Example Server.xml:

<Applications>
  <Application>
    <Name>app</Name>
    ...
    <Publishers>
      <FILE>
        <RootPath>/mnt/shared_volumes/records</RootPath>
        <FilePath>${VirtualHost}/${Application}/${Stream}-${StartTime:YYYYMMDDhhmmss}_${EndTime:YYYYMMDDhhmmss}.ts</FilePath>
        <InfoPath>${VirtualHost}/${Application}/${Stream}-${StartTime:YYYYMMDDhhmmss}_${EndTime:YYYYMMDDhhmmss}.xml</InfoPath>
      </FILE>
    </Publishers>
    ...
  </Application>
</Applications>

Automatic recording and recording via REST API can be configured simultaneously.

For detailed recording settings, see OvenMediaEngine Recording.

Step 2: Setting Up and Activating the Delivery Service

Delivery Service Settings

In the delivery service settings, configure the path where OvenMediaEngine generates the recorded files.

Delivery service configuration file path:

  • /usr/share/ovenmediaengine/delivery/conf/config.ini

Set RECORD_INFO_FILE_BASE_DIR to the path where OvenMediaEngine's File Publisher generates the recorded files. (Other settings usually do not need to be changed.)

Example config.ini:

[DELIVERY]
# database uri
DATABASE_URI = /usr/share/ovenmediaengine/delivery/delivery.db
# log file will saved
LOG_DIR = /var/log/ovenmediaengine/delivery/
# dump base directory
DUMP_INFO_FILE_BASE_DIR = 
# recording base directory
RECORD_INFO_FILE_BASE_DIR = /mnt/shared_volumes/records

Activating the Delivery Service

The delivery service is disabled by default. Activate the delivery service:

sudo systemctl start ovenmediaengine-delivery

Step 3: Starting Recording and Delivery

Using the Automatic Recording Feature

Start streaming app/stream. OvenMediaEngine will automatically start recording and deliver the recorded file to the configured Object Storage.

Using the Recording REST API

Start streaming app/stream. Call the recording start REST API for app/stream to have OvenMediaEngine start recording. Once recording is complete, the delivery service will deliver the recorded file to Object Storage.

Example of calling the recording start API:

curl --location 'http://{OME_HOST}:{OME_REST_API_PORT}/v1/vhosts/default/apps/app:startRecord' \
--header 'Authorization: Basic b21lOmRlZmF1bHQ=' \
--header 'Content-Type: application/json' \
--data '{
    "id": "unique_id",
    "stream": {
        "name": "stream",
        "variantNames": ["video_1080", "aac_audio"]
    },
    "metadata": "aws_access_key_id='\''xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\'',aws_secret_access_key='\''xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\'',endpoint='\''https://object.storage.com'\'',region='\''us-east-1'\'',bucket_name='\''bucket_name'\'',object_dir='\''my/vod/path/'\'',delete='\''true'\''"
}'

For the recording REST API, see OvenMediaEngine REST API.

Monitoring the Delivery Status

Check the delivery service logs to monitor the delivery status of the recorded file:

tail -f /var/log/ovenmediaengine/delivery/delivery-daemon.log

This concludes the guide on using OvenMediaEngine to record live streams and deliver recorded files to Object Storage.

Last updated