Deliver a reduced-latency HLS stream in Wowza Streaming Cloud

Browsers can't start playing HLS streams until they receive a certain amount of packetized video. That means the Wowza Streaming Cloud™ service must receive source video, transcode it, and deliver this content across networks around the world before your viewers can start watching your broadcast. Depending on where your viewers are located, their local WiFi or cellular bandwidth, and other factors, it can sometimes take a few minutes from the time you start your event for HLS streams to start playing for viewers. For some applications—such as sporting events or events that are simultaneously being streamed and broadcast on TV—that amount of latency may be unacceptable.

To reduce the latency inherent in broadcasting HLS streams, Wowza Streaming Cloud allows you to send shorter file segments, or smaller packets, to HLS stream targets. Although delivering shorter audio and video file segments can reduce latency, shorter file segments also create additional network overhead for the client. If the client doesn't have enough bandwidth, playback may stall, which results in a poor viewing experience. For this reason, the capability to reduce HLS segment duration is disabled by default, and segment duration should be reduced only if your viewers experience unacceptably long latency.

You'll need to choose which workflow you'll use, live stream or transcoder, before you begin this task. See Decide between a live stream or transcoder workflow for more information about these workflows.

To learn about other live stream or transcoder settings you might see in the user interface, see Live Stream Setup page in Wowza Streaming Cloud or Transcoder Setup page in Wowza Streaming Cloud.

Live Stream Workflow

1. Create a reduced-latency live stream

As an alternative to creating a transcoder that uses an HLS stream target with a short segment duration, you can create a reduced-latency live stream. When you create a reduced-latency live stream, Wowza Streaming Cloud:

  • Automatically generates output renditions for the live stream and creates and assigns a Wowza CDN on Fastly target to each rendition. Each target's segment duration is two seconds. The number of renditions depends on the aspect ratio you specify for the source.
     
    Note: If you choose Wowza Streaming Engine as the video source, a Wowza CDN on Akamai - HLS target is assigned to each rendition.
  • Disables the live stream's incoming buffer and its sort packet buffer.

To create a reduced-latency live stream, do the following:

  1. Click Live Streams on the menu bar, and then click Add Live Stream.
     
  2. Enter a descriptive Live Stream Name, choose a Broadcast Location near your video source, and then click Next.
     
  3. On the Video Source and Transcoder Settings page, select the camera or encoder you're using as your source.
  4. Select Yes, create an HLS stream with reduced latency.
     
  5. Finish the steps to create the live stream. 

To see the live stream's output renditions and their short-segment-duration target, do the following:

  1. Click Advanced on the menu bar, and then click Transcoders.
     
  2. Select the live stream in the Transcoders panel on the left side of the page. It appears as [Live stream name] / Transcoder.
     
  3. Click the Outputs & Targets tab of the transcoder's detail page.

2. Test your setup

When your live stream is complete, configure your source encoder or camera and test the entire setup.

  1. Click Start Live Stream at the top of the transcoder detail page.
  2. Click Start to confirm that you want to start the live stream.

Wowza Streaming Cloud starts the live stream and connects with the source.

  1. Start your video source.

Wowza Streaming Cloud receives the stream from the source, starts transcoding, creates output renditions for the stream, and sends each output rendition to the HLS target assigned to it.

  1. In Wowza Streaming Cloud, confirm that the stream is working by looking at the Video Thumbnail on the Overview tab of the live stream detail page.

The Video Thumbnail displays a frame from the stream every five seconds. The started date and time appear at the bottom of the thumbnail. Connection, transcoding, and delivery metrics begin to update in the Statistics panel.

Video thumbnail and statistics panel

  1. Check playback at your target by viewing the stream at the HLS playback URL.

You can find the playback URL on the Playback URLs tab of the stream target's detail page: Click the Advanced menu, choose Stream Targets, and then select the HLS target.

Click Stop Llve Stream at the top of the live stream detail page to end your test stream, and then stop the video source.

Transcoder Workflow

1. Create a transcoder

Create the transcoder for your event or broadcast: first, add the transcoder and its output renditions, then create the HLS stream target with shorter segment durations and assign it to the outputs.

2. Add the transcoder and output renditions

  1. In Wowza Streaming Cloud, click the Advanced menu, click Transcoders, and then click Add Transcoder.
  2. Complete the Add Transcoder: Transcoder Setup page.
     
  1. Click Add.

Wowza Streaming Cloud creates the transcoder and displays the Outputs & Targets tab of the transcoder detail page.

Empty Outputs and Targets tab

All transcoders need at least one output rendition, so next create one or more output renditions for the transcoder.

  1. Do one of the following:
  1. Repeat Step 4 to create up to 10 output renditions for your transcoder. Typically you might create a high-bitrate rendition that matches the source encoder's settings, and then create additional, lower-quality output renditions.

2. Create the HLS stream target with shortened segment durations

You can create one of three types of HLS stream target for the transcoder:

  • A Wowza CDN on Fastly target
  • A Wowza CDN on Akamai target that receives the HLS stream
     
  • A custom target that receives the HLS stream at an Akamai CDN edge server.

You can reduce the segment size with all types of HLS targets.

Important: Creating a custom HLS target requires that you have a CDN account with Akamai that can ingest HLS streams. Additionally, you must work with Akamai to enable CP codes that support the HLS protocol.

For this tutorial, we'll create a Wowza CDN on Fastly stream target.

  1. For the transcoder's highest bitrate output rendition, click Add a Stream Target and select Wowza CDN on Fastly.

Add a Fastly stream target

  1. Specify the Target Name. The Target Name is required but doesn't have to be unique, and it can't be longer than 255 characters.
  2. Click Add.

Wowza Streaming Cloud generates a target and returns to the Outputs & Targets tab of the transcoder detail page.

Note: If you're creating a custom HLS target, for Provider, choose Akamai HLS Push. Specify the Primary URL, Backup URL, Stream Name, and (optionally) the HLS Playback URL. For help with these values, consult your Akamai Luna Control Center or see the HLS, HDS, and DASH Ingest User Guide from Akamai.

The segment duration of the HLS chunks is configured by editing the target's properties.

  1. Click the Stream Target name, and then click the Properties tab.
     
  2. Click Edit.
     
  3. Under HLS, select Enabled for HLS segment duration.

Enable HLS segment duration and set the value less than 10

  1. For Value specify 8, 6, 4, or 2 seconds.

The lower the Value, the lower the latency. See Follow best practices for setting the segment duration for help determining the best Value.

  1. Click Save.

3. Assign the stream target to the output renditions

Now that you've created the HLS target for one output rendition, assign it to the other outputs.

  1. Return to the transcoder's detail page: Click the Setup tab of the stream target detail page, and then click the name of the transcoder under Transcoders Using This Target.
     
  2. Click the Outputs & Targets tab.
     
  3. Click the Add a Stream Target button for the second output rendition on the page.
     
  4. Choose Existing stream target.

Add an existing stream target

  1. Select your Wowza CDN on Fastly stream target from the list, and then click OK.
  2. Repeat Steps 3 through 5 for the transcoder's other output renditions until the HLS target is assigned to each one.

4. Test your setup

When your transcoder is complete, configure your source encoder or camera and test the entire setup.

  1. Click Start Transcoder at the top of the transcoder detail page.
  2. Click Start to confirm that you want to start the transcoder.

Wowza Streaming Cloud starts the transcoder and connects with the source.

  1. Start your video source.

Wowza Streaming Cloud receives the stream from the source, starts transcoding, creates output renditions for the stream, and sends each output rendition to the HLS target assigned to it.

  1. In Wowza Streaming Cloud, confirm that the stream is working by looking at the Video Thumbnail on the Overview tab of the transcoder detail page.

The Video Thumbnail displays a frame from the stream every five seconds. The started date and time appear at the bottom of the thumbnail. Connection, transcoding, and delivery metrics begin to update in the Statistics panel.

Video thumbnail and statistics panel

  1. Check playback at your target by viewing the stream at the HLS playback URL.

You can find the playback URL on the Playback URLs tab of the stream target's detail page: Click the Advanced menu, choose Stream Targets, and then select the HLS target.

  1. Click Stop Transcoder at the top of the transcoder detail page to end your test stream, and then stop the video source.

Edit an HLS stream target's segments


  1. Click Advanced on the menu bar, click Stream Targets, and then select the stream target.
     
  2. On the Properties tab of the stream target's detail page, click Edit to change the HLS segment duration.

Follow best practices for setting the segment duration


  • Keep the segment duration as long as possible to minimize the effect on your viewers' playback experience. Use the following table to help you determine the effect of the segment duration on stream quality.
     
    Segment Duration Impact on Latency
    10 seconds Default. Provides the lowest incidence of rebuffering, resulting in the smoothest playback experience for viewers. Also provides the greatest amount of latency, particularly the delay between the start of the stream and the start of playback.
    8 seconds Offers slightly improved latency while maintaining a smooth playback experience for viewers.
    6 seconds Provides a viewing experience that's closer to real-time but still favors quality of playback over reduced latency.
    4 seconds Stream quality begins to degrade in order to emphasize on low delay from live.
    2 seconds Offers the least amount of latency—as low as 10 seconds—as well as the greatest potential disruption to playback quality.
  • Reduce the segment size by increments of 2 seconds, testing each size before reducing further. For example, first set the duration to 8 seconds and then test the stream. Check to see if latency has improved and if the playback experience is still acceptable. If not, try 6 seconds and repeat the test.
     
  • If you create two different targets and assign each one a different segment duration, both are automatically assigned the newer value. If you want the older target to have the original duration, you'll need to edit it and reassign that value.
     
  • Reducing segment duration may compromise playback on devices running older versions of iOS. Test your new configuration on multiple devices and iOS versions if you're concerned about backward compatibility for your stream playback.
     
  • File segments must start on a keyframe, so in your encoder, make sure to use a keyframe interval that's a factor of the segment duration. For example, if HLS segment duration is 10 seconds, use a keyframe interval of 2, 2.5, 5, or 10 seconds. If your segment duration is 6 seconds, use a keyframe interval of 2, 3, or 6 seconds.
    For more information on encoding source video, including specifying keyframe intervals, see the article Encoding best practices for Wowza Streaming Cloud.

Edit a reduced-latency live stream's buffer settings


A reduced-latency live stream uses modified buffer settings. The buffer settings can be changed only in the live stream's transcoder setup.

  1. Click Advanced on the menu bar, click Transcoders, and then select the reduced-latency live stream's transcoder. It appears as [Live stream name] / Transcoder.
     
  2. Click the Transcoder Setup tab of the transcoder detail page, and then click Edit.
     
  3. Do either or both of the following:
  • Specify a value of between 1 and 8 seconds for Buffer Size.

    The incoming buffer stores packets before they are processed, enabling more efficient transcoding. An optimum Buffer Size reduces stream jittering and helps ensure successful transmuxing, which is the process of converting to a different container format without changing the stream's content.
     
  • Deselect Turn off sort packet buffer.

    Turning off the sort packet buffer speeds the time it takes to decode and deliver video data to players. If desired, deselect Turn off sort packet buffer to enable the sort packet buffer.