RTMP Ingest Setup and Usage
This article provides an overview of how to set up and use Phenix's RTMP ingest.
Since an RTMP stream is sent from an encoder to Phenix via RTMP, the encoder must be set up to send its output to Phenix. This means that, while the Phenix Customer Portal can be used to obtain information such as the stream key, the Portal's Publish URI tab cannot be used to publish RTMP to the Phenix platform.
RTMP publishing requires a stream key. For instructions on how to find your stream key, see How do I find my stream key?.
Default RTMP publishing capabilities can be set when creating a Channel or a Room. If capabilities are passed with the RTMP stream key, these default settings will be ignored.
Encoder Configuration for RTMP 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.
For details on setting up your source, please refer to the page for your encoder (see the menu on the left).
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, MPEG-2 ADTS, not MPEG-4 LOAS/LATM.
Single-Bitrate Output
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 RTMP, and the output quality is set to SD, the output will be FHD.
-
Set bitrate output higher than the Phenix target bitrate for your desired quality level from the supported quality capabilities. Examples:
- When
sd
capability is set in the stream key, Phenix targets 830kbps, so the RTMP encoder should be set to output 1,500kbps - When
hd
capability is set in the stream key, Phenix targets 1,600kbps, so the RTMP encoder should be set to output 2,500kbps. - When
fhd
capability is set in the stream key, Phenix targets 3,000kbps, so the RTMP encoder should be set to output 5,000kbps.
- When
-
Frame rate: set to 30
- Certain video encoding/decoding pipelines will buffer a certain number of frames
-
Keyframe interval: set to 1 second
-
For x264 encoding, CPU Usage Preset: set to
veryfast
-
Profile: set to baseline
-
Tune
- OBS: set to zerolatency
- Wirecast: set x264 command line options →
-tune zerolatency
In OBS, these recommended settings will look like the following:
API Usage
For details on API usage, please refer to the RTMP REST API.
Example
An example RTMP URL is:
rtmp://ingest.phenixrts.com:80/ingest/96characterStreamKey;capabilities=hd,multi-bitrate,tags=my-awesome-stream-id
Where 96characterStreamKey
is the stream key to be used when publishing, which can be found in the Customer Portal under the Properties tab for a Channel or Room.
RTMP Push Instructions
Base URL: rtmp://ingest.phenixrts.com:80/ingest/
Streamkey Structure:
<streamkey><separator><Phenix RTMP Ingest Options>
where the separator can be either be a semicolon ;
or a pipe |
. See RTMP Ingest Options for additional details.
Typical Example:
rtmp://ingest.phenixrts.com:80/ingest/KK7rLBnoTaReAlvaLidStreAmkeYQCE1wRl;capabilities=hd,multi-bitrate;tags=myStreamTag
Common Capabilities:
- Set desired highest quality layer with
sd
(standard definition),hd
(high definition), orfhd
(full high definition) - Include the
multi-bitrate
capability to automatically transcode to multiple quality layers for ABR delivery - Include
streaming
capability to create HLS and DASH formatted streams available if applicable
Related Documentation:
In OBS, the recommended settings will look like the following:
Character Limit
OBS limits the length of the stream key + capabilities string to 255 characters. Any capabilities that are completely or partially (e.g., one character too long) over that limit will not be used.
If you choose not to specify any capabilities, the following default
capabilities will be used: fhd,multi-bitrate,playout-buffer=PT0.23S,high-fidelity
If some capabilities are specified, but quality layer is not, then the sd
quality layer will be used.