> ## Documentation Index
> Fetch the complete documentation index at: https://red5.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish Streams to Red5 Cloud via RTMP and WebRTC

> Configure RTMP and WebRTC (WHIP) encoders to publish live streams to Red5 Cloud, including OBS settings, codec recommendations, and FFmpeg command examples.

Red5 Cloud accepts live streams over two ingest protocols: **RTMP** for traditional software and hardware encoders, and **WebRTC via WHIP** for browser-based or WebRTC-native publishers. Both deliver low-latency streams to your Red5 Cloud deployment. Your publishing endpoint for either protocol is available in the **Pub/Sub Details** of your deployment.

<Tabs>
  <Tab title="RTMP">
    ## RTMP encoding

    Real-Time Messaging Protocol (RTMP) is a TCP-based protocol with persistent connections and broad support across encoders, hardware capture cards, and streaming software. It is the most common way to send a live stream from a desktop or on-premises encoder to a streaming server.

    ### Getting your RTMP endpoint

    <Steps>
      <Step title="Open Pub/Sub Details">
        In the Management Console, open the **context menu** for your deployment and select **Pub/Sub Details**.
      </Step>

      <Step title="Copy the RTMP Publishing Endpoint">
        The **RTMP Publishing Endpoint** is shown in the format:

        ```text theme={null}
        rtmp://<server-ip>/live
        ```

        The stream key you use in your encoder becomes the stream name on Red5 Cloud.
      </Step>
    </Steps>

    ### Recommended video settings

    | Setting               | Recommendation               |
    | --------------------- | ---------------------------- |
    | **Video codec**       | H.264                        |
    | **H.264 profile**     | Baseline (disables B-frames) |
    | **Keyframe interval** | 2 seconds                    |

    <Warning>
      Do not use H.264 profiles that include B-frames (such as High or Main) when delivering to WebRTC subscribers. B-frames cause playback to jump back and forth. Use the Baseline profile or explicitly disable B-frames in your encoder.
    </Warning>

    #### Recommended video bitrates

    | Resolution / FPS | Bitrate            |
    | ---------------- | ------------------ |
    | 360p @ 30fps     | 500–800 kbps       |
    | 480p @ 30fps     | 800–1,200 kbps     |
    | 720p @ 30fps     | 2,000–2,500 kbps   |
    | 720p @ 60fps     | 2,500–3,050 kbps   |
    | 1080p @ 30fps    | 3,500–4,500 kbps   |
    | 1080p @ 60fps    | 4,500–6,000 kbps   |
    | 4K @ 30fps       | 10,000–12,000 kbps |
    | 4K @ 60fps       | 12,000–14,000 kbps |

    ### Recommended audio settings

    | Setting             | Recommendation                                |
    | ------------------- | --------------------------------------------- |
    | **Preferred codec** | AAC                                           |
    | **Fallback codec**  | MP3 (only if AAC is unavailable)              |
    | **Stereo bitrate**  | 128 kbps minimum; 192 kbps for higher quality |

    ### Publishing with OBS Studio

    <Steps>
      <Step title="Open OBS Settings">
        In OBS Studio, go to **File → Settings → Stream**.
      </Step>

      <Step title="Set service to Custom">
        Set **Service** to `Custom...`.
      </Step>

      <Step title="Enter the server URL">
        Paste your **RTMP Publishing Endpoint** into the **Server** field.
      </Step>

      <Step title="Set the stream key">
        Enter your desired **stream name** as the **Stream Key** (for example, `myStream`).
      </Step>

      <Step title="Configure output settings">
        Go to **Settings → Output → Encoding**. Select **H.264**, set the profile to **Baseline**, and choose a bitrate from the table above that matches your target resolution.
      </Step>

      <Step title="Start streaming">
        Click **Start Streaming** in the OBS main window.
      </Step>
    </Steps>

    ### Publishing with FFmpeg

    ```bash theme={null}
    ffmpeg \
      -re \
      -i input.mp4 \
      -c:v libx264 \
      -profile:v baseline \
      -preset veryfast \
      -b:v 2500k \
      -g 60 \
      -c:a aac \
      -b:a 128k \
      -f flv \
      rtmp://<server-ip>/live/myStream
    ```

    Replace `<server-ip>` with your RTMP Publishing Endpoint host and `myStream` with your chosen stream name.
  </Tab>

  <Tab title="WebRTC (WHIP)">
    ## WebRTC (WHIP) encoding

    WebRTC HTTP Ingest Protocol (WHIP) is a standardized way to push a WebRTC stream to a server over a simple HTTP POST. WHIP works natively in modern browsers, making it the easiest path for browser-based publishing without any plugins or additional software.

    ### Getting your WHIP endpoint

    <Steps>
      <Step title="Open Pub/Sub Details">
        In the Management Console, open the **context menu** for your deployment and select **Pub/Sub Details**.
      </Step>

      <Step title="Copy the WHIP Publishing Endpoint">
        The **WHIP Publishing Endpoint** is shown in the format:

        ```text theme={null}
        https://<server-host>/live/myStream
        ```

        Replace `myStream` with the stream name you want to use.
      </Step>
    </Steps>

    ### Recommended video settings

    | Setting               | Recommendation               |
    | --------------------- | ---------------------------- |
    | **Video codec**       | H.264                        |
    | **H.264 profile**     | Baseline (disables B-frames) |
    | **Keyframe interval** | 2 seconds                    |

    #### Recommended video bitrates

    | Resolution / FPS | Bitrate            |
    | ---------------- | ------------------ |
    | 360p @ 30fps     | 500–800 kbps       |
    | 480p @ 30fps     | 800–1,200 kbps     |
    | 720p @ 30fps     | 2,000–2,500 kbps   |
    | 720p @ 60fps     | 2,500–3,050 kbps   |
    | 1080p @ 30fps    | 3,500–4,500 kbps   |
    | 1080p @ 60fps    | 4,500–6,000 kbps   |
    | 4K @ 30fps       | 10,000–12,000 kbps |
    | 4K @ 60fps       | 12,000–14,000 kbps |

    ### Recommended audio settings

    | Setting             | Recommendation                                        |
    | ------------------- | ----------------------------------------------------- |
    | **Preferred codec** | AAC                                                   |
    | **Fallback codec**  | Opus (Red5 Cloud transcodes Opus to AAC for delivery) |
    | **Stereo bitrate**  | 128 kbps minimum; 192 kbps for higher quality         |

    <Info>
      If your browser or WebRTC client sends Opus audio, Red5 Cloud automatically transcodes it to AAC before delivering to subscribers. No additional configuration is required on your end.
    </Info>

    ### Publishing from a browser

    Most modern browsers (Chrome, Firefox, Safari, Edge) support WHIP publishing using the browser's `getUserMedia` API combined with `RTCPeerConnection`. Point your WHIP client at the **WHIP Publishing Endpoint** from your Pub/Sub Details.

    The embedded player code in Pub/Sub Details also provides a ready-made starting point for browser-based publishers and subscribers.

    ### Publishing with FFmpeg (WHIP)

    Recent versions of FFmpeg support WHIP output natively:

    ```bash theme={null}
    ffmpeg \
      -re \
      -i input.mp4 \
      -c:v libx264 \
      -profile:v baseline \
      -preset veryfast \
      -b:v 2500k \
      -g 60 \
      -c:a aac \
      -b:a 128k \
      -f whip \
      https://<server-host>/live/myStream
    ```

    Replace `<server-host>` and `myStream` with the values from your WHIP Publishing Endpoint.
  </Tab>
</Tabs>

## Choosing between RTMP and WHIP

|                     | RTMP                            | WebRTC (WHIP)                              |
| ------------------- | ------------------------------- | ------------------------------------------ |
| **Best for**        | Desktop encoders, OBS, hardware | Browser-based apps, low-dependency clients |
| **Protocol**        | TCP                             | UDP / HTTP                                 |
| **Latency**         | Low (\~2–5 s)                   | Sub-second                                 |
| **Encoder support** | Very broad                      | Growing rapidly                            |

<Tip>
  For the lowest possible glass-to-glass latency, use WHIP for ingest and WHEP for playback. For maximum encoder compatibility and a proven workflow, use RTMP.
</Tip>
