Deliver HLS live streams using CMAF and HEVC/H.265 with Wowza Streaming Engine

One of the benefits of the open Common Media Application Format (CMAF) standard is that it supports HEVC/H.265, the next-generation video codec. Wowza Streaming Engine™ media server software version 4.7.8 and later supports CMAF and HEVC/H.265, which means you can use Wowza Streaming Engine 4.7.8 or later to ingest or transcode to the HEVC codec, generate HLS output using the CMAF packetizer, and deliver single or adaptive bitrate HEVC/H.265 live streams for playback on iOS devices.

Note: Public support for HEVC/H.265 is available in Wowza Streaming Engine 4.8.0 and later, while preview support is available in earlier versions (4.1.0 - 4.7.8).

About streaming using CMAF and HEVC


High Efficiency Video Coding (HEVC), or H.265, is a video codec developed as a successor to the H.264/MPEG-4 standard. HEVC enables greater compression than H.264 and supports multi-core parallel encoding and decoding, making it a much more robust, efficient, and scalable process. HEVC also provides substantially better video quality than H.264 at lower bitrates, and it supports higher bit depths, enhanced chroma formats, multiple camera views, and 3D, giving it a wide range of applications from mobile streaming to ultra HD home cinema to medical imaging.

Adoption of HEVC/H.265 by encoding technologies and players is evolving. CMAF supports HEVC, and Apple supports HEVC using QuickTime Player on current versions of iOS (devices) and macOS (desktop).

You can ingest HEVC/H.265 source streams into Wowza Streaming Engine directly, or you can enable HEVC/H.265 for single and adaptive bitrate live streams by using Transcoder, which runs in Wowza Streaming Engine on Windows and Linux (but not macOS). Not all HEVC configuration options are available in Wowza Streaming Engine Manager; you must configure them in XML.

In sum, delivering HEVC live streams for HLS playback using Wowza Streaming Engine requires two things—CMAF packetization and Transcoder—both of which involve manual configuration in XML.

Note: Wowza Streaming Engine must be properly licensed to enable Transcoder. For details, see Licensing Transcoder.

Before you start


You should complete the following tasks:

Enable HEVC/H.265 transcoding


  1. In the Application.xml file, look for the <Transcoder> element and enable transcoding by setting the LiveStreamTranscoder property to transcoder. The XML looks like this:
<Transcoder>
	<LiveStreamTranscoder>transcoder</LiveStreamTranscoder>
	…
</Transcoder>
  1. Enable the HEVC/H.265 Transcoder template by setting the Templates property to transcode-h265.xml. The XML looks like this:
<Transcoder>
	…
    <Templates>transcode-h265.xml</Templates>
</Transcoder>
  1. Save your changes and restart Wowza Streaming Engine.

Configure the HEVC/H.265 transcoder template


Configure HEVC/H.265 transcoding by editing the H.265 Transcoder template file. 

You can also configure the encoding presets and decoding presets in the H.265 Transccoder template via Wowza Streaming Engine Manager. For details, see Configure the Transcoder in Wowza Streaming Engine Manager.

  1. Navigate to [install-dir]/transcoder/templates and open transcode-h265.xml in a text editor.  
  2. In the <PostProcess> block, set the BufferSize to 5000. This will help keep the audio and video synchronized in the transcoded output renditions, however, it may also increase latency before playback starts. Adjust the buffer size as needed to maintain A/V synchronization while minimizing latency.
  3. Edit the <Encode> and <Decode> blocks as desired.

The H.265 template includes three encode profiles that you can enable, disable, or edit:

  • A 720p high-definition, medium-bandwidth profile at 2,400,000 bits per second. This encode is enabled by default.
  • A 1080p full high-definition, high-bandwidth profile at 4,500,000 bits per second, disabled by default.
  • A 4K ultra-high-definition, high-bandwidth profile at 11,600,000 bits per second, also disabled by default.
  1. Save your changes.

Adjust CPU resources

Your video may require higher video quality and CPU usage than the default encoding configuration for H.265. To increase video quality and CPU usage, use the beamr5.preset parameter, which controls the encoding performance through a tradeoff between speed and video quality. By default, beamr5.preset is set to 105, which allows for fast speed.

Note: These instructions apply to Wowza Streaming Engine instances that run Transcoder on a standard hardware configuration. If you run Transcoder on GPU-accelerated hardware, see any of the articles listed on the Hardware acceleration page and the documentation for your graphics card for recommendations on managing resources when transcoding using HEVC.

  1. In transcode-h265.xml, add the beamr5.preset parameter within the <Parameters> container element of all video encoding presets with <Codec> set to H.265.
     
    • For <Value>, specify a value less than 105 for higher video quality and CPU usage. Supported values are 98 (slowest, highest video quality and CPU usage) to 108 (fastest, lowest video quality and CPU usage). For example:
     
    <Encode>
       ...
       <Video>
          <Codec>H.265</Codec>
          ...
          <Parameters>
             <Parameter>
                <Name>beamr5.preset</Name>
                <Value>103</Value>
                <Type>Long</Type>
             </Parameter>
          </Parameters>
       </Video>
       ...
    </Encode>
    
     
    Note: You may have to experiment to find the right value. If you set this parameter to a value lower than your available CPU resources can handle, real-time encoding will lag and eventually stop. When this happens, skip frame messages appear in the Wowza Streaming Engine logs.
  2. Save your changes.

If needed, you can use the beamr5.enc_speed parameter in addition to beamr5.preset for further tuning. Supported values for beamr5.enc_speed are -2 (slowest, highest video quality and CPU usage) to 15 (fastest, lowest video quality and CPU usage). By default, beamr5.enc_speed is set to 7 for medium speed.

Prepare stream name groups for adaptive bitrate streaming


After the HEVC/H.265 Transcoder template is configured, you must create a Synchronized Multimedia Integration Language (SMIL) file for the adaptive bitrate stream. NGRP syntax isn't supported for adaptive bitrate CMAF streams.

  1. Using a text editor, create a file that uses your stream name and a .smil file extension (for example, myStream.smil) and save it to the [install-dir]/content folder.

Note: Make sure your editor doesn't append a .txt file extension to the SMIL file name.

  1. Enter stream information using the names and values defined in your Transcoder template. Here’s a basic example that assumes all three HEVC/H.265 encodes are enabled:
<smil>
    <head></head>
    <body>
        <switch>
            <video src="myStream_720" title="English" audio-bitrate="100000">
                <param name="audioOnly" value="TRUE" valuetype="data"/>
                <param name="cupertinoTag" value="EXT-X-MEDIA" valuetype="data"/>
                <param name="cupertinoTag.GROUP-ID" value="aac" valuetype="data"/>
            </video>
            <video src="myStream_720" width="1280" height="720" video-bitrate="5000000">
                <param name="videoCodecId" value="hvc1" valuetype="data"/>
                <param name="videoOnly" value="TRUE" valuetype="data"/>
                <param name="cupertinoTag.AUDIO" value="aac" valuetype="data"/>
                <param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
            </video>
            <video src="myStream_1080" width="1920" height="1080" video-bitrate="8000000">
                <param name="videoCodecId" value="hvc1" valuetype="data"/>
                <param name="videoOnly" value="TRUE" valuetype="data"/>
                <param name="cupertinoTag.AUDIO" value="aac" valuetype="data"/>
                <param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
            </video>
            <video src="myStream_4k" width="4096" height="2160" video-bitrate="12000000">
                <param name="videoCodecId" value="hvc1" valuetype="data"/>
                <param name="videoOnly" value="TRUE" valuetype="data"/>
                <param name="cupertinoTag.AUDIO" value="aac" valuetype="data"/>
                <param name="audioCodecId" value="mp4a.40.2" valuetype="data"/>
            </video>
        </switch>
    </body>
</smil>

The <switch> container element contains a <video> element for each stream rendition as well as an audio-only entry. For more information on the SMIL configuration, see Set up adaptive bitrate streaming for Apple HLS in the article "Create adaptive bitrate CMAF streams using Wowza Streaming Engine."

Test stream playback


When the camera or encoder is connected and the live stream is active, preview CMAF playback using a supported test player.

Test adaptive bitrate HEVC/H.265 HLS playback

Test playback in a player that supports HLS playback of HEVC-coded streams, for example QuickTime Player on macOS or iOS, or the Akamai HLS test player. For details on Apple’s support for HEVC, see Using HEIF or HEVC media on Apple devices.

If only cmafstreamingpacketizer is enabled, specify the HEVC stream's playback URL using the format: 

http://[wowza-ip-address]/[application-name]/[application-instance]/[stream-name]/playlist.m3u8 

If cmafstreamingpacketizer and cupertinostreamingpacketizer are enabled, specify the HEVC stream's playback URL using the format:

http://[wowza-ip-address]/[application-name]/[application-instance]/[stream-name]/playlist_sfm4s.m3u8 

Where:

  • [wowza-ip-address] is the IP address or domain and port of Wowza Streaming Engine (default port 1935)
  • [application-name] is the application name
  • [application-instance] is the name of the application instance (if omitted, defaults to _definst_)
  • [stream-name] is the SMIL file, with a smil: prefix

For example, the playlist URL for an adaptive bitrate HEVC HLS stream that uses the address mycompany.com, an application named myApplication, and the default stream name myStream is:

http://example.com:1935/myApplication/smil:myStream.smil/playlist.m3u8

or

http://example.com:1935/myApplication/smil:myStream.smil/playlist_sfm4s.m3u8

Test single bitrate HEVC/H.265 HLS playback

To test playback of a single bitrate HEVC HLS stream, follow the conventions described above for testing adaptive bitrate playback, but for [stream-name] use the stream name appended with _[rendition]. For example:

http://example.com:1935/myApplication/myStream_720p/playlist.m3u8

or

http://example.com:1935/myApplication/myStream_720p/playlist_sfm4s.m3u8

More resources