Speed up the connection to a transcoder with the Wowza Streaming Cloud REST API

Learn how to use the REST API to speed up the connection between a source encoder and a transcoder. When configuring an encoder to push video to a transcoder in the Wowza Streaming CloudTM service, you must enter a host server location, usually a URL, in the encoder settings. After starting the connection between the encoder and the transcoder, there may be a delay of up to 10 seconds while a DNS server looks up the URL of the host server and resolves it to an IP address. You can remove this delay by using the Wowza Streaming Cloud REST API to identify the IP address of the transcoder's host server and then entering the IP address into your encoder settings directly.

Contents


Create a transcoder
Start the transcoder
Fetch the IP address of the transcoder's host server
Enter the IP address in the encoder settings
Connect the encoder to the transcoder

Create a transcoder


  1. Using the Wowza Streaming Cloud REST API, create a transcoder that receives video from a source encoder using the push delivery method.
     

    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

    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",
         "delivery_method": "push",
         "name": " MyQuickStartTranscoder",
         "protocol": "rtsp",
         "transcoder_type": "transcoded"
       } 
    }' "https://api.cloud.wowza.com/api/[version]/transcoders"
    The command creates a transcoder and returns a response that includes details of the transcoder, including its unique transcoder ID. The response should look something like this:
     
    {
      "transcoder": {
        "application_name": "app-1234",
        "billing_mode": "pay_as_you_go",
        "broadcast_location": "us_west_california",
        ...
        "delivery_method": "push",
        ...
        "domain_name": "[host_name].entrypoint.cloud.wowza.com",
        "id": "1234abcd",
        ...
        "name": "MyQuickStartTranscoder",
        "outputs": [],
        ...
        "updated_at": "2018-04-22T13:33:16.575",
        ...
      }
    }
  2. Make note of the ID, which is the transcoder ID that Wowza Streaming Cloud creates for your stream. You'll need it to start the transcoder and retrieve its host server IP address.
  3. 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 or passthrough transcoder:

Start the transcoder


The IP address of the transcoder is 0.0.0.0 (local host) until it is started. In order to identify the IP address, start the transcoder.

Example request

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 IP address of the transcoder's host server


Query the state of the transcoder to return its IP address. You may have to do this repeatedly until the transcoder has started.

Example request and response

Fetch the state and uptime ID 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 should look something like this:

{
  "transcoder": {
    "state": "started",
    "transcoding_uptime_id": "abcwxfxy",
    "uptime_id": "abcwxfxy",
    "ip_address": "17.196.145.176"
  }
}

Enter the IP address in the encoder settings


In the encoder settings for configuring the host server, enter the IP address instead of the host server URL. Refer to the documentation for your encoder to note how to access and update its setttings.

For example, enter 17.196.145.176 instead of [host_name].entrypoint.cloud.wowza.com.

Connect the encoder to the transcoder


Start your camera and source encoder. The encoder connects to the transcoder using the IP address you specified without a delay due to DNS lookup.

Note: Each time the transcoder starts, the IP address is likely to be different. You must update your source encoder settings after each start if you choose to connect using the IP address instead of the host name URL.

More resources