Custom codec

Codec downloads:

Link #1

* Please note that this link contains UNOFFICIAL codecs and we disclaim any responsibility on it.


Build FFmpeg for MX Player.

Following conditions are required to run included shell script:
  1. Linux or Cygwin.
  2. Latest Google NDK.
First, ffmpeg source codes should be download from download page.

And then shell scripts need to be modified to fix up paths:
  1. Move to ffmpeg/JNI directory.
  2. Create environment variable NDK to point to your NDK. ex) export NDK=/usr/src/android-ndk-r9d
  3. In config-ffmpeg.sh, change "HOST_PlATFORM" to proper value mathing your compiling device. List of value can be found on <NDK>/toolchains/arm-linux-androideabi-4.8/prebuilt. Default value is linux-x86_64.
  4. In build-ffmpeg.sh, change TARGET1 and TARGET2 directory to point output directory.
  5. In build.sh and build-ffmpeg.sh, change CPU_CORE to match CPU core number of your building machine.
And modify  <NDK>/toolchains/arm-linux-androideabi-4.8/setup.mk file by removing lines setting arch, fpu and link options depending on ABI. In NDKr9d, this is following lines;

ifneq ($(filter $(TARGET_ARCH_ABI), armeabi-v7a armeabi-v7a-hard),)
    TARGET_CFLAGS += -march=armv7-a \
                     -mfpu=vfpv3-d16
    TARGET_LDFLAGS += -march=armv7-a \
                     -Wl,--fix-cortex-a8
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
    TARGET_CFLAGS += -mfloat-abi=softfp
else
    TARGET_CFLAGS += -mhard-float \
                     -D_NDK_MATH_NO_SOFTFP=1
    TARGET_LDFLAGS += -Wl,--no-warn-mismatch \
                     -lm_hard
endif

else
    TARGET_CFLAGS += -march=armv5te \
                            -mtune=xscale \
                            -msoft-float
endif

You don't need to touch setup.mk for x86 and mips toolchains.

  1. In <NDK>/toolchains/arm-linux-androideabi-4.8/setup.mk,
And then run "build-ffmpeg.sh" with one of following arguments: (or rebuild-ffmpeg.sh to build for all architectures)
neon, tegra3, tegra2, v6_vfp, v6, v5te, x86, mips

After this, all library files should be generated on TARGET directories.

Shipping custom codec.

Since 1.7.29, custom codec file naming is changed as followings:
libffmpeg.mx.so.<cpu-architecture-code>.<version-number>

CPU architecture code is one of followings:
neon, tegra3, tegra2, v6_vfp, v6, v5te, x86, mips

Version number is similar one to MX Player's such as 1.7.29, 1.7.30. But please note that codec version and MX Player version is not exactly same. Sometimes MX Player will be upgraded without upgrading codec.
For example, if you are building ARMv7 NEON codec for version 1.7.29, its file name should be libffmpeg.mx.so.neon.1.7.29

If codec is compressed on a .zip container, it does not need to be decompressed any more. MX Player itself extract codec file from .zip file when loading codec. Also multiple codec files can be compressed on single .zip file and then MX Player loads correct codec file automatically.

MX Player will recognize zipped codec files on SDCard root and Download directory automatically if file name contains version code.


* This build instruction is applicable after version 1.8
* From version 1.7.6, file names are changed to libavutil.mx.so, libavformat.mx.so.. so forth to resolve conflict with system library files.
* From version 1.7.16, it generates single file; libffmpeg.mx.so.