2013-11-05 03:53:23 +01:00
OpenH264
2014-01-01 14:57:34 +01:00
========
2013-12-09 14:16:54 +01:00
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.
2013-12-13 09:06:44 +01:00
2013-12-09 14:16:54 +01:00
Encoder Features
2014-01-01 14:57:34 +01:00
----------------
2013-12-09 14:16:54 +01:00
- Constrained Baseline Profile up to Level 5.2 (4096x2304)
- Arbitrary resolution, not constrained to multiples of 16x16
- Rate control with adaptive quantization, or constant quantization
- Slice options: 1 slice per frame, N slices per frame, N macroblocks per slice, or N bytes per slice
- Multiple threads automatically used for multiple slices
- Temporal scalability up to 4 layers in a dyadic hierarchy
- Spatial simulcast up to 4 resolutions from a single input
- Long Term Reference (LTR) frames
- Memory Management Control Operation (MMCO)
- Reference picture list modification
- Single reference frame for inter prediction
- Multiple reference frames when using LTR and/or 3-4 temporal layers
- Periodic and on-demand Instantaneous Decoder Refresh (IDR) frame insertion
2013-12-13 09:06:44 +01:00
- Dynamic changes to bit rate, frame rate, and resolution
2013-12-09 14:16:54 +01:00
- Annex B byte stream output
- YUV 4:2:0 planar input
2013-12-13 09:06:44 +01:00
2013-12-09 14:16:54 +01:00
Decoder Features
2014-01-01 14:57:34 +01:00
----------------
2013-12-09 14:16:54 +01:00
- Constrained Baseline Profile up to Level 5.2 (4096x2304)
- Arbitrary resolution, not constrained to multiples of 16x16
- Single thread for all slices
- Long Term Reference (LTR) frames
- Memory Management Control Operation (MMCO)
- Reference picture list modification
- Multiple reference frames when specified in Sequence Parameter Set (SPS)
- Annex B byte stream input
- YUV 4:2:0 planar output
2013-12-13 09:06:44 +01:00
2013-12-09 14:16:54 +01:00
OS Support
2014-01-01 14:57:34 +01:00
----------
2014-01-06 00:18:43 +01:00
- Windows 64-bit and 32-bit
- Mac OS X 64-bit and 32-bit
- Linux 64-bit and 32-bit
2015-02-08 20:16:29 +01:00
- Android 64-bit and 32-bit
2014-02-28 22:15:47 +01:00
- iOS 64-bit and 32-bit
2013-12-13 09:06:44 +01:00
2013-12-09 14:16:54 +01:00
Processor Support
2014-01-01 14:57:34 +01:00
-----------------
2013-12-09 14:16:54 +01:00
- Intel x86 optionally with MMX/SSE (no AVX yet, help is welcome)
2015-02-08 20:16:29 +01:00
- ARMv7 optionally with NEON, AArch64 optionally with NEON
2013-12-09 14:16:54 +01:00
- Any architecture using C/C++ fallback functions
2013-10-27 21:20:33 +01:00
2013-12-21 01:06:35 +01:00
Building the Library
2014-01-01 14:57:34 +01:00
--------------------
2013-12-21 01:06:35 +01:00
NASM needed to be installed for assembly code: workable version 2.07 or above, nasm can downloaded from http://www.nasm.us/
2013-12-13 09:06:44 +01:00
2014-03-01 22:02:48 +01:00
To build the arm assembly for Windows Phone, gas-preprocessor is required. It can be downloaded from git://git.libav.org/gas-preprocessor.git
2014-02-19 02:54:27 +01:00
For Android Builds
------------------
2015-03-13 11:50:05 +01:00
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
2014-02-20 01:51:14 +01:00
2015-03-13 11:50:05 +01:00
export PATH=**ANDROID_SDK**/tools:$PATH
2014-02-20 01:51:14 +01:00
2014-02-19 02:54:27 +01:00
The codec and demo can be built by
2014-02-20 01:51:14 +01:00
2015-03-13 11:50:05 +01:00
make OS=android NDKROOT=**ANDROID_NDK** TARGET=**ANDROID_TARGET**
2014-02-20 01:51:14 +01:00
2015-03-13 11:50:05 +01:00
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.
2015-03-13 11:53:29 +01:00
`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.)
2015-03-13 11:50:05 +01:00
`NDKLEVEL` specifies android api level, the api level can be 12-19, the default is 12.
2014-02-19 02:54:27 +01:00
2015-03-13 11:50:05 +01:00
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).
2014-03-10 12:05:41 +01:00
2014-02-28 22:16:00 +01:00
For iOS Builds
--------------
You can build the libraries and demo applications using xcode project files
2015-03-13 11:50:05 +01:00
located in `codec/build/iOS/dec` and `codec/build/iOS/enc` .
2014-02-28 22:16:00 +01:00
You can also build the libraries (but not the demo applications) using the
make based build system from the command line. Build with
2015-03-13 11:50:05 +01:00
make OS=ios ARCH=**ARCH**
2014-02-28 22:16:00 +01:00
2015-03-13 11:50:05 +01:00
Valid values for `**ARCH**` are the normal iOS architecture names such as
2015-03-13 11:53:50 +01:00
`armv7` , `armv7s` , `arm64` , and `i386` and `x86_64` for the simulator.
Another settable iOS specific parameter
2015-03-13 11:50:05 +01:00
is `SDK_MIN` , specifying the minimum deployment target for the built library.
2014-02-28 22:16:00 +01:00
For other details on building using make on the command line, see
'For All Platforms' below.
2013-12-21 01:06:35 +01:00
For Windows Builds
2014-01-01 14:57:34 +01:00
------------------
2013-12-13 09:06:44 +01:00
2014-01-17 20:47:38 +01:00
Our Windows builds use MinGW which can be found here - http://www.mingw.org/
2013-12-13 09:06:44 +01:00
2015-03-13 11:50:05 +01:00
To build with gcc, add the MinGW bin directory (e.g. `/c/MinGW/bin` ) to your path and follow the 'For All Platforms' instructions below.
2013-12-13 09:06:44 +01:00
2014-01-21 22:35:42 +01:00
To build with Visual Studio you will need to set up your path to run cl.exe. The easiest way is to start MSYS from a developer command line session - http://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx If you need to do it by hand here is an example from a Windows 64bit install of VS2012:
2014-01-17 20:47:38 +01:00
2015-03-13 11:50:05 +01:00
export PATH="$PATH:/c/Program Files (x86)/Microsoft Visual Studio 11.0/VC/bin:/c/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/IDE"
2014-01-17 20:47:38 +01:00
You will also need to set your INCLUDE and LIB paths to point to your VS and SDK installs. Something like this, again from Win64 with VS2012 (note the use of Windows-style paths here).
2015-03-13 11:50:05 +01:00
export INCLUDE="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include;C:\Program Files (x86)\Windows Kits\8.0\Include\um;C:\Program Files (x86)\Windows Kits\8.0\Include\shared"
export LIB="C:\Program Files (x86)\Windows Kits\8.0\Lib\Win8\um\x86;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib"
2014-01-17 20:47:38 +01:00
2015-03-13 11:50:05 +01:00
Then add `OS=msvc` to the make line of the 'For All Platforms' instructions.
2014-01-17 20:47:38 +01:00
2015-03-13 11:20:17 +01:00
For Windows Phone builds
------------------------
Follow the instructions above for normal Windows builds, but use `OS=msvc-wp`
instead of `OS=msvc` . You will also need gas-preprocessor (as mentioned below
"Building the Library").
If building for Windows Phone with MSVC 2013, there's no included bat file that sets the lib paths to the Windows Phone kit, but that can be done with a command like this:
export LIB="c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\store\arm;c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib\arm;c:\Program Files (x86)\Windows Phone Kits\8.1\lib\arm"
This is only necessary for building the DLL; the static library can be built without setting this.
2014-01-17 20:47:38 +01:00
For All Platforms
2014-01-01 14:57:34 +01:00
-------------------
2013-12-21 01:06:35 +01:00
From the main project directory:
2015-03-13 11:55:02 +01:00
- `make` for automatically detecting architecture and building accordingly
- `make ARCH=i386` for x86 32bit builds
- `make ARCH=x86_64` for x86 64bit builds
2015-03-13 11:50:05 +01:00
- `make V=No` for a silent build (not showing the actual compiler commands)
2013-12-21 01:06:35 +01:00
2015-03-13 11:50:05 +01:00
The command line programs `h264enc` and `h264dec` will appear in the main project directory.
2013-12-21 01:06:35 +01:00
2015-03-13 11:50:05 +01:00
A shell script to run the command-line apps is in `testbin/CmdLineExample.sh`
2013-12-21 01:06:35 +01:00
2015-03-13 11:50:05 +01:00
Usage information can be found in `testbin/CmdLineReadMe`
2013-12-13 09:06:44 +01:00
2013-12-09 14:16:54 +01:00
Using the Source
2014-01-01 14:57:34 +01:00
----------------
2015-03-13 11:50:05 +01:00
- `codec` - encoder, decoder, console (test app), build (makefile, vcproj)
- `build` - scripts for Makefile build system.
- `test` - GTest unittest files.
- `testbin` - autobuild scripts, test app config files
- `res` - yuv and bitstream test files
2013-12-13 09:06:44 +01:00
2013-12-09 14:16:54 +01:00
Known Issues
2014-01-01 14:57:34 +01:00
------------
2013-12-09 14:16:54 +01:00
See the issue tracker on https://github.com/cisco/openh264/issues
- Encoder errors when resolution exceeds 3840x2160
- Encoder errors when compressed frame size exceeds half uncompressed size
- Decoder errors when compressed frame size exceeds 1MB
2014-01-21 09:19:25 +01:00
- Encoder RC requires frame skipping to be enabled to hit the target bitrate,
if frame skipping is disabled the target bitrate may be exceeded
2013-12-13 09:06:44 +01:00
2013-12-09 14:16:54 +01:00
License
2014-01-01 14:57:34 +01:00
-------
2015-03-13 11:50:05 +01:00
BSD, see `LICENSE` file for details.