Record an ijkplayer compilation trip

Keywords: Android git OpenSSL SDK


With the rise of the media and audio-video industry, as well as the product demand for cross-platform mobile business, there has been an increase in the workload of developers and the difficulty of the work. For example, audio-video playback needs to support 95% of audio-video formats on the market, so native Android players can not be satisfied, at this time we can consider ijkplayer.
Let's start by introducing what ijkplayer is. ijkplayer is an open source, FFMPEG-based, lightweight Android/Ios audio and video player developed by bilibili. It is favored by developers for its easy integration, tailorable editing configuration, highly customizable development, and is therefore intimately called by developers and users.Station B.

How to use ijkplayer

Official address of ijkplayer:

  • Android
  • Gradle
# required
allprojects {
    repositories {

dependencies {
    # required, enough for most devices.
    compile ''
    compile ''

    # Other ABIs: optional
    compile ''
    compile ''
    compile ''
    compile ''

    # ExoPlayer as IMediaPlayer: optional, experimental
    compile ''

Now that a popular ijkplayer library has been added, just use it without special requirements!Then there's a big difference between using MediaPlayer and using it. There's no telling you how to use it. There's a lot of Google right away.

ijkplayer Compile so Library

First of all, my compilation environment is Ubuntu-16.04.6-server-amd64

  • Step 1: Download, configure SDK and NDK
    SDK download:
    Recommended use: Android-sdk_r24.4.1-linux
    NDK Official Download:
    NDK version recommended: NDK r10e

Next, configure environment variables:

1. $ sudo vim /etc/profile´╝îAdd the following at the end of the file:
2. export ANDROID_SDK=/home/yh/android-sdk-linux
3. export PATH=$ANDROID_SDK/tools:$PATH
4. export ANDROID_NDK=/home/yh/ndk/android-ndk-r10e/
6. Save and Exit
7. $ source .bashrc // Make the configured environment variables valid

Verify that the configuration is valid: ndk-build-v

The console prints the log above and the android NDK installation is now configured.

  • Step 2: Install git, make, and yasm
sudo apt-get install git
sudo apt-get install make
sudo apt-get install yasm

  • Step 3: Pull ijkplayer source
1. git clone ijkplayer-android // Pull ijkplayer source
2. cd ijkplayer-android // Enter Source Directory
3. git checkout -B latest k0.8.8 // Create a new branch

  • Step 4: Initialize android
./ // Initialize Android script
  • Step 5: Compile script configuration
1.If you like more codecs/format
cd config // Enter config directory
rm // deleteModule.shScript
ln -s // Specify default script soft
source // Re-execute the newly modified file initialization for immediate effect

2.If you want to use a smaller codec/Format to obtain smaller binary sizes (including hevc Function)
cd config
ln -s

3.If you want to use a smaller codec/Format to get a smaller binary size (by default)
cd config
ln -s

//Here we choose the1Yes, don't ask me why, children know as much as possible
//Then modify the,Append the following two lines to the end of the file
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-linux-perf"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bzlib"
  • Step 6: Initialize android support for accessing Https
1. cd .. // Return to the previous directory
2. ./ // Execute Initialization Support https Scripts
  • Step 7:clear
1. cd android/contrib // Enter contrib directory
2. ./ clean
3. ./ clean
  • Step 8: Compile openssl
1. ./ all //About 5 minutes (see server configuration)
  • Step 9: Compile ffmpeg
./ all

Note: If you want to compile all versions of the so library, follow all if you only want to compile specific
The CPU schema is directly followed by the CPU schema name, for example:. /compile-Ffmpeg.shArmv7a is fine!

  • Step 10: Compile ijkplayer
cd .. 
./ armv7a
Wait a moment... After successful compilation, the libraries and files in ijkplayer in the current directory are updated.Export ing the ijkplayer project as a library dependency is OK.

Finally, how to use compiled library files:

  • Import the corresponding library file into your own project, and you can tell it by the suffix name of the folder!Unexpectedly, there will be error information, which is basically a problem with gradle configuration. Just modify the error location based on the error information.
  • After modifying the above configuration error information, we can package the above libraries into aar s, so that we can use AARS directly as dependent packages for projects in the future. Is it convenient?
  • You can customize your own ijkplayer based on what's inside the example!
Finally, thank you for your reading. Your attention and forwarding are my endless power.

Posted by chriskiely on Sun, 07 Jun 2020 18:17:49 -0700