Work with H.264 image encoding

H.264 is a video encoding format that provides a reduction in the bandwidth required to stream video data compared to the other encoding formats available in the APIs.

PureWeb supports H.264 image encoding for your views to some extent:

  • The C++ and .Net service APIs on Windows support software-encoded UMC (the default) and x264 (must be licensed separately).
  • The C++ service API on Linux supports only software-encoded UMC.
  • H.264 decoding is supported in the HTML5 client only at this time.

Although H.264 support is feature-complete, it has not been fully optimized, and as such, it may not be ideal for production purposes.

This section explains how to work with H.264, if you do want to use this encoding in your application.

How-to

Use H.264 on the service

If you use the built-in UMC software encoding, there are no particular steps to follow on the service. Simply set the encoding configuration on the client as discussed further down this page.

However, we recommend using the x264 encoding if you can, as it is more performant.

 

x264 is licensed under GNU GPLv2 and must be appropriately licensed for commercial and demo use. To use x.264, you must license the libraries separately, independently of any PureWeb licensing. Please visit https://licensing.x264.org/en/ for more information.

Installing the x264 libraries

We recommend that you download the x264 dll files from the following location. These files have been built for compatibility with the PureWeb APIs and are available for both Win32 and Win64 platforms.
https://s3.amazonaws.com/pureweb-na/thirdparty/x264/libx264.zip

Unzip the dll files into your service application’s directory. Ensure that these are included when rebuilding and/or deploying your application, for example by adding them during a pre- or post-build step. The service will load the files at runtime.

Restart the PureWeb server.

Verifying the settings

To confirm which encoding configuration is used in your service application, look for the encoder initialization message in the log. The message should contain either "UMCEncoder" or "x264Encoder":

H264Encoder UMCEncoder: Initialized


Use H.264 on the client

H.264 decoding is supported in the HTML5 client only at this time.

It works well in Chrome, Firefox and Edge. In other browsers, including Internet Explorer, Safari, Mobile Safari and Mobile Chrome, it does not perform well, or does not work at all.

  1. Ensure that your HTML5 client's .html file contains the following code at the bottom of the file. In some of the sample applications, this code is commented out, you would have to remove the comment marks:
    <script src="/lib/pureweb/pureweb.h264.min.js"></script>
  2. Change your client's encoding configuration to H.264, as described here. (If working with x264, this will load the applicable dll files at runtime).