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.
Note: Ultra low latency streaming is available through Wowza Streaming Cloud with Ultra Low Latency. For more information see About ultra low latency streaming with Wowza Streaming Cloud.
Create a reduced-latency transcoder
Add the transcoder and output renditions
- In Wowza Streaming Cloud, click the Advanced menu, click Transcoders, and then click Add Transcoder.
- Complete the Add Transcoder: Transcoder Setup page.
Note: For information on transcoder setup options, see the Help panel on the right side of the page.
- Click Add.
Wowza Streaming Cloud 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.
- 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 the Help panel on the right side of the Add an Output page or see the article Create a custom transcoder with many outputs and targets in Wowza Streaming Cloud.
- Repeat Step 4 to create as many output renditions as you need 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.
Create the HLS stream target
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.
For this tutorial, we'll create a Wowza CDN on Fastly stream target.
- For the transcoder's highest bitrate output rendition, click Add a Stream Target and select Wowza CDN on Fastly.
- 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.
- 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.
- Click the Stream Target name, and then click the Properties tab.
- Click Edit.
- Under HLS, select Enabled for HLS segment duration.
- 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.
- Click Save.
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.
- 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.
- Click the Outputs & Targets tab.
- Click the Add a Stream Target button for the second output rendition on the page.
- Choose Existing stream target.
- Select your Wowza CDN on Fastly stream target from the list, and then click Assign Stream Target.
- Repeat Steps 3 through 5 for the transcoder's other output renditions until the HLS target is assigned to each one.
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:
- Click Live Streams on the menu bar, and then click Add Live Stream.
- Enter a descriptive Live Stream Name, choose a Broadcast Location near your video source, and then click Next.
- On the Video Source and Transcoder Settings page, select the camera or encoder you're using as your source.
- Select Yes, create an HLS stream with reduced latency.
- Finish the steps to create the live stream.
Note: For more information on the options on each Add Live Stream page, see the Help panel on the right side of the page.
To see the live stream's output renditions and their short-segment-duration target, do the following:
- Click Advanced on the menu bar, and then click Transcoders.
- Select the live stream in the Transcoders panel on the left side of the page. It appears as [Live stream name] / Transcoder.
- Click the Outputs & Targets tab of the transcoder's detail page.
Test your setup
When your transcoder or live stream is complete, configure your source encoder or camera and test the entire setup.
- Click Start Transcoder or Start Live Stream at the top of the transcoder or live stream detail page.
- Click Start to confirm that you want to start the transcoder or live stream.
Wowza Streaming Cloud starts the transcoder or live stream and connects with the source.
- 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.
- In Wowza Streaming Cloud, confirm that the stream is working by looking at the Video Thumbnail on the Overview tab of the transcoder or live stream detail page.
The Video Thumbnail displays a frame from the live 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.
- Check playback at your target by viewing the stream at the HLS playback URL.
You can find the playback URL on the Setup tab of the stream target's detail page: Click the Advanced menu, choose Stream Targets, and then select the HLS target.
- 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
- Click Advanced on the menu bar, click Stream Targets, and then select the stream target.
- 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.
- 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.
- Click the Transcoder Setup tab of the transcoder detail page, and then click Edit.
- 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.