Home

Awesome

OpenH264

OpenH264 is a codec library which supports H.264 encoding and decoding. It is suitable for use in real time applications such as WebRTC. See http://www.openh264.org/ for more details.

Encoder Features

Decoder Features

OS Support

Architectures verified to be working

Processor Support

Building the Library

NASM needed to be installed for assembly code: workable version 2.10.06 or above, NASM can be downloaded from http://www.nasm.us/. For Mac OSX 64-bit NASM needed to be below version 2.11.08 as NASM 2.11.08 will introduce error when using RIP-relative addresses in Mac OSX 64-bit

To build the arm assembly for Windows Phone, gas-preprocessor is required. It can be downloaded from git://git.libav.org/gas-preprocessor.git

For Android Builds

To build for android platform, You need to install android sdk and ndk. You also need to export **ANDROID_SDK**/tools to PATH. On Linux, this can be done by

export PATH=**ANDROID_SDK**/tools:$PATH

The codec and demo can be built by

make OS=android NDKROOT=**ANDROID_NDK** TARGET=**ANDROID_TARGET**

Valid **ANDROID_TARGET** can be found in **ANDROID_SDK**/platforms, such as android-12. You can also set ARCH, NDKLEVEL according to your device and NDK version. ARCH specifies the architecture of android device. Currently arm, arm64, x86 and x86_64 are supported, the default is arm. (mips and mips64 can also be used, but there's no specific optimization for those architectures.) NDKLEVEL specifies android api level, the default is 12. Available possibilities can be found in **ANDROID_NDK**/platforms, such as android-21 (strip away the android- prefix).

By default these commands build for the armeabi-v7a ABI. To build for the other android ABIs, add ARCH=arm64, ARCH=x86, ARCH=x86_64, ARCH=mips or ARCH=mips64. To build for the older armeabi ABI (which has armv5te as baseline), add APP_ABI=armeabi (ARCH=arm is implicit). To build for 64-bit ABI, such as arm64, explicitly set NDKLEVEL to 21 or higher.

For iOS Builds

You can build the libraries and demo applications using xcode project files located in codec/build/iOS/dec and codec/build/iOS/enc.

You can also build the libraries (but not the demo applications) using the make based build system from the command line. Build with

make OS=ios ARCH=**ARCH**

Valid values for **ARCH** are the normal iOS architecture names such as armv7, armv7s, arm64, and i386 and x86_64 for the simulator. Another settable iOS specific parameter is SDK_MIN, specifying the minimum deployment target for the built library. For other details on building using make on the command line, see 'For All Platforms' below.

For Linux Builds

You can build the libraries (but not the demo applications) using the make based build system from the command line. Build with

make OS=linux ARCH=**ARCH**

You can set ARCH according to your linux device . ARCH specifies the architecture of the device. Currently arm, arm64, x86 and x86_64 are supported

NOTICE: If your computer is x86 architecture, for build the libnary which be used on arm/aarch64 machine, you may need to use cross-compiler, for example: make OS=linux CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ ARCH=arm64 or make OS=linux CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ ARCH=arm

For Windows Builds

"make" must be installed. It is recommended to install the Cygwin and "make" must be selected to be included in the installation. After the installation, please add the Cygwin bin path to your PATH.

openh264/build/AutoBuildForWindows.bat is provided to help compile the libraries on Windows platform.
Usage of the .bat script:

`AutoBuildForWindows.bat Win32-Release-ASM` for x86 Release build  
`AutoBuildForWindows.bat Win64-Release-ASM` for x86_64 Release build  
`AutoBuildForWindows.bat ARM64-Release-ASM` for arm64 release build  

for more usage, please refer to the .bat script help.

For All Platforms

Using make

From the main project directory:

The command line programs h264enc and h264dec will appear in the main project directory.

A shell script to run the command-line apps is in testbin/CmdLineExample.sh

Usage information can be found in testbin/CmdLineReadMe

Using meson

Meson build definitions have been added, and are known to work on Linux and Windows, for x86 and x86 64-bit.

See http://mesonbuild.com/Installing.html for instructions on how to install meson, then:

meson setup builddir
ninja -C builddir

Run the tests with:

meson test -C builddir -v

Install with:

ninja -C builddir install

Using the Source

Known Issues

See the issue tracker on https://github.com/cisco/openh264/issues

License

BSD, see LICENSE file for details.