Push Publishing

OvenMediaEngine Enterprise supports Push Publishing function that can restreaming live streams to other systems. The protocol supports widely used protocols such as SRT, RTMP, and MPEG-2 TS.

The StreamMap feature has been added, and it now automatically re-streaming based on predefined conditions. You can also use the Rest API to control and monitor it.

Configuring Push Publishing

Push Publisher

To use Push Publishing, you need to configure <Push> under <Applications><Publishers> in Server.xml.

<Applications>
  <Application>
     ...
    <Publishers>
      ... 
      <Push>
         <!-- [Optional] -->
         <StreamMap>
           <Enable>false</Enable>
           <Path>path/to/map.xml</Path>
         </StreamMap>
      </Push>
      ...
    </Publishers>
  </Application>
</Applications>

The RTMP protocol only supports H264 and AAC codecs.

StreamMap

<StreamMap> is used for automatically pushing content based on user-defined conditions. The XML file path should be specified relative to <ApplicationPath>/conf.

XML Elements

Element
Requirement
Description

<StreamName>

Required

Used to match the output stream name.

  • Wildcard characters (*) are supported.

<VariantNames>

Required

Used to select specific tracks. If <VariantNames> is not specified, all tracks are transmitted by default.

  • Multiple variants can be specified using commas (,).

<Protocol>

Required

Supported protocols are srt, mpegts, and rtmp.

  • When using SRT or MPEG-TS, consider the network environment (e.g., firewalls, ports, packet loss, etc.).

  • When using RTMP, using H.264 + AAC is strongly recommended.

<Url>

Required

Specifies the destination address.

  • Macros are supported.

<StreamKey>

Optional

Specifies the stream key when required: RTMP

  • Macros are supported.

<TimestampMode>

Optional

(Enterprise Only)

Defines how timestamps are set for outgoing packets.

  • ZeroBased: Sends timestamps starting from 0 (zero) at the beginning of transmission.

  • Original (default): Sends timestamps identical to the original stream’s timestamps.

Macros

To improve automation and operational efficiency, we recommend actively using macros.

Macro
Description

${Application}

Application name

${SourceStream}

Source stream name

${Stream}

Output stream name

API Interface

Start Push Publishing

Request

POST /v1/vhosts/{vhost}/apps/{app}:startPush

Header

Body : SRT

In SRT Push Publisher, only the caller connection mode is supported.

Body : RTMP

Body : MPEG2-TS

Responses

200 Ok

The request has succeeded

Header

Body

Please note that responses are incorrectly returned in Json array format for version 0.15.3 and earlier.

400 Bad Request

Invalid request.

401 Unauthorized

Authentication required

Header

Body

404 Not Found

The given vhost or application name could not be found.

Body

409 Conflict

duplicate ID

Parameter
Requirement
Description

id

Required

A unique ID string used to identify the Push Publishing task.

  • Duplicate IDs are not allowed.

stream

Required

The output target stream information object.

stream.name

Required

Output stream name.

  • Example: "myStreamOut".

stream.variantNames

Optional

A list of track (variant) names to transmit.

  • If omitted or empty, the default behavior applies: all tracks are transmitted, or for RTMP, the first video track and the first audio track are selected.

protocol

Required

The protocol used for Push Publishing.

  • Example: "srt", "mpegts", "rtmp".

url

Required

Destination URL.

  • The format differs by protocol, and query string options can be used.

streamKey

Optional

Stream key for RTMP transmission.

  • Can be omitted for MPEG-TS transmission.

timestampMode

Optional

Configures the timestamp mode for outgoing packets.

  • ZeroBased: Sends timestamps starting from 0 (zero) at the beginning of transmission.

  • Original (default): Sends timestamps identical to the original stream’s timestamps.

Stop Push Publishing

Request

POST /v1/vhosts/{vhost}/apps/{app}:stopPush

Header

Body

Responses

200 Ok

The request has succeeded

Header

Body

400 Bad Request

Invalid request.

401 Unauthorized

Authentication required

Header

Body

404 Not Found

The given vhost/application name or id of recording task could not be found.

Body

Get Push Publishing State

Request

POST /v1/vhosts/{vhost}/apps/{app}:pushes

Header

Body

Responses

200 Ok

The request has succeeded

Header

Body

The response is Json array format.

401 Unauthorized

Authentication required

Header

Body

404 Not Found

The given vhost or application name could not be found.

Body

State of Push Publishing

State
Description

ready

Waiting for the stream to be created.

connecting

Connecting to destination

pushing

Connected and streaming

stopping

Disconnection / stop in progress

stopped

Push is disconnected / stopped

error

Push encountered an error

Last updated

Was this helpful?