Ticket #1758 (closed enhancement: fixed)

Opened 4 years ago

Last modified 16 months ago

Support for OpenH264 v1.0.0 codec

Reported by: bennylp Owned by: nanang
Priority: normal Milestone: release-2.3
Component: pjmedia Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by ming) (diff)

IMPORTANT: Starting from release 2.6, OpenH264 1.0 is no longer supported as we move to OpenH264 version 1.6.0 instead. For updated instructions, please see ticket #1947.

Support for the open source implementation of H.264 codec from http://www.openh264.org.

Requirement:

  • OpenH264 library version 1.0.0 release (download here)

Implementation features:

  • Constrained Baseline, default level=30 (0x1e)
  • packetization modes: 1, 0
  • key frame request and indication
  • obey remote's fmtp

Notes:

  • currently transmission is hard coded to use only single NAL (packetization mode 0) regardless of remote's fmtp for interop reason. The same is also done in ffmpeg wrapper.
  • whole frame for file encoding is implemented but currently doesn't work

Below are the steps to use the codec:

For GNU targets:

  1. Build the OpenH264 library and install it to a directory (with "make install"). By default it installs to /usr/local. You need to modify the Makefile to install it to different location (=prefix).
  2. Run PJSIP's configure. If you specify alternate location (prefix) to OpenH264 installation, specify the location with --with-openh264 option. E.g.:
    ./configure --with-openh264=/home/user/opt
    
  3. Add this to your config_site.h:
    #define PJMEDIA_HAS_OPENH264_CODEC		1
    

For Visual Studio:

  1. Build the OpenH264 library with MinGW make & gcc, and install it to a directory (with "make install"). By default it installs to /usr/local. You need to modify the Makefile to install it to different location (=prefix).
  2. Create openh264.lib from openh264.def, note that the static lib libopenh264.a outputted by MinGW gcc cannot be used by VS, so we are going to use the dynamic lib version instead:
    1. open 'Visual Studio command prompt', e.g: Win Start Menu -> MS VS 2005 -> VS Tools -> VS 2005 Command Prompt
    2. change dir to OpenH264 source root directory
    3. run "lib /def:openh264.def", this will create openh264.lib, copy this file to the OpenH264 installation directory
    4. rename or copy libopenh264.dll to openh264.dll and put it in the system path
  3. Add OpenH264 include and library installation paths to Visual Studio search path settings.
  4. Add this to your config_site.h:
    #define PJMEDIA_HAS_OPENH264_CODEC		1
    

For iOS:

  1. Follow the guidance for GNU targets above.
  2. Include libopenh264.a and iOS-SDK's libstdc++.dylib to application project in XCode.
  3. Better remove/rename libopenh264.dylib from the OpenH264 installation directory, as somehow it may cause crash on runtime (failed in loading dynamic lib).

For Android:

  1. Build the OpenH264 library according to the instructions provided in README.md at the OpenH264 directory. Modify the Makefile to install it to different location (modify the "prefix") and run "make install".
  2. Copy libopenh264.so to your Android application library directory (such as libs/armeabi).

Change History

comment:1 Changed 4 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 4 years ago by bennylp

  • Description modified (diff)

comment:3 Changed 4 years ago by bennylp

  • Description modified (diff)

comment:4 Changed 4 years ago by bennylp

  • Description modified (diff)

comment:5 Changed 4 years ago by bennylp

In 4815:

Re #1758: Initial implementation of OpenH264 wrapper. Supports:

  • library detection via autoconf
  • CBP
  • packetization modes: 0, 1
  • key frame request and indication
  • obey remote's fmtp

Also added video codec test in samples (similar to the one in pjmedia test though).
And there are some fixes here and there too (e.g. in vid_codec_util.c).

comment:6 Changed 4 years ago by bennylp

In 4846:

Re #1758: changing library name from libwels to libopenh264 in recent OpenH264 update

comment:7 Changed 3 years ago by bennylp

In r4863:

  • Updated with the latest OpenH264 to fix compilation error and codec initialization error for packing mode

comment:8 Changed 3 years ago by nanang

In 4864:

Re #1758: updated wrapper with Visual Studio specific settings, also added the wrapper to VS project.

comment:9 Changed 3 years ago by nanang

  • Description modified (diff)

comment:10 Changed 3 years ago by bennylp

In 4867:

Re #1758: updated with the latest OpenH264 to fix compilation error with bsi->eOutuptFrameType and missing int32_t type on Windows

comment:11 Changed 3 years ago by bennylp

  • Description modified (diff)
  • Summary changed from Support for OpenH264 codec to Support for OpenH264 v1.0.0 codec

comment:12 Changed 3 years ago by bennylp

  • Status changed from new to closed
  • Resolution set to fixed

In 4873:

Closed #1758: use OpenH264 lib version 1.0.0 release instead of the latest git version which is still changing

comment:13 Changed 3 years ago by bennylp

In 4874:

Re #1758: misc: reverted accidentally checked in test.h

comment:14 Changed 3 years ago by bennylp

In 4881:

Re #1757, re #1758: fix configure script. Now OpenGL renderer is enabled by default by the configure script. And added missing dependency to -lstdc++ for the openh274 library

comment:15 Changed 3 years ago by nanang

In 4904:

Re #1758: update default OpenH264 video size for iPhone device to 352x288 (on 4S, 720x480 seems to be too heavy for the CPU).

comment:16 Changed 3 years ago by ming

  • Description modified (diff)

comment:17 Changed 16 months ago by ming

  • Description modified (diff)
Note: See TracTickets for help on using tickets.