Publishing Real-Time Video via WHIP to Amazon IVS



This content originally appeared on DEV Community and was authored by Todd Sharp

Traditionally, Amazon IVS real-time stages are used in mobile or web applications. For these types of applications, we offer great SDKs for web, iOS and Android. But sometimes your application isn’t a web or mobile application. Or, sometimes your viewers are on web or mobile but your publisher isn’t. There are several use cases that could fall into the “need to publish from something other than a browser or mobile application” bucket, and in this post I’d like to highlight a few various options. All of the options that we’ll look at below are possible because Amazon IVS stages supports the WebRTC-HTTP Ingest Protocol (WHIP). So if you’re looking to broadcast from a desktop app, headless server, or any other platform that supports WHIP, read on to learn more!

Create a Stage

Before we can test out any of the following methods, we’ll need to first create an Amazon IVS real-time stage. We can create a stage and a single participant token for testing out all of the methods below with the following command via the AWS CLI.

aws ivs-realtime create-stage \
  --name "whip-demo-stage" \
  --participant-token-configurations \
    userId=demo-whip-broadcaster,capabilities=PUBLISH,SUBSCRIBE,duration=720

This will give us output similar to the following:

{
    "stage": {
        "arn": "arn:aws:ivs:us-east-1:[redacted]:stage/[redacted]",
        "name": "whip-demo-stage",
        "tags": {},
        "autoParticipantRecordingConfiguration": {
            ...
        },
        "endpoints": {
            "whip": "https://f99084460c35.global-bm.whip.live-video.net",
            ...
        }
    },
    "participantTokens": [
        {
            "participantId": "[redacted]",
            "token": "eyJhbGciOiJLTVMiLCJ0eXAiOiJKV1QifQ.[redacted]",
            "userId": "demo-whip-broadcaster",
            "duration": 720,
            "capabilities": [
                "PUBLISH",
                "SUBSCRIBE"
            ]
        }
    ]
}

I’ve removed some bits for brevity, but the important part going forward is the token value. Take note of these and let’s dig into the various options.

⚠ Note: You’ll notice that the WHIP endpoint returned is not the WHIP endpoint that we’ll use below. The one we’ll use is a global endpoint (https://global.whip.live-video.net) which is load-balanced and will ultimately redirect to the most appropriate endpoint for each session. For more information, refer to the docs.

1⃣ Broadcasting with OBS

Broadcasting via WHIP with OBS is quite easy! In Settings -> Stream, choose WHIP under Service. Then enter the https://global.whip.live-video.net as the endpoint for your stage and your participant token as the Bearer Token. For best performance, make sure your stream matches the recommended settings in the IVS docs.

OBS Settings

We’re ready to start streaming! Click Start Streaming, then go to the stage details in the AWS console to view your stream.

OBS Console Subscribe

For the next few options, we’ll be using the command line. To simplify the inputs, set your stage token as an environment variable.

$ export STAGE_TOKEN=eyJhbGciOiJLTVMiLCJ0eXAiOiJKV1QifQ.[redacted]

2⃣ Broadcasting with Python’s aiortc

Another option for broadcasting to a stage with WHIP is aiortc which is a library for Web Real-Time Communication (WebRTC) and Object Real-Time Communication (ORTC) in Python. With aiortc, we can publish from a user’s webcam and microphone, or by using a pre-recorded video. I recently published a full repo of demos showing various use cases of aiortc with Amazon IVS, and to test out publishing an MP4, refer to the ivs-stage-publish.py script in that repo. Once you’ve checked out the project and configured it as necessary, you can publish an MP4 like this:

python ivs-stage-publish.py \
  --token $STAGE_TOKEN \
  --path-to-mp4 /path/to/an.mp4

The script output is pretty detailed, but once you see the following message, your video is ready to view.

2025-08-29 10:44:16,786 - INFO - 🎉 WebRTC publishing established!

aiortc console view

3⃣ Broadcasting with FFMPEG

Another option, which is relatively new, is to broadcast to an Amazon IVS stage via FFMPEG. Back in June FFMPEG merged the long-outstanding WHIP muxer into the mainline repo. You’ll need to compile it from source to enable WHIP (make sure to include the --enable-muxer=whip and --enable-libharfbuzz options). Once it’s compiled you can use the same endpoint and token from earlier to publish an MP4.

ffmpeg -re -stream_loop -1 \
  -i /path/to/an.mp4 \
  -c:v libx264 -profile:v baseline -c:a copy \
  -f whip -authorization "$STAGE_TOKEN" \
  "https://global.whip.live-video.net"

Again, take a look at the AWS console to view your stream. (Yes, I’m using the same picture from earlier – it’s literally the same result 😆).

ffmpeg console view

4⃣ Broadcasting with srtc

The final option that we’ll look at in this post is an open-source library called srtc (repo). This is a “simple” WebRTC implementation written in C++ as a side project by Kostya Vasilyev, one of the brilliant Amazon IVS engineers. You can use the library to create your own WebRTC application, but for simple testing you can download the latest release for your OS and the sintel.h264 file from the release page. Then, you can publish a test stream with the srtc_publish binary.

$ ./srtc_publish --url https://global.whip.live-video.net --token $STAGE_TOKEN --file ./sintel.h264 --loop
*** Using source file: ./sintel.h264
*** Using WHIP URL:    https://global.whip.live-video.net
*** Loading ./sintel.h264
*** PeerConnection state: connecting
*** PeerConnection state: connected
Played    25 video frames

🔇 Note: The command line demo publishes video only. The project is intended to be used as a dependency for building your own applications, so audio is not included in the command line demo utility.

Again, preview the stream in the AWS console.

srtc preview

Summary

In this post, we’ve looked at several ways to publish to an Amazon IVS real-time stage using the WebRTC HTTP Ingest Protocol (WHIP). I hope this post helped you to realize the possibilites of WebRTC and real-time streaming outside of traditional web and mobile applications and maybe inspired you to think beyond the “usual” approach to publishing real-time video. If you have questions, or ideas about how you might use WHIP with Amazon IVS, please share them below!


This content originally appeared on DEV Community and was authored by Todd Sharp