Connect an IP camera to Wowza Streaming Cloud using the Wowza Streaming Cloud REST API

IP cameras, sometimes called webcams or netcams, let you capture and broadcast live video over the internet. They're often used for video surveillance and security. This article describes how use the Wowza Streaming Cloud™ REST API to connect an IP camera and send the feed over RTSP to the Wowza Streaming Cloud service for transcoding and playback. 

Create a live stream


You can use a live stream workflow or a transcoder workflow in Wowza Streaming Cloud. The live stream workflow allows you to configure more settings in one API request, while the transcoder workflow allows more modular, custom configuration of settings using multiple API requests. Start with this section if you choose the live stream workflow.

  1. Using the Wowza Streaming Cloud REST API, create a live stream.

    Live stream parameters

    Parameter Data Type Description
    aspect_ratio_height integer The height, in pixels, of the output rendition. Should correspond to the aspect ratio (widescreen or standard) of the video source and be divisible by 8. Set the aspect ratio of the live stream to match the aspect ratio in your camera settings.
    aspect_ratio_width integer The width, in pixels, of the output rendition. Should correspond to the aspect ratio (widescreen or standard) of the video source and be divisible by 8. Set the aspect ratio of the live stream to match the aspect ratio in your camera settings.
    billing_mode string The billing mode for the stream. Use the default, pay_as_you_go.
    broadcast_location string Specify the region that's closest to where your stream originates. For a list of valid regions, see the API reference documentation.
    delivery_method string The method you're using to deliver the source stream to the transcoder. Use pull so that Wowza Streaming Cloud pulls the IP camera's RTSP video source. 
    encoder string The video source for the live stream. Specify one of the following based on your camera type:
    • ipcamera for a generic IP camera
    • axis for an Axis network IP camera
    • sony for a Sony SRG-300SE IP camera
    name string The name of the live stream. Enter an alphanumeric string that is short (maximum 200 characters) and descriptive, for example, MyIPCameraLiveStream.
    source_url string For a pull stream, set a source_url value according to your camera type:
    • For a generic camera, see your IP camera's user guide for for details about the source_url.
    • For an Axis network IP camera, the source_url is in the form
      rtsp://[username]:[password]@[ip_address]/axis-media/media.amp. See your Axis camera user guide or the Axis online helpdesk for details about the camera's IP address.
    • For a Sony SRG-300SE IP camera, the source_url is in the form 
      rtsp://[camera-ip-address]/video[port]. See the Sony SRG-300SE User's Guide for details about the camera's IP address.
    The hostname or IP address used in the source_url must be publicly accessible. If authentication information, such as username and password, is included in the source_url, it can only contain alphanumeric, period (.), underscore (_), and hyphen (-) characters. 
    transcoder_type string Specify the default, transcoded. You can alternatively use passthrough, depending on your needs and the functionality available at your broadcast location.

    For a full list of live stream parameters, see Live Streams in the Wowza Streaming Cloud API reference.

    Example request and response

    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.
    curl -X POST --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
       "live_stream": {
         "aspect_ratio_height": 720,
         "aspect_ratio_width": 1280,
         "billing_mode": "pay_as_you_go",
         "broadcast_location": "us_west_california",
         "delivery_method": "pull",
         "encoder": "ipcamera",
         "name": "MyIPCameraLiveStream",
         "source_url": "rtsp://camera-ip-address/videoinfo",
         "transcoder_type": "transcoded"
       }
    }' "https://api.cloud.wowza.com/api/[version]/live_streams"

    The command creates a live stream with an id parameter, an associated player, and a hosted page. The details of live stream's configuration are listed in the response. You'll use the source connection information to configure the IP camera for the live stream.

    {
       "live_stream": {
         "id": "1234abcd",
         "name": "MyIPCameraLiveStream",
         ...
         "encoder": "ipcamera",
         ...
         "source_connection_information": {
           "source_url": "rtsp://camera-ip-address/videoinfo",
         },
         ...
       }
    }

    Related API requests

    View all live streams for the account:

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

    View the details of a live stream, including the player embed code and hosted page URL:

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

    Update a live stream's configuration:

    curl -X PATCH --header "Content-Type: application/json" --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" -d '{
       "live_stream": {
         "name": "MyDifferentLiveStreamName"
       }
    }' "https://api.cloud.wowza.com/api/[version]/live_streams/[live_stream_id]"
  2. After creating the live stream, configure the source encoder. See Configure the source for next steps.

Create a transcoder


The transcoder workflow allows more modular, custom configuration of settings using multiple API requests. Start with this section if you choose the transcoder workflow.

  1. Using the Wowza Streaming Cloud REST API, create a transcoder.

    Transcoder parameters

    Parameter Data Type Description
    billing_mode string The billing mode for the stream. Use the default, pay_as_you_go.
    broadcast_location string Specify the region that's closest to where your stream originates. For a list of valid regions, see the API reference documentation.
    delivery_method string The method you're using to deliver the source stream to the transcoder. Use pull so that Wowza Streaming Cloud pulls the IP camera's RTSP video source. 
    name string The name of the transcoder. Enter an alphanumeric string that is short (maximum 200 characters) and descriptive, for example, MyIPCameraTranscoder.
    protocol string The transport protocol you're using to send the encoded stream to the transcoder. Use rstp.
    source_url string For a pull stream, set a source_url value according to your camera type:
    • For a generic camera, see your IP camera's user guide for for details about the source_url.
    • For an Axis network IP camera, the source_url is in the form
      rtsp://[username]:[password]@[ip_address]/axis-media/media.amp. See your Axis camera user guide or the Axis online helpdesk for details about the camera's IP address.
    • For a Sony SRG-300SE IP camera, the source_url is in the form 
      rtsp://[camera-ip-address]/video[port]. See the Sony SRG-300SE User's Guide for details about the camera's IP address.
    The hostname or IP address used in the source_url must be publicly accessible. If authentication information, such as username and password, is included in the source_url, it can only contain alphanumeric, period (.), underscore (_), and hyphen (-) characters. 
    transcoder_type string Specify the default, transcoded. You can alternatively use passthrough, depending on your needs and the functionality available at your broadcast location.

    For a full list of transcoder parameters, see Transcoders in the Wowza Streaming Cloud API reference.

    Example request and response

        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": "pull",      
        "name": "MyIPCameraTranscoder",      
        "protocol": "rtsp",
        "source_url": "rtsp://camera-ip-address/videoinfo",      
        "transcoder_type": "transcoded"
      } 
    }' "https://api.cloud.wowza.com/api/[version]/transcoders" 

    This request creates a transcoder with an id parameter, but no outputs or stream targets. The details of the transcoder's configuration are listed in the response, which should look something like this:

    { 
      "transcoder": { 
        "id": "tmd8ybp2", 
        "name": "MyIPCameraTranscoder", 
        "transcoder_type": "transcoded", 
        "billing_mode": "pay_as_you_go", 
        "broadcast_location": "us_west_california", 
        ... 
        "protocol": "rtsp", 
        "delivery_method": "pull", 
        "source_url": "rtsp://camera-ip-address/videoinfo",  
        ...
        "outputs": []
      } 
    } 
  2. Complete the transcoder by adding output renditions and stream targets. For instructions, see one of the following articles, depending on whether you're creating an adaptive-bitrate or passthrough transcoder:
  3. Next, configure the source encoder. See Configure the source for next steps.

Configure the IP camera


Make sure you have the latest firmware installed for your IP camera. See the camera's user guide for details about how to update the firmware, how to operate the camera, and how to specify settings such as resolution, bitrate, and frame rate.

When streaming from an IP camera to Wowza Streaming Cloud, set the camera's keyframe interval to 60 fps for NTSC or 50 fps for PAL.

For an IP camera delivering a stream with a pull connection, you configure the source by determining and providing the source_url value when creating the live stream or transcoder.

Test the connection


  1. Start the live stream or transcoder using the Wowza Streaming Cloud REST API.

    Start the live stream:
    curl -X PUT --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/live_streams/[live_stream_id]/start"
    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"
    Alternatively, click Start Live Stream at the top of the live stream detail page or Start Transcoder at the top of the transcoder detail page in the Wowza Streaming Cloud web manager.
  2. If you’re using the Wowza Streaming Cloud REST API to start the live stream or transcoder, fetch the state of the live stream or transcoder to make sure it’s started.

    Fetch the state of the live stream:
    curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]"  "https://api.cloud.wowza.com/api/[version]/live_streams/[live_stream_id]/state"
    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"
  3. Start the stream in the RTSP encoder.
  4. Confirm that the stream is playing.
    1. Fetch a video thumbnail of the stream using the Wowza Streaming Cloud REST API.

      Fetch the thumbnail URL of a live stream:
      curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/livestreams/[live_stream_id]/thumbnail_url"
      Fetch the thumbnail URL of a transcoder:
      curl -X GET --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/transcoders/[transcoder_id]/thumbnail_url"
    2. View the thumbnail URL in a browser.
    3. Alternatively, in the Wowza Streaming Cloud web manager, confirm that the live stream or transcoder is playing by looking at the Video Thumbnail in the Overview tab of the live stream detail page or transcoder detail page.
  5. Use the Wowza Streaming Cloud REST API to stop the live stream or transcoder.

    Stop the live stream:
    curl -X PUT --header "wsc-api-key: [key]" --header "wsc-access-key: [key]" "https://api.cloud.wowza.com/api/[version]/live_streams/[live_stream_id]/stop"
    Stop 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]/stop"
    Alternatively, click Stop Stream at the top of the live stream detail page in the Wowza Streaming Cloud web manager.
  6. Stop the stream in the source camera or encoder.

More Resources