SRT Ingest Setup and Usage

This article provides an overview of how to set up and use SRT for ingest into the Phenix system.

Prerequisites

  • Currently the Phenix platform operates in “Caller” mode. This means that your SRT encoder must support “Listener” mode and be configured for Listener mode.

  • Phenix requires a public IP address and port number to connect to your SRT encoder.

    • If your SRT encoder is behind a firewall or NAT, you will need to work with your IT/network administrator to enable access to the SRT port from the outside. This is a single UDP port, bi-directional, and can be any port number you choose.

Encoder Configuration for SRT Ingest

Your encoder's configuration must be set up to ensure that it is not introducing unnecessary latency. The number one issue that causes high latency is not using the correct low-latency settings on the local encoder.

Measure Latency

To characterize the latency of the encoder, try measuring the lag using ffplay with the "nobuffer" setting. Using ffplay is always recommended to determine the baseline latency when evaluating encoder settings. The argument will be similar to:

ffplay -fflags nobuffer <url>

If the latency is not extremely low, that indicates that the encoder is not configured correctly for low latency.

Encoding Settings

Check that encoder settings are set to the lowest possible values that will provide acceptable results, such as baseline profile, CBR, 5 Mbps, 1-second GOP size.

Phenix supports H.264-encoded video as ingest, and recommends using Constrained Baseline Profile up to Level 5.2 with a maximum frame size of 36864 macro-blocks for best performance. Be sure to verify that features such as scene change detection are not enabled to keep the encoding consistent. Some video feeds using may appear to work initially, but will fail when certain unsupported features are used (e.g., when the encoding is optimized for a high motion scene).

The source bitrate must be less than 8Mbps, with no spikes in the bitrate exceeding that value. There must be zerolatency interleaving, and no grouping of audio or video packets. The audio and video packets should be in strict increasing order based on the timestamp in the signal.

The audio must be 48kHz AAC, either mono or stereo.

When using single-bitrate output (i.e., when the multi-bitrate capability is not set), the video quality/resolution is not changed; that is, the same video quality input is the quality that is output.

For example, if FHD video is provided to Phenix via SRT, and the output quality is set to SD, the output will be FHD.

SRT Latency

SRT connection latency can be set in the URL. Note that SRT always auto-negotiates to the higher of the two values between sender and receiver.

FFMPEG

When using ffmpeg, be sure to use the zerolatency option to get real-time output. This is not set automatically. Without the zerolatency setting the encoder will introduce 0.5 seconds of end-to-end latency out of the gate. Please refer to the ffmpeg documentation for details.

API Usage

For details on API usage, please refer to https://phenixrts.com/docs/api/#publishing-a-uri.

cURL Example

An example cURL argument is:

curl --connect-timeout 3 -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer DIGEST:MySRTPublishToken" -X PUT --data '{ "uri": "srt://11.22.33.44" }' https://pcast.phenixrts.com/pcast/MyAppId/stream/publish/uri/srt

Where:

  • MySRTPublishToken is a token created for publishing via SRT ingest. See the discussion below about creating tokens for use in publishing via SRT.

  • 11.22.33.44 is the source URI from which content will be published

  • MyAppId is your application ID

Token Creation

This can be created using the Phenix EdgeAuth library or in the Phenix Customer Portal (https://phenixrts.com/portal).

EdgeAuth

When using the EdgeAuth library, generate a publish token (using the --publishingOnly argument) and include the capability "mpegts-unicast-ingest" in the "--capabilities" list.

For example:

node src/edgeAuth.js --applicationId "MyAppId" --secret 'MySecret' --expiresInSeconds 26000000 --channelAlias 'MyChannelAlias' --uri https://pcast.phenixrts.com --capabilities hd,publish-uri,mpegts-unicast-ingest --publishingOnly

Where:

  • MyAppId is your application ID

  • MySecret is the secret for your application ID

  • MyChannelAlias is the channel alias to which the SRT source will be published

Portal

To generate a token using the Portal, access the EdgeAuth screen from the channel for which you will be publishing the content. See the Customer Knowledge Base page on how to create tokens in the Portal for more information.

Add "mpegts-unicast-ingest" by selecting it in the Capabilities dialog.

 

Add other capabilities as you normally would.

Finally, under "Media Input", select "Remote Sources" and click "Generate".

Use the resulting "publishToken" as the token in the API.

Publishing Directly from the Portal

You can publish SRT streams directly from the Portal.

Access the Publish tab under either a Channel or a Room.

Enter the URI of the stream in the Source field. Select the desired quality (see note above), and any other capabilities as you normally would. When you click the Publish button, the Portal will attempt to publish from the URI provided.

Verify that the stream is being published by accessing either the Details or Preview screen.

Troubleshooting

If you encounter issues with the stream, first ensure that your stream meets the Encoding Settings as described above.

If your stream meets those settings and you are encountering jitter, freezing or pixelation, you may need to change the SRT buffer delay value. The SRT buffer delay is calculated based on ping time between your location and the nearest Phenix Point of Presence (PoP). Please contact Phenix to help determine this ping time and a recommended SRT buffer value.

©2020-2021 Phenix Real Time Solutions, Inc.