OvenMediaEngine Enterprise
English
English
  • About
    • Introduction
    • Release Notes
      • 0.18.2
      • 0.18.1
      • 0.18.0
      • 0.17.3
      • 0.17.2
      • 0.17.1
      • 0.17.0
      • 0.16.8
      • 0.16.7
      • 0.16.6
      • 0.16.5
      • 0.16.4
  • Installation
    • Getting Started
      • Getting Started with Ubuntu
      • Getting Started with RHEL
      • Getting Started with Docker
    • Configuration Structure Overview
  • Web Console
    • Getting Started with Web Console
    • Web Console Overview
      • Sign In
      • Change Password
      • Web Console Home
      • Stream List
        • Managed and Instant Streams
        • Scheduled Channels | 0.16.4.0+
        • Multiplex Channels | 0.16.5.0+
      • Event Monitoring | 0.18.1.0+
        • Configuration
        • Event Specification
      • Web Console Publishing | 0.18.1.2+
      • Logs
      • Configuration Files
      • Restart
    • Web Console Settings
      • Server Settings
      • Live Sources (Ingress Protocols) Settings
      • ABR and Transcoding Settings
      • Streaming (Egress Protocols) Settings
      • TLS Encryption Settings | 0.14.0.0+
      • Access Control Settings
      • Thumbnail Settings | 0.15.7.0+
      • Recording Settings | 0.16.5.0+
      • Push Publishing Settings | 0.15.14.0+
      • REST API Settings | 0.11.0.0+
      • Alert Settings | 0.15.11.0+
  • CDN Compatibility
    • Origin Server Redundancy
    • Origin Cache Control
  • Protection
    • RTMP Authentication | 0.17.2.0+
    • Proxy Protocol Integration | 0.16.6.2+
    • Digital Rights Management (DRM)
      • OvenMediaEngine Configuration for DRM | 0.16.0.0+
      • PallyCon DRM Configuration | 0.16.4.0+
  • Performance
    • Hardware-Accelerated Video Encoding | 0.16.4.0+
  • Event Insertion
    • Insert SEI into H.264 (AVC) Streams | v0.18.0.0+
    • Insert AMF0 messages in RTMP Push Publisher | 0.17.3.0+
  • Monetization
    • Insert Ad Markers (EXT-X-CUE-OUT/EXT-X-CUE-IN) | v0.17.3.0+
    • Insert onCuePoint messages into YouTube Live | 0.17.3.0+
  • Advanced Management
    • Generating Audio PTS | 0.17.2.3+
    • API Storage | 0.17.0.0+
    • Restart Application | 0.17.0.0+
    • Record Delivery | 0.16.5.0+
    • Add Delay to the Stream
    • Control Default Playlist Creation
Powered by GitBook
On this page
  • Inserting the onTextData message via the Send Event API
  • API Interface
  • Inserting the onTextData message through XML Configuration | 0.18.2.0+
  • Configuration Example
  • Payload Example
  1. Event Insertion

Insert AMF0 messages in RTMP Push Publisher | 0.17.3.0+

OvenMediaEngine Enterprise supports AMF0 messgaes insertion starting from version 0.17.3.0-1.

When re-streaming (Push Publishing) a live stream to another system using the RTMP protocol, you can insert AMF0 messages. Utilizing this feature, you can deliver messages such as subtitle insertions and advertisement markers to another system. The method for inserting messages is as follows:

  • If the Media Source received through the RTMP Provider includes a message, it will be automatically inserted.

  • You can insert messages dynamically through the OvenMediaEngine's Send Event API or continuously through XML configuration.

Inserting the onTextData message via the Send Event API

The onTextData message is used for various purposes, such as subtitle insertion and ad marker insertion.

API Interface

Request

POST /v1/vhosts{vhost}/apps/{app}/streams/{stream}:sendEvent

Header

Authorization: Basic {credentials}

# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>

Body

{
  "eventFormat": "amf",
  "events":[
    {
      "amfType": "onTextData",
      "data": {
        "key1": "value",  // String Type
        "key2": 354.1,    // Number Type [Double]
        "key3": true     // Boolean Type [true | false]
      }
    }
  ]
}
POST /v1/vhosts{vhost}/apps/{app}/streams/{stream}:sendEvents

Header

Authorization: Basic {credentials}

# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>

Body

[
  {
    "eventFormat": "id3v2",
    "eventType": "video", // "eventTarget": "video" is same
    "events":[
      {
        "frameType": "TXXX",
        "info": "AirenSoft",
        "data": "OvenMediaEngine"
      },
      {
        "frameType": "TIT2",
        "data": "OvenMediaEngine 123"
      }
    ]
  },
  {
    "eventFormat": "amf",
    "events":[
      {
        "amfType": "onTextData",
        "data": {
          "key1": "value",  // String Type
          "key2": 354.1,    // Number Type [Double]
          "key3": true     // Boolean Type [true | false]
        }
      }
    ]
  }
]

Responses

200 Ok

The request has succeeded

Header

Content-Type: application/json

Body

{
    "message": "OK",
    "statusCode": 200
}
400 Bad Request

Invalid request. Body is not a Json Object or does not have a required value

401 Unauthorized

Authentication required

Header

WWW-Authenticate: Basic realm=”OvenMediaEngine”

Body

{
    "message": "[HTTP] Authorization header is required to call API (401)",
    "statusCode": 401
}
404 Not Found

The given vhost name or application name could not be found.

Body

{
    "message": "[HTTP] Could not find the application: [default/app2] (404)",
    "statusCode": 404
}

Inserting the onTextData message through XML Configuration | 0.18.2.0+

For scenarios requiring continuous onTextData message insertion, you can configure this behavior through XML configuration. Create an XML file defining the onTextData message insertion events and enable EventGenerator in Server.xml.

Configuration Example

Server.xml: You can enable the EventGenerator functionality for the onTextData message insertion by adding <Application><EventGenerator>.

<?xml version="1.0" encoding="UTF-8"?>
<Server version="8">
  ...
  <VirtualHosts>
    <VirtualHost>
      <Applications>
        <Application>
          ...
          <EventGenerator>
            <Enable>true</Enable>
            <Path>events/send_event_info.xml</Path>
          </EventGenerator>
        </Application>
      </Applications>
    </VirtualHost>
  </VirtualHosts>
</Server>
Element
Required
Description

<Enable>

Y

Sets activation status to true or false.

  • Default: false

<Path>

Y

Sets the path to the XML file defining the onTextData message insertion details. If a relative path is specified, the directory containing the Server.xml file is used as the base.

XML Defining the onTextData message Insertion Events: Create an XML file defining onTextData message insertion events at the path specified in Server.xml. In this example, it's send_event_info.xml.

<?xml version="1.0" encoding="UTF-8"?>
<EventInfo>
  <Event>
    <Enable>true</Enable>
    <SourceStreamName>stream*</SourceStreamName>
    <Interval>2000</Interval>
    <EventFormat>amf</EventFormat>
    <EventType>video</EventType>
    <Values>
      <AmfType>onTextData</AmfType>
      <Data>
        <key1 type="string">value</key1>    // String Type
        <key2 type="double">354.1</key2>    // Number Type [Double]
        <key3 type="boolean">true</key3>    // Boolean Type [true | false]
        <key4>${EpochTime}</key4>
      </Data>
    </Values>
  </Event>
</EventInfo>
Parameter
Required
Description

<Enable>

Y

Sets activation status to true or false.

  • Default: false

<SourceStreamName>

Y

Specifies the target stream name.

  • It supports wildcards (*) for pattern matching.

<Interval>

Y

Sets event occurrence interval in milliseconds (ms).

<EventFormat>

Y

Specifies event format (use amf format).

<EventType>

N

Specifies the event type.

  • Default: video

<Values>

Y

Contains the value of the event data.

<Values><amfType>

N

Specifies message type (use onTextData format).

<Values><Data>

Y

Specifies the array of data to be transmitted

  • You can use the <key> tag, and if the type attribute is not specified, it defaults to string.

  • It supports the macro ${EpochTime}, which is replaced with the server's current epoch time in milliseconds when transmitted (e.g., 1747147513056).

Changes made to the event definition XML file are immediately applied without needing to restart OvenMediaEngine.

Payload Example

Here’s an example of an onTextData message payload encoded in AMF0. A Common Object (ECMA Array) consists of a list of key and value, where the value type can be String, Number, or Boolean.

string-maker "onTextData"         // Command Name ECMA Array: 
ecma-array-maker
"key1" string-maker "value"       // String Type
"key2" number-maker 354.1         // Number Type [Double]
"key3" boolean-maker 1            // Boolean Type [1 | 0]
...
object-end-marker
PreviousInsert SEI into H.264 (AVC) Streams | v0.18.0.0+NextInsert Ad Markers (EXT-X-CUE-OUT/EXT-X-CUE-IN) | v0.17.3.0+

Last updated 3 days ago