Compile ijkplayer os file under Mac

Compile ijkplayer os file under Mac

 

first step:

1. Install homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

      

 

2. If git is not installed, install git. Otherwise skip

brew install git

3. Install yasm.

brew install yasm

 

The second step is to download NDK to configure the environment after installing git and yasm.

       1 ndk download link: https://developer.android.google.cn/ndk/downloads/index.html

       2 Configure the ndk path:

              Open Terminal and enter: 

open -e .bash_profile

              Open the bash_profile file

Add in the file:

                            export PATH=$PATH: your ndk path

                            ANDROID_NDK=your ndk path

                           export ANDROID_NDK

               Then command+s to save, Terminal input source .bash_profie to update (don’t forget, I just forgot this step and the compilation failed, the second pit)

        Finally, check whether the ndk path is configured successfully. Enter: ndk-build in Terminal.

 

The third step is to clone the ijkplayer framework source code locally and compile it. Enter the following commands in the terminal:

1.clone code:

git clone https://github.com/bilibili/ijkplayer.git ijkplayerMacyasm

2. 

cd ijkplayerMacyasm

3. Switch to the latest version: k0.8.8

git checkout -B latest k0.8.8

 

 

4. Before compiling

Choose your configuration before compiling

Select some configuration options when automatically compiling, such as supported protocols, audio and video types, etc. The official provides us with three templates.

You can open config/module.sh in the config/ directory to see if enable is enabled and disable is disabled.

module-default.sh
module-lite-hevc.sh
module-lite.sh

5. Start compiling

Perform initialization

Various packages will be downloaded during initialization. Try to choose a good network environment.

./init-android.sh

初始化OpenSSL
./init-android-openssl.sh

Compile OpenSSL and FFmpeg
first clear relevant information

cd android/contrib

./compile-openssl.sh clean

./compile-ffmpeg.sh clean
编译OpenSSL 和 FFmpeg
./compile-openssl.sh all

./compile-ffmpeg.sh all
 
最后编译ijkplayer

Generate so. Switch to the android directory (cd ..) and execute the following command to generate the so file.

cd ..

./compile-ijk.sh all

If compiled correctly, libijkffmpeg.so, libijkplayer.so, libijkffmpeg.so, libijkplayer.so, libijksdl.so these three so files

 

Finish. . . . .

 

 

Replenish:

ndk version problem:

build on Darwin x86_64
ANDROID_NDK=/xx/Library/Android/sdk/ndk-bundle
IJK_NDK_REL=14.0.3529234-beta1
You need the NDKr10e or later

Go to download the corresponding version:  https://developer.android.google.cn/ndk/downloads/revision_history

Finally, Mac unzips the .bin file

The steps are very simple, just two steps.

1. Set permissions:

 

chmod a+x android-ndk-r10e-darwin-x86_64.bin

2. Run decompression:

 

./android-ndk-r10e-darwin-x86_64.bin

3. Repeat the previous compilation steps to complete 

Guess you like

Origin blog.csdn.net/ck3345143/article/details/111281546#comments_15290897