Build a redundant workflow with stream sources using the Wowza Streaming Cloud REST API

One of the best ways to prevent playback disruptions is to build redundancy into your production workflow by using multiple source encoders. That way, if one encoder breaks or disconnects from the transcoder, the second device can continue to supply the source video.

When you use two encoders with the Wowza Streaming Cloud™ service, you can connect one to a primary stream entry point and one to a backup stream entry point by using an Akamai stream source. An Akamai stream source receives an encoded H.264 RTMP stream at a CDN entry point and sends it to the Wowza Streaming Cloud transcoder. If the video source fails at one stream entry point, Wowza Streaming Cloud can continue to receive and process the source video on the second, backup entry point, ensuring that playback continues uninterrupted for viewers. Another benefit of using an Akamai stream source is that you can restart one of the encoders while your stream continues to run on the other, again without disruption to viewers.

Use a stream source with a live stream


To use an Akamai stream source with a live stream, you must send your encoded video to Wowza Streaming Cloud using an RTMP connection.

  1. Create a live stream with a stream source.
     
    Notes:
    • For [key], substitute your API key or your access key as appropriate. For more information, see Locating and using API and access keys.
    • For [version], substitute the version number of the API that you're using. For the current version, use v1.2.

    Example request and response
     

    curl -X POST --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
    "live_stream": {
        "aspect_ratio_height": 1080,
        "aspect_ratio_width": 1920,
        "billing_mode": "pay_as_you_go",
        "broadcast_location": "us_west_california",
        "encoder": "other_rtmp",
        "name": "Live Stream with Stream Source",
        "transcoder_type": "transcoded",
        "password": "68332313",
        "player_type": "wowza_player",
        "player_width": 640,
        "target_delivery_protocol": "hls-https",
        "use_stream_source": true,
        "username": "client2"
      }
    }' https://api.cloud.wowza.com/api/[version]/live_streams
    This creates an Akamai stream source at the same time as the live stream, including source connection information that you will use to set up your source encoders. The response should look something like this:
    {
      "live_stream": {
        "id": "4kfvabcd",
        "name": "Live Stream with Stream Source",
        "transcoder_type": "transcoded",
        ...
        "encoder": "other_rtmp",
        "delivery_method": "cdn",
        "delivery_protocol": "hls-https",
        "target_delivery_protocol": "hls-https",
        "use_stream_source": true,
        ...
        "source_connection_information": {
          "primary_server": "rtmp://p.ep657053.i.akamaientrypoint.net/EntryPoint",
          "backup_server": "rtmp://b.ep657053.i.akamaientrypoint.net/EntryPoint",
          "host_port": 1935,
          "stream_name": "e3362e18@657053",
          "username": "319499",
          "password": "e344f260fa"
        },
        ...
        "stream_source_id": "n94wwxyz",
        "stream_targets": [
          {
          "id": "sh18kybc"
          }
        ],
        "direct_playback_urls": {},
        "created_at": "2018-04-27T14:16:41.000Z",
        "updated_at": "2018-04-27T14:16:41.000Z"
      }
    }
  2. Use the following information from the source connection information when setting up your source encoders:
    • Use the primary server URL for your first source encoder.
    • Use the backup server URL for your second source encoder.
    • Use the stream name, username, and password with both source encoders.
    Note: Each Akamai stream source configuration has total bitrate limit of 40 Mbps. This is the sum of the 20 Mbps limit for the primary entry point and the 20 Mbps limit for the backup entry point. See Calculating source encoding presets to ensure that your stream is within the bitrate limit.

Use a stream source with a transcoder


  1. Create the Akamai stream source.

    Example request and response

    Create an Akamai stream source
    curl -X POST --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
     "akamai_stream_source": {
        "location_method": "region",
        "name": "Redundant workflow stream source",
        "location": "us_west_california"
       } 
    }' https://api.cloud.wowza.com/api/[version]/stream_sources/akamai

    This creates an Akamai stream source with primary and backup URLs. Note the stream source ID. The response should look something like this:
    {
      "akamai_stream_source": {
        "id": "cdeypf6w",
        "name": "Redundant workflow stream source",
        "provider": "akamai_legacy_rtmp",
        "location_method": "region",
        "location": "us_west_california",
        "ip_address": "54.183.109.81",
        "backup_ip_address": "54.183.109.81",
        "stream_name": "e248573d@660774",
        "username": "319499",
        "password": "b4408f2034",
        "primary_url": "rtmp://p.ep660774.i.akamaientrypoint.net/EntryPoint",
        "backup_url": "rtmp://b.ep660774.i.akamaientrypoint.net/EntryPoint",
        "playback_url": "rtmp://cp319499.live.edgefcs.net/live/e248573d@660774",
        "created_at": "2018-04-27T02:48:27.000Z",
        "updated_at": "2018-04-27T14:38:51.000Z",
      }
    }
    1. Create the transcoder with a delivery method of cdn, and associate it with the stream source ID.

      Example request and response

      Create a transcoder
      curl -X POST --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
        "transcoder": {
          "billing_mode": "pay_as_you_go",
          "broadcast_location": "us_west_california",
          "buffer_size": 4000,
          "delivery_method": "cdn",
          "name": "Transcoder for Stream Source Redundant Workflow",
          "protocol": "rtmp",
          "stream_source_id": "cdeypf6w",
          "transcoder_type": "transcoded"
          } 
        }' https://api.cloud.wowza.com/api/[version]/transcoders
      

      This creates a transcoder that's associated with the existing Akamai stream source.
      {
        "transcoder": {
          "id": "rbgsckfg",
          "name": "Transcoder for Stream Source Redundant Workflow",
          "transcoder_type": "transcoded",
          ...
          "protocol": "rtmp",
          "delivery_method": "cdn",
          "source_port": 1935,
          "stream_source_id": "cdeypf6w",
          "domain_name": "p.ep660774.i.akamaientrypoint.net/EntryPoint",
          "application_name": "EntryPoint",
          "stream_name": "e248573d@660774",
          "delivery_protocols": [
            "rtmp",
            "rtsp",
            "wowz",
            "hls"
          ],
          "buffer_size": 4000,
          ...
          "username": "319499",
          "password": "b4408f2034",
          "watermark": false,
          "created_at": "2018-04-30T18:52:20.000Z",
          "updated_at": "2018-04-30T18:52:20.000Z",
          "direct_playback_urls": {},
          "outputs": [],
        }
      }
  2. Complete the transcoder by adding outputs and stream targets. For instructions, see one of the following articles, depending on whether you're creating an adaptive bitrate stream or passthrough stream:

Configure, connect, and test your video sources


Configure your source encoders as follows.

  • Choose the same model or device. It's easier to set them up quickly and achieve consistent video quality.
  • Use the same encoding presets/configurations in both source encoders. For guidelines, see the article Encode source video for Wowza Streaming Cloud.
  • Make sure that both encoders are keyframe- and timecode-aligned. Sync the encoders with a genlock device or connector and make sure that both encoders use the same time server. Genlocking synchronizes (locks) the output of the encoders to an externally generated (gen) signal.
  • If possible, set up the encoders on different networks. If they're on the same network and the network goes down, both sources will lose connectivity to Wowza Streaming Cloud and your redundant source set up won't matter.
  • Use a network monitoring tool on both source encoders to ensure that they connect to Wowza Streaming Cloud.
  • If possible, use a wired connection between your encoders and your router(s). Ethernet provides more reliable, consistent local bandwidth than Wi-Fi.
  • Check your firewall software to make sure that it won't interfere with your encoder or production workflow.
  • If possible, set up redundant power supplies. Backups and redundancy for all aspects of your production setup reduce the likelihood of disruptions and failures.
  • Test your redundant streaming setup in advance. Run the primary and backup encoders with a test stream for at least 30 minutes each. Manually bring down one source encoder and then the other to ensure the switchover works correctly.
  • Make sure your encoders are set to auto-reconnect.

About Playback


The stream source has a single RTMP playback URL that is automatically scaled and load-balanced by Wowza Streaming Cloud. This playback URL will deliver a single bitrate stream to the transcoder. It can also be used for legacy RTMP playback, but you should only use RTMP playback if you fully understand its limitations (for example, it's not supported on iOS devices).

To view the RTMP playback URL, fetch details about an Akamai stream source.

curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/stream_sources/akamai[akamai_stream_source_id]

In addition, if you created a live stream, you can use the player or hosted web page and the live stream's Apple HLS and Adobe HDS playback URLs to view the stream.

If you created a transcoder, you can use the stream target or targets you've configured for the transcoder.