设为首页 加入收藏

TOP

How to build ffmpeg with hardware accelerated codecs for Android x86(一)
2019-09-01 23:13:26 】 浏览:44
Tags:How build ffmpeg with hardware accelerated codecs for Android x86

In order to build a complete ffmpeg with hardware acceleration for Intel platform (XXX lake + Atom), we need a complete Android x86 build, the cross-compilation doesn't work well with NDK or anything else.

Steps are below.


 Install Ubuntu 16.04 LTS x86-64, install the all Ubuntu dependencies as here.

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip

Install Python Mako by pip, which the build system uses to generate the i18n files during compilation.

sudo apt-get install python-pip

pip install mako

Get the source code of Android x86, here make sure you have large enough space.

mkdir android-x86
cd android-x86
repo init -u git://git.osdn.net/gitroot/android-x86/manifest -b $branch
repo sync --no-tags --no-clone-bundle

The variable $branch is the name of specific Android branch.

  • oreo-x86
    • Android 8.0
  • nougat-x86
    • Android 7.1
  • marshmallow-x86
    • Android 6.0
  • lollipop-x86
    • Android 5.1
  • kitkat-x86
    • Android 4.4
  • jb-x86
    • Android 4.3
  • ics-x86
    • Android 4.0
  • honeycomb-x86
    • Android 3.2
  • gingerbread-x86
    • Android 2.3
  • froyo-x86
    • Android 2.2
  • eclair-x86
    • Android 2.1
  • donut-x86
    • Android 1.6
  • cupcake-x86 (aka android-x86-v0.9)
    • Android 1.5

Once the code base was checked out, use lunch command to build the system for once.

Enter the folder of checked out folder.

Source the build environement setup.

. build/envsetup.sh

Select the build target and type of build

lunch $TARGET_PRODUCT-$TARGET_BUILD_VARIANT

The $TARGET_PRODUCT could be one of android_x86 android_x86_64 .

The $TARGET_BUILD_VARIANT could be one of eng user userdebug .

So if we want to make a debug version of Android x86-64, we type

lunch android_x86_64-userdebug

Now type

m -jX iso_img

to make the system image.

When there is the error about org.android.analytics, open the file

./build/core/tasks/check_boot_jars/package_whitelist.txt

 and append a line

org\.android_x86\.analytics

to it.

If everything goes okay, the Android system image would be build.


 Now we start to build a better ffmpeg with hardware acceleration API, vaapi, cuvid etc. The system already offer the possibilty but didn't supply the correct configuration as the default.

Copy the file

external/ffmpeg/libavformat/Android.mk

to

external/ffmpeg/libavfilter

If you want to build the command line of ffmpeg, create a new Android.mk file under external/tools folder, fill it with content

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_CFLAGS += \
  -DANDROID \
  -DTARGET_CONFIG=\"config-x86_64-x86_64.h\" \

LOCAL_SRC_FILES := \
    ../ffmpeg.c \
    ../ffmpeg_filter.c \
    ../ffmpeg_opt.c \
    ../ffmpeg_cuvid.c \
    ../ffmpeg_vaapi.c \
    ../cmdutils.c \

LOCAL_C_INCLUDES += \
  $(LOCAL_PATH)/android/include \
  $(LOCAL_PATH)/.. \

LOCAL_SHARED_LIBRARIES := libavutil libavcodec libswscale libswresample libswscale libavformat libavfilter

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := ffmpeg

include $(BUILD_EXECUTABLE)

Then that's it, you would have the ffmpeg command line under /system/bin/ffmpeg !

Do not touch the script gen-android-configs and configure with ffmpeg.

Now let's add more dependency to the system, such as libva-utils for the Intel platform to

首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇一起学Android之Dialog 下一篇oppo5.0以上系统怎么样不Root激活..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目