Monday, June 22, 2015

Compile OpenH264 for Android

OpenH264
OpenH264 is a codec library which supports H.264 encoding and decoding.
The source code repository is hosted on github at https://github.com/cisco/openh264.
See http://www.openh264.org/ for more details.

Compile OpenH264 for Android (using Windows)
  • In order to compile the openh264 the GNU Make (http://www.gnu.org/software/make/)utilityis required. Hence to provide make tool available on Windows, MSYS needs to be installed.

  • To compile openh264 for Android (using Windows) the following are required –
  1. MSYS (http://www.mingw.org/wiki/MSYS)
  2. Android NDK (https://developer.android.com/tools/sdk/ndk/index.html
  3. The openh264 source from github (https://github.com/cisco/openh264)

  • Post installations, ensure that everything is installed correctly, try building sample projects available with Android NDK.



  • After installing MSYS you should have a cyan "M" link on the Desktop. When you double-click on it, a terminal should be launched.
  1. Navigate to project directory (using UNIX style commands)
  2. Finally to compile use the following command make OS=android NDKROOT=/unix/path/to/ndk TARGET=9 libopenh264.so
  3. NDKROOT=/d/Softwares/android-ndk-r10 (in my case)
  4. All the libraries should be compiled post this command.

  • Once all the libs are compiled, then these can be used to run the sample apps for encoding and decoding.

3 comments:

  1. hi

    I'm finding solution for view h264 video on android.
    On desktop, I can view h264 video from WebRTC server on lasted Chrome (version 53). Because Chrome enabled enable-webrtc-h264-with-openh264-ffmpeg for dec/enc h264.
    Now I want to use webview to browse to WebRTC server for view h264 video. Webview is based on Chromium which only support hardware for dec/enc. If I compile OpenH264 for Android, Can I view h264 video via webview?

    Thanks,
    ThaiSon

    ReplyDelete
  2. Hi, please contact me ngoctruongtan@gmail.com

    ReplyDelete
  3. hi i am getting error
    openh264 build-local.mk no such file or directory

    ReplyDelete