Address network congestion with stream sources using the Wowza Streaming Cloud REST API

The Wowza Streaming Cloud™ service typically receives incoming live video streams into a broadcast location near the encoder. Sending encoded live streams directly to servers at these regional hubs is usually the fastest way to start transcoding in Wowza Streaming Cloud.

An alternative, however, is to send your encoded live stream to a Akamai stream source through Wowza Streaming Cloud. Stream sources provide different entry points to Wowza Streaming Cloud transcoders. When an Akamai stream source is based on your encoder's IP address, it potentially gives your encoder an even closer entry to Wowza Streaming Cloud than the nearest broadcast location. If you experience network congestion or packet loss when you send live streams to a broadcast location in Wowza Streaming Cloud, try routing your encoded stream through an Akamai stream source using the Wowza Streaming Cloud REST API.

Determine latency up to Wowza Streaming Cloud


All live streams travelling from an encoder to the Wowza Streaming Cloud transcoder encounter some amount of network traffic. However, it shouldn't take more than 50 ms for an encoded stream to reach a Wowza Streaming Cloud transcoder. Start by determining if your stream is taking longer than that or experiencing packet loss by pinging the transcoder from your computer or encoder, or by running a traceroute.

Notes:
  • You can ping or traceroute streams being pushed to Wowza Streaming Cloud, not streams being pulled into Wowza Streaming Cloud. Streams that are pulled include RTMP and RTSP streams from IP cameras.
  • Stream sources receive streams over RTMP only. If you're trying to troubleshoot an RTSP connection to Wowza Streaming Cloud, you'll have to switch to an RTMP connection in order to use an Akamai stream source.
  1. Identify the domain name of the transcoder you want to ping or traceroute by fetching detailed information about the transcoder. You will need the ID of the transcoder.

    If you are using a live stream workflow, note that the ID of the live stream and its associated transcoder is the same value.
     
    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


    Fetch a transcoder
    curl -X GET -H "wsc-api-key: [key]" -H "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/transcoders/[transcoder_id]"
    The response includes detailed information about the transcoder and should look something like this. Make note of the domain_name value for the next steps.
    {
      "transcoder": {
        "id": "123bcdf",
        "name": "Stream Source Example",
        "transcoder_type": "transcoded",
        ...
        "protocol": "rtmp",
        "delivery_method": "push",
        "source_port": 1935,
        "domain_name": "1ab2cd.entrypoint.cloud.wowza.com",
        ...
        "outputs": [
          {
            "id": "abc70j2c",
            "name": "Video+Audio=Passthrough+128",
            ...
            "output_stream_targets": [
              {
                "id": "456m6j0s",
                ...
                "updated_at": "2018-04-26T15:06:10.000Z"
              }
            ]
          }
        ]
      }
    }
      
  2. Start the transcoder so that you can then ping or trace it. Before pinging, confirm that it's started.

    Example requests

    Start the transcoder
    curl -X PUT --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/transcoders/[transcoder_id]/start"
    Fetch the state of the transcoder
    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/transcoders/[transcoder_id]/state"
    The response will look something like this once the transcoder has started:
    {
      "transcoder": {
        "ip_address": "123.23.34.456",
        "state": "started",
        "uptime_id": "abcd1234"
      }
    }
    
  3. Ping the domain name of the transcoder from the computer running your encoder by doing one of the following:
    • (Windows) In a Command Prompt window, enter the command tracert domainname. For example:
      tracert 1ab2cd.entrypoint.cloud.wowza.com
    • (OS X) Open Network Utility, located in the /System/Library/CoreServices/Applications folder. Then, click the Ping or Traceroute tab, enter the Wowza Streaming Cloud domain name in the field provided, and click Ping or Trace.
    • (Linux) In a Terminal window, enter the command traceroute domainname. For example:
      traceroute 1ab2cd.entrypoint.cloud.wowza.com
  4. If the result is over 50 ms or shows packet loss, create an Akamai stream source based on your encoder's IP location.

Create a stream source based on your encoder's IP address


Wowza Streaming Cloud can create an Akamai stream source to receive your encoded stream based on your encoder's IP address, offering you the closest possible entry to the service. After you've determined that there's too much network congestion or your encoded streams are experiencing packet loss on their way to a Wowza Streaming Cloud broadcast location, create an Akamai stream source to receive the stream instead.

  1. Create a stream source with location_method set to ip_address, and include the IP address of the source encoder.

    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": "ip_address",
        "name": "MyStreamSource",
        "ip_address": "54.193.89.246"   }
    }' https://api.cloud.wowza.com/api/[version]/stream_sources/akamai
    The request creates an Akamai stream source and returns a response that includes details of the stream source, including its unique stream source ID. The response should look something like this.
      {
        "akamai_stream_source": {
          "id": "abc4b91n",
          "name": "MyStreamSource",
          "provider": "akamai_legacy_rtmp",
          "location_method": "ip_address",
          "ip_address": "54.193.89.246",
          "backup_ip_address": "54.193.89.246",
          "stream_name": "e585b0d6@",
          "playback_url": "e585b0d6@",
          "created_at": "2018-04-26T15:38:31.000Z",
          "updated_at": "2018-04-26T15:38:31.000Z"
        }
      }
    
    Notes:
    • Wowza Streaming Cloud creates a custom Akamai stream source based on your encoder's IP address. Custom Akamai stream sources typically take under 15 minutes to prepare but they may take up to 45 minutes.
    • The Akamai stream source has bitrate limit of 20 Mbps. See Calculating source encoding presets to ensure that your stream is within the bitrate limit.

Configure a live stream or transcoder to add a stream source


Now, update your live steam or transcoder to use the Akamai stream source you just created.

Reminder: Stream sources receive streams over RTMP only. If you're trying to troubleshoot an RTSP connection to Wowza Streaming Cloud, you'll have to reconfigure the live stream or transcoder to use RTMP in order to send it to a stream source.

Update your live stream to add a stream source

If you are using the live stream workflow, update your live stream to add and enable a stream source and ensure the delivery_method is cdn. If you need to update the source encoder to other_rtmp, you can do that in this step.

Example request and response

Update a live stream

curl -X PATCH --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
  "live_stream": {
  "stream_source_id": "abc4b91n",
  "use_stream_source": true,
  "delivery_method": "cdn"
  }
}' https://api.cloud.wowza.com/api/[version]/live_streams/[live_stream_id]
The response should look something like this. Make note of the primary server value.
{
  "live_stream": {
    "id": " 123bcdf",
    "name": "Stream Source Example",
    "transcoder_type": "transcoded",
    "billing_mode": "pay_as_you_go",
    "broadcast_location": "us_west_california",
    ...
    "encoder": "other_rtmp",
    "delivery_method": "cdn",
    "delivery_protocol": "hls-https",
    "target_delivery_protocol": "hls-https",
    ...
    "source_connection_information": {
    "primary_server": "rtmp://p.ep660684.i.akamaientrypoint.net/EntryPoint",
    "backup_server": "rtmp://b.ep660684.i.akamaientrypoint.net/EntryPoint",
    "host_port": 1935,
    "stream_name": "e585b0d6@660684",
    "username": "319499",
    "password": "828359112d"
    },
    "video_fallback": false,
    ...
    "stream_source_id": "abc4b91n",
    "stream_targets": [
      {
        "id": "cmqjjf9j"
       }
     ],
    "direct_playback_urls": {},
    "created_at": "2018-04-26T15:06:10.000Z",
    "updated_at": "2018-04-27T13:53:06.000Z",
  }
}

Update your transcoder to add a stream source

If you are using the transcoder workflow, update the transcoder to add a stream source and specify the delivery_method as cdn.

Example request and response

Update a transcoder

curl -X PATCH --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
  "transcoder": {
  "stream_source_id": "abc4b91n"
  "delivery_method": "cdn"
  } 
}' https://api.cloud.wowza.com/api/[version]/transcoders/[transcoder_ID]

The response should look something like this.

{
  "transcoder": {
    "id": "123bcdf",
    "name": "Stream Source Example",
    "transcoder_type": "transcoded",
    ...
    "protocol": "rtmp",
    "delivery_method": "cdn",
    "source_port": 1935,
    "stream_source_id": "nmk4b91n",
    "domain_name": "p.ep660684.i.akamaientrypoint.net/EntryPoint",
    "application_name": "EntryPoint",
    "stream_name": "e585b0d6@660684",
    ...
    "outputs": [
      {
        "id": "abc70j2c",
        "name": "Video+Audio=Passthrough+128",
        ...
        "output_stream_targets": [
          {
            "id": "456m6j0s",
            ...
            "updated_at": "2018-04-26T15:06:10.000Z",
            },
          }
        ],
      }
    ],
  }
}

Test the connection to the stream source


Ping or traceroute the new primary server of the stream source to see if the connection has improved. If it has, start the live stream or transcoder.