Wowza Streaming Engine Tutorial: Encoding in HEVC / H.265 Video

From Wowza's blog Wowza Streaming Engine™ software now has the capability to deliver HEVC/H.265 video. In this tutorial, I’ll show you an approach to encoding using the HEVC/H.265 codec for use on Wowza Streaming Engine, so you can get up-to-speed quickly. I’ll also guide you through some of the basic features you’ll come across when encoding your videos. As a side note, the process for encoding these videos will be intended for adaptive bitrate delivery—meaning, multiple renditions of the same source video will be encoded together. Tools Used: Sorenson Squeeze Desktop 11

Before You Encode: Get Source Information

One of the first tasks to perform before encoding your video is to find out some important details about your source. These include:
  • Format
  • Aspect ratio
  • Resolution
  • Frame rate
  • Audio codec
  • Video codec
It’s also important to know whether your video is interlaced or progressive. Here, we’ll be encoding video in the .mp4 container. Finally, the encoding presets in the tutorial are based Apple’s encoding recommendations (I also tweaked them a little further beyond their recommendations). The video source used in the tutorial comes from Pixabay at the URL below: Now, let’s get started.

Creating an Encoding Preset

For this tutorial, we will create a HEVC/H.265 output with a resolution of 960 x 540. The source is progressive, at a resolution of 1920 x 1080 and 29.97 frames per second. The file is also formatted with the H.264 codec and AAC audio codec in the .mp4 wrapper. First, you’ll need to import your video file into Squeeze Desktop by selecting the Import File button at the top-left of the interface. Second, navigate to your video and click the Open button. Your video should appear in the interface. Next, navigate to the Formats tab and twirl down the MPEG-4 (.mp4) section. Scroll down until you see HEVC_3300Kbps_1080p. This is the setting we’re going to use to create our preset. Control-click (Mac) or right-click (Windows) to get the Contextual Menu, and select Copy Preset. A copy will appear under the preset.

Customizing Your Encoding Preset

Select the new preset. Click the Edit button to customize the preset. It’s time to name your preset. In the Name text box at the top of the dialog, change the name to HEVC_1796Kbps_540p_adaptive. Now you should see the Video tab. Confirm that x265 is selected for the Codec drop-down menu. For Method, select 1-Pass VBR, and 1:1 for the Frame Rate. Input 1700 Kbps for the Target. This is your average bitrate. In the Max Data Rate text box, input 110% and make sure Constrain Maximum Data Rate is checked. For the settings selected, the video will be encoded at a constant bitrate, but the encoder will also vary the bitrate with a peak up to 110 percent of the average bitrate: for this video, that peak is 1870 Kbps. According to Apple’s recommendations, the maximum peak for video on demand (VOD) content is 200 percent of the average bitrate. You’ll notice that the Profile, Level and Tier settings are all greyed out. This makes it easier for you because the encoder will set those values automatically, and the level will be adjusted based on your selected output resolution. You can leave your Preset set to Medium and Tuning to None. The Tuning setting is only used if you’d like to do tuning—which you’re probably not doing, unless you’re an advanced user. A note about the Preset setting within HEVC: For now, the quality of your HEVC/H.265 output file is based primarily on the value selected within the Preset drop-down menu. This is easy to understand: The Preset setting is based both on quality and how fast you’d like your videos to encode. Medium is the default, because encoding doesn’t take too long. If you’d like to get higher quality than the Medium setting provides, you can select Slow, Slower or any other item lower than Medium—it will just take longer to encode. The list is configured with the fastest encoding preset, Ultra Fast, at the top, and the slowest Preset setting, Placebo, at the bottom. Until you get more familiar with encoding for HEVC/H.265 with Wowza Streaming Engine, I recommend just staying with the default settings provided through the Preset drop-down menu. While you can make adjustments to many of the values within each preset, some of these values can lengthen your encoding times, or make your encodes look worse. Now, check the Maintain aspect ratio button under Frame Size. As the name implies, this value will keep your aspect ratio the same in the output file as it is in your source. If you decide to encode a video that’s 1920 x 800 or a resolution you’re not familiar with, this setting will help you. Input 960 for the Width and 540 for the Height, and select a Key Frame Every value of 2 seconds. Also, deselect Auto Key Frame on Scene Change if this video will be included in an on-demand adaptive streaming stack. (Keep in mind that the Key Frame Every value of 2 seconds is listed in the Apple authoring requirements mentioned above.)

Adjusting Your Audio

For the audio settings, select aac for the audio codec with a data rate of 96 Kbps. Select 48000 Hz for the Sample Rate, with Channels set to Stereo and a Sample Size of 16. The total data rate for this file is 1796 Kbps—hence the preset name of HEVC_1796Kbps_540p_adaptive. The average bitrate for the video is 1700 Kbps, and the average bitrate for audio is 96 Kbps. Click the Ok button once you make all of your selections. This will save your settings.

Applying Your Preset and Beginning Encoding

We’re almost done. Next, apply your preset to the video by navigating to the Presets section and selecting your saved preset. Click the Apply button. In the Main Interface, you’ll notice that your preset is applied. Your video is now ready for compression. To start your encode, click on the “Squeeze It!” button at the bottom-right of the interface. You should hear a sound once your video is finished.


An important note about my HEVC/H.265 presets: In addition to the one customized for this tutorial, I also have a version where I reduce the average video bitrate by 200 Kbps from what’s listed in Apple’s recommendation for all resolutions used for on-demand adaptive streaming, except my lowest resolutions. I find that I can still achieve really good subjective quality on various types of content this way. If you’d also like to see what your video output looks like at a lower video bitrate, for the preset created in this tutorial, reduce it by 200 Kbps to 1500 Kbps. To better understand my rationale for some of the settings used, view Apple’s encoding recommendations, listed above. Finally, the x265 codec used in this tutorial is a commercially funded, open-source implementation of the H.265/High Efficiency Video Coding (HEVC) compression standard. Anytime you see it available in a tool, I highly recommend using it. It’s an excellent implementation. If you want to learn more about H.265/HEVC encoding with Wowza Streaming Engine, read How to Stream Using HEVC/H.265 Transcoding.

Leave a comment

Please note, comments must be approved before they are published

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.