openh264

开源H.264编解码器。(Open Source H.264 Codec)

  • 所有者: cisco/openh264
  • 平台: Android, iOS, Linux, Mac, Windows, WP
  • 許可證: BSD 2-Clause "Simplified" License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

OpenH264

OpenH264是一个支持H.264编码和解码的编解码器库。它适用于实时应用程序,如WebRTC。有关更多详情,请参阅 http://www.openh264.org/

编码器功能
  • 限制的基准配置文件高达5.2级(最大帧大小为36864个宏块)
  • 任意分辨率,不限制为16x16的倍数
  • 利用自适应量化或恒定量化的速率控制
  • 切片选项:每帧1片,每帧N片,每片N个宏块或每片N个字节
  • 多个线程自动用于多个切片
  • 在二元层次结构中最多4层的时间可伸缩性
  • 从单个输入中共同AVC最多4种分辨率
  • 通过单个输入空间同步播放4个分辨率
  • 长期参考(LTR)帧
  • 内存管理控制操作(MMCO)
  • 参考图片列表修改
  • 用于间预测的单一参考帧
  • 使用LTR和/或3-4个时间层时的多个参考帧
  • 定期和按需即时解码器刷新(IDR)帧插入
  • 动态更改比特率,帧率和分辨率
  • 附件B字节流输出
  • YUV 4:2:0平面输入

解码器功能

  • 限制的基准配置文件高达5.2级(最大帧大小为36864个宏块)
  • 任意分辨率,不限制为16x16的倍数
  • 所有切片的单线程
  • 长期参考(LTR)帧
  • 内存管理控制操作(MMCO)
  • 参考图片列表修改
  • 在序列参数集(SPS)中指定时的多个参考帧
  • 附件B字节流输入
  • YUV 4:2:0平面输出

操作系统支持

  • Windows 64位和32位
  • Mac OS X 64位和32位
  • Linux 64位和32位
  • Android 64位和32位
  • iOS 64位和32位
  • Windows Phone 32位

处理器支持

  • Intel x86可选配MMX/SSE(不支持AVX,欢迎使用)
  • ARMv7可选NEON,AArch64可选NEON
  • 使用C/C ++后备功能的任何体系结构

建立图书馆

NASM需要安装汇编代码:可行的版本2.10.06或以上,NASM可以从 http://www.nasm.us/。 对于Mac OSX 64位NASM需要低于版本2.11.08,因为在Mac OSX 64位中使用RIP相对地址时,NASM 2.11.08会引入错误

为了构建用于Windows Phone的臂组件,需要预处理器。它可以从git://git.libav.org/gas-preprocessor.git

下载

适用于Android版本

为了构建android平台,您需要安装android sdk和ndk。您还需要将 ** ANDROID_SDK **/tools 导出到PATH。在Linux上,这可以通过

完成
export PATH = ** ANDROID_SDK **/tools:$ PATH
 
编解码器和演示可以由

构建
make OS = android NDKROOT = ** ANDROID_NDK ** TARGET = ** ANDROID_TARGET **
 
** ANDROID_TARGET ** 可以在 ** ANDROID_SDK **/platforms 中找到,例如 android-12 。 您还可以根据您的设备和NDK版本设置 ARCH , NDKLEVEL 。 ARCH 指定了android设备的体系结构。目前支持 arm , arm64 , x86 和 x86_64 ,默认是 arm 。 ( mips 和 mips64 也可以使用,但没有针对这些体系结构的特定优化。) NDKLEVEL 指定android api级别,默认值为12.可以在 ** ANDROID_NDK **/platforms 中找到可用的可能性,例如 android-21 (去掉 android - 前缀)。

默认情况下,这些命令为 armeabi-v7a ABI构建。为其他android构建 ABIs,添加 ARCH = arm64 , ARCH = x86 , ARCH = x86_64 , ARCH = mips ARCH = MIPS64 。 为了构建旧的 armeabi ABI(以armv5te为基线),添加 APP_ABI = armeabi ( ARCH = arm 是隐式的)。 为了构建64位ABI,比如 arm64 ,明确地将 NDKLEVEL 设置为21或更高。

适用于iOS版本

您可以使用xcode项目文件构建库和演示应用程序 位于 codec/build/iOS/dec 和 codec/build/iOS/enc 中。

你也可以用这个构建库(但不是演示应用程序) 从命令行构建基于构建系统。用

构建
make OS = ios ARCH = ** ARCH **
 

** ARCH ** 的有效值是n正式的iOS架构名称,如 用于模拟器的 armv7 , armv7s , arm64 和 i386 和 x86_64 另一个可设置的iOS特定参数 是 SDK_MIN ,指定构建库的最小部署目标。 有关在命令行上使用make构建的其他细节,请参阅 '适用于所有平台'。

适用于Windows版本

我们的Windows版本使用MinGW,可以从 http://www.mingw.org/

下载。

使用gcc构建,将MinGW bin目录(例如/c/MinGW/bin )添加到您的路径中,然后按照以下“适用于所有平台”的说明进行操作。

要使用Visual Studio进行构建,您需要设置运行cl.exe的路径。最简单的方法是从开发人员命令行会话中启动MSYS。可以在 http://msdn.microsoft.com/zh-cn/找到说明。我们/库/ms229859(v = vs.110)的.aspx 。如果您需要手动完成此操作,请参阅VS2012的Windows 64位安装示例:

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”
 

您还需要将您的INCLUDE和LIB路径设置为指向您的VS和SDK安装。像这样的东西,再次从Win64与VS2012(注意在这里使用Windows风格的路径)。

export INCLUDE =“C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ include; C:\ Program Files(x86)\ Windows Kits \ 8.0 \ Include \ C; \ Program文件(x86)\ Windows Kits \ 8.0 \ Include \ shared“
导出LIB =“C:\ Program Files(x86)\ Windows Kits \ 8.0 \ Lib \ Win8 \ um \ x86; C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ lib”
 
然后将 OS = msvc 添加到“For All Platforms”指令的make行中。

Windows Phone版本

按照上面的说明正常的Windows版本,但使用 OS = msvc-wp 而不是 OS = msvc 。您还需要气体预处理器(如下所述 “建立图书馆”)。

如果使用MSVC 2013构建Windows Phone,则没有包含用于设置Windows Phone套件的lib路径的bat文件,但可以使用如下命令完成:

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“ 

这只是建立DLL所必需的;静态库可以在没有设置的情况下构建。

适用于所有平台

从主项目目录:

  • make 用于自动检测架构并据此进行构建
  • 为x86 32位版本制作ARCH = i386
  • 为x86 64位版本制作ARCH = x86_64
  • make V = No 用于静默构建(不显示实际的编译器命令)
  • 为两个库创建DEBUGSYMBOLS = True ,一个是普通库,另一个删除调试符号表条目(由-g选项创建的条目)

命令行程序 h264enc 和 h264dec 将出现在主项目目录中。

运行命令行应用程序的shell脚本位于 testbin/CmdLineExample.sh

使用信息可以在 testbin/CmdLineReadMe

中找到。

使用来源

    codec - 编码器,解码器,控制台(测试应用程序),构建(makefile,vcproj)
  • build - Makefile构建系统的脚本
  • test - GTest单元测试文件
  • testbin - autobuild脚本,测试应用程序配置文件
  • res - yuv和比特流测试文件

已知问题

请参阅 https://github.com/cisco/openh264/issues 上的问题跟踪器

  • 分辨率超过3840x2160时发生编码器错误
  • 压缩帧大小超过一半未压缩大小时的编码器错误
  • 压缩帧大小超过1MB时解码器错误
  • 编码器RC要求启用帧跳过命中目标比特率, 如果禁用跳帧功能,则可能会超出目标比特率。

许可证

BSD,详情请参阅 LICENSE 文件。

概覽

名稱與所有者cisco/openh264
主編程語言C++
編程語言Shell (語言數: 13)
平台Android, iOS, Linux, Mac, Windows, WP
許可證BSD 2-Clause "Simplified" License
發布數19
最新版本名稱v2.4.1 (發布於 )
第一版名稱v1.0 (發布於 2014-05-06 02:06:37)
創建於2013-10-27 20:20:31
推送於2024-04-18 02:17:45
最后一次提交2024-04-18 11:17:42
星數5.4k
關注者數512
派生數1.7k
提交數5.2k
已啟用問題?
問題數871
打開的問題數208
拉請求數2362
打開的拉請求數17
關閉的拉請求數429
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

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

  • Constrained Baseline Profile up to Level 5.2 (Max frame size is 36864 macro-blocks)
  • 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
  • Simulcast AVC up to 4 resolutions from a single input
  • 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
  • Dynamic changes to bit rate, frame rate, and resolution
  • Annex B byte stream output
  • YUV 4:2:0 planar input

Decoder Features

  • Constrained Baseline Profile up to Level 5.2 (Max frame size is 36864 macro-blocks)
  • 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

OS Support

  • Windows 64-bit and 32-bit
  • Mac OS X 64-bit and 32-bit
  • Linux 64-bit and 32-bit
  • Android 64-bit and 32-bit
  • iOS 64-bit and 32-bit
  • Windows Phone 32-bit

Processor Support

  • Intel x86 optionally with MMX/SSE (no AVX yet, help is welcome)
  • ARMv7 optionally with NEON, AArch64 optionally with NEON
  • Any architecture using C/C++ fallback functions

Building the Library

NASM needed to be installed for assembly code: workable version 2.10.06 or above, NASM can 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 Windows Builds

Our Windows builds use MinGW which can be downloaded from http://www.mingw.org/

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.

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. Instructions can be found at 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:

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"

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).

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"

Then add OS=msvc to the make line of the 'For All Platforms' instructions.

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.

Note, only Windows Phone 8.1 or newer is supported, 8.0 is no longer supported.

For All Platforms

Using make

From the main project directory:

  • make for automatically detecting architecture and building accordingly
  • make ARCH=i386 for x86 32-bit builds
  • make ARCH=x86_64 for x86 64-bit builds
  • make V=No for a silent build (not showing the actual compiler commands)
  • make DEBUGSYMBOLS=True for two libraries, one is normal libraries, another one is removed the debugging symbol table entries (those created by the -g option)

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 builddir
ninja -C builddir

Run the tests with:

meson test -C builddir -v

Install with:

ninja -C builddir install

Using the Source

  • 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

Known Issues

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
  • Encoder RC requires frame skipping to be enabled to hit the target bitrate,
    if frame skipping is disabled the target bitrate may be exceeded

License

BSD, see LICENSE file for details.

去到頂部