RTMP Live Stream Input Requirements

This page outlines the key requirements and expectations for handling RTMP live streams with Bitmovin’s Live Encoding service. It provides essential guidance for ensuring proper input compliance and understanding how to address potential issues when streams do not meet these requirements.

Why Input Compliance Matters

Bitmovin’s encoder delivers high-quality outputs by relying on correctly formatted and consistent input streams. RTMP streams that deviate from these standards may result in issues such as audio-video synchronization problems, dropped frames, or processing errors. Understanding and meeting the following requirements will help avoid common pitfalls.

RTMP Input Requirements

Stream Format

To ensure smooth processing, RTMP streams must:

  • Follow RTMP Protocol: The stream must adhere to the Real-Time Messaging Protocol (RTMP) specification, including:
    • Proper handshakes (C0, C1, C2 sequence).
    • Standard chunking and message structures.
  • Use Supported Codecs: The stream must use codecs supported by Bitmovin. Refer to the Supported Input and Output Formats page for details.
  • Maintain Format Consistency: Codec and format parameters, such as resolution and frame rate, must not change during the stream. A constant frame rate (CFR) is expected and mandatory.

Packetization and Timing

  • Correct Timestamps: Packets must have monotonically increasing timestamps without any backward jumps.
  • Keyframe Interval: Streams should include periodic keyframes (I-frames) to allow for proper seeking and stream recovery. A keyframe interval of 2–5 seconds is typical.
  • Audio-Video Sync: The input stream must ensure that audio and video remain synchronized at the source. Significant drift may lead to playback or transcoding issues.

Connection and Transport

  • Handshake and Connection: The server must correctly implement the RTMP handshake sequence (C0, C1, C2) as per the RTMP specification. This includes negotiating the protocol version.
  • Chunk Sizes: Default RTMP chunk size is 128 bytes, but this can be negotiated during the handshake. We expect consistent chunk sizes throughout the session.

Stream Metadata

Streams must provide accurate metadata in AMF (Action Message Format), including:

  • Video Resolution: Width and height of the video.
  • Framerate: Frames per second.
  • Audio Details: Codec, sample rate, and channels.

Framerate Handling:

  • We use the framerate for various fallback handlings (such as - but not limited to - gap filling). The framerate is read from the AMF metadata.
  • The Bitmovin encoder uses a heuristic approach to handle discrepancies:
    • If the metadata or calculated r_base_frame_rate matches a commonly used value, it is prioritized.
    • If neither is plausible, the system uses the first valid value that is not zero.

Error Handling

  • Packet Loss Tolerance: Minor packet loss is handled gracefully. However, severe loss or malformed packets may cause dropped frames or processing errors.
  • Reconnection: The encoder attempts to reconnect automatically if the RTMP connection drops.
  • Buffering: Some buffering is employed to mitigate jitter and bitrate variations. Excessive jitter or highly variable bitrates may still impact processing.

What Happens With Non-Compliant Streams?

When input streams do not meet the outlined requirements, issues may arise, such as:

  • A/V Sync Errors: Caused by incorrect timestamps or drift.
  • Frame Drops: Due to missing keyframes or malformed packets.
  • Metadata Conflicts: Leading to fallback mechanisms that may not produce the expected results.

Bitmovin’s encoder includes several corrective measures designed to address common issues found in user-generated content (UGC). These measures help mitigate problems such as inconsistent metadata or minor synchronization issues.

However, streams that deviate significantly from the outlined requirements may still result in issues that cannot be fully corrected by the encoder. Ensuring compliance at the source remains essential to achieve optimal results.

Best Practices for Streamers

To ensure the best results with Bitmovin’s encoding service:

  • Validate Your Stream: Use tools to verify that your RTMP stream complies with the specifications outlined here.
  • Include Keyframes: Configure your encoder to insert periodic I-frames (typically 2–5 seconds).
  • Monitor Sync: Test audio-video synchronization at the source.

If issues persist, provide detailed information to the Bitmovin support team, including logs, metadata, and a sample stream for analysis.