Deliver a reduced-latency HLS stream in Wowza Video

Browsers can't start playing HLS streams until they receive a certain amount of packetized video. That means the Wowza Video™ 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 Video 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 Video or Transcoder Setup page in Wowza Video.

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 Video:

  • 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.

  • Disables the live stream's incoming buffer and its sort packet buffer.


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

  1. 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.

Transcoder Workflow

1. Create a reduced-latency transcoder

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

1. Add the transcoder and output renditions

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

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


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:
  • Click the down arrow on the right side of the Add Output button and select a preset output rendition from the list.
     
  • Click the Add Output button to create a custom output rendition. Specify the output settings and then click Save.
     

    Note: For more information on creating custom outputs, see Create a custom transcoder with many outputs and targets in Wowza Video.
  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

Now you will create a Fastly HLS stream target for the transcoder:

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

  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 Save.

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

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.

  1. For Value specify 10, 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.

  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.

2. Test your setup


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

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

Wowza Video starts the transcoder or live stream and connects with the source.

  1. Start your video source.

Wowza Video 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 the Wowza Video web manager, confirm that the live stream is playing by looking at the Video Preview in the Overview tab of the Live Stream Details or Transcoder Details page.

    The video preview displays a frame from the live stream every 5 seconds. The started date and time appear under the preview. Source stream, transcoder, and delivery metrics begin to update.



     
  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 or Stop Live Stream at the top of the transcoder or live stream 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 DurationImpact on Latency
    10 secondsDefault. 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 secondsOffers slightly improved latency while maintaining a smooth playback experience for viewers.
    6 secondsProvides a viewing experience that's closer to real-time but still favors quality of playback over reduced latency.
    4 secondsStream quality begins to degrade in order to emphasize on low delay from live.
    2 secondsOffers 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 Video.

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.