IVS RTMP Publishing | Real-Time Streaming - Amazon IVS

IVS RTMP Publishing | Real-Time Streaming

This document outlines the process of publishing to an IVS stage using RTMP. For additional details on various ingest options, refer to the Stream Ingest documentation

Create Stage

To create a stage, use the following command:

aws ivs-realtime create-stage --name "test-stage"

See CreateStage for details, including the response.

Important: In the response, note the endpoints field, which lists both RTMP and RTMPS endpoints. These are required for setting up your RTMP encoder.

Create an Ingest Configuration

To publish to a stage using RTMP, you must first create an ingest configuration and associate it with your stage. When you publish to the stage (using the stream key from the ingest configuration and the RTMP endpoint from the stage), the media will be published to the stage as a participant. You have the option to specify a userId and custom attributes, which will be associated with the participant that connects to the stage.

aws ivs-realtime create-ingest-configuration --name 'test' --stage-arn arn:aws:ivs:us-east-1:123456789012:stage/8faHz1SQp0ik --user-id = '123'

See CreateIngestConfiguration for details, including the response.

When creating an ingest configuration, you can associate it with a specific stage ARN up front. Without this association, the stream key is unusable. Also, ingest configurations (including the stageArn field) can be updated via the UpdateIngestConfiguration endpoint, allowing you to reuse the same configuration for different stages.

Note: The ingest configuration insecureIngest field defaults to false, requiring the use of RTMPS. RTMP connections will be rejected. If you must use RTMP, set insecureIngest to true. We recommend using RTMPS unless you have specific and verified use cases that require RTMP.

Publish Using an RTMP Encoder

This example demonstrates how to use OBS Studio; however, you can use any RTMP encoder that meets the IVS media specifications.

  1. Download and install the software: "https://obsproject.com/download.

  2. Click Settings. In the Stream section of the Settings panel, select Custom from the Service dropdown.

  3. For the Server, enter the RTMP or RTMPS endpoint from the stage.

  4. For the Stream Key, enter the streamKey from the ingest configuration.

  5. Configure your video settings as you normally would, with a few restrictions:

    1. IVS real-time streaming supports input up to 720p at 8.5 Mbps. If you exceed either of these limits, your stream will be disconnected.

    2. We recommend setting your Keyframe Interval in the Output panel to 1s or 2s. A low keyframe interval allows video playback to start more quickly for viewers. We also recommend setting CPU Usage Preset to veryfast and Tune to zerolatency, to enable the lowest latency.

    3. Because OBS does not support simulcast, we recommend keeping your bitrate below 2.5 Mbps. This enables viewers on lower-bandwidth connections to watch.

    4. Disable B-frames, as streams with B-frames will be automatically disconnected. Do one of the following:

      • In x264 options, enter bframes=0 sliced-threads=0.

      • Set B-frames to 0 if it is an option (e.g., for NVENC).

  6. Select Start Streaming

Important: If your encoder’s maximum bitrate is set to 8.5 Mbps, the publisher occasionally disappears from the session. This is because the maximum bitrate setting is only a target, and encoders occasionally go over the target. To prevent this, set your encoder’s maximum bitrate lower; e.g. to 6 Mbps.