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 detect the video codec capability of the system.

Under the folder external, clone the repository at branch 1.8.3

git clone -b 1.8. https://github.com/intel/libva-utils.git

Enter the libva-utils folder, change a bit the source code. The system's libva under driver is 1.1.0, it's not very compatible with the libva-utils, which is a new program.

diff --git a/vainfo/vainfo.c b/vainfo/vainfo.c
index ..5d9f055
--- a/vainfo/vainfo.c
+++ b/vainfo/vainfo.c
@@ -, +, @@ int main(int argc, const char* argv[])
const char *name = strrchr(argv[], '/');
VAProfile profile, *profile_list = NULL;
int num_profiles, max_num_profiles, i;
- VAEntrypoint entrypoint, entrypoints[];
+ VAEntrypoint entrypoints[];
+ int entrypoint_index;
int num_entrypoint;
int ret_val = ; @@ -, +, @@ int main(int argc, const char* argv[])
va_status = vaInitialize(va_dpy, &major_version, &minor_version);
CHECK_VASTATUS(va_status, "vaInitialize", ); - printf("%s: VA-API version: %d.%d (libva %s)\n",
- name, major_version, minor_version, LIBVA_VERSION_S);
+ printf("%s: VA-API version: %d.%d\n",
+ name, major_version, minor_version); driver = vaQueryVendorString(va_dpy);
printf("%s: Driver version: %s\n", name, driver ? driver : "<unknown>");
@@ -, +, @@ int main(int argc, const char* argv[])
CHECK_VASTATUS(va_status, "vaQueryConfigEntrypoints", ); profile_str = profile_string(profile);
- for (entrypoint = ; entrypoint < num_entrypoint; entrypoint++)
- printf(" %-32s: %s\n", profile_str, entrypoint_string(entrypoints[entrypoint]));
+ for (entrypoint_index = ; entrypoint_index < num_entrypoint; entrypoint_index++)
+ printf(" %-32s: %s\n", profile_str, entrypoint_string(entrypoints[entrypoint_index]));

Just make the vainfo.c is able to be compiled with system libva.

Back to the folder android-x86, type

mmm external/libva-utils

to just build the specific module. That's it, now the /system/bin/vainfo would be there !


References

  • http://www.android-x86.org/getsourcecode
  • https://github.com/CyanogenMod/android_external_ffmpeg
  • https://github.com/intel/libva
  • https://github.com/intel/libva-utils

How to build ffmpeg with hardware accelerated codecs for Android x86的更多相关文章

  1. How to Build FFmpeg for Android

    http://www.roman10.net/how-to-build-ffmpeg-for-android/ ffmpeg is an open-source platform for record ...

  2. 硬件加速 Hardware Accelerated 绘制

    官方文档中对硬件加速的描述 原文地址:http://developer.android.com/guide/topics/graphics/hardware-accel.html Beginning ...

  3. Build FFmpeg for iOS

    FFmpeg Build Instructions MAC 10.8 or better Copy ffmpeg-2.0.tar.bz2 (https://ffmpeg.org/releases/ff ...

  4. CSS开启硬件加速 hardware accelerated

    作者:孙志勇 微博 日期:2016年12月6日 一.时效性 所有信息都具有时效性.文章的价值,往往跟时间有很大关联.特别是技术类文章,请注意本文创建时间,如果本文过于久远,请读者酌情考量,莫要浪费时间 ...

  5. VS 的编译选项 build下的 platform target -- Any CPU和x86有什么影响?

    VS 的编译选项 build下的platform -- Any CPU和x86有什么影响? 现在的问题是,我的一个assembly用Any CPU编译就不能在64位系统下运行了,但是用x86编译就ok ...

  6. Using Qt to build an Omi App for iOS (and Android)

    JUNE 6, 2014 / HHARTZ Working on projects where the technology is pre-determined, it's often difficu ...

  7. ffmpeg学习笔记-Linux下编译Android动态库

    Android平台要使用ffmpeg就需要编译生成动态库,这里采用Ubuntu编译Android动态库 文件准备 要编译生成Android需要以下文件 NDK ffmpeg源代码 NDK下载 NDK可 ...

  8. 最简单的基于FFmpeg的移动端例子:Android 视频转码器

    http://blog.csdn.net/leixiaohua1020/article/details/47056365

  9. (转载)中文Appium API 文档

    该文档是Testerhome官方翻译的源地址:https://github.com/appium/appium/tree/master/docs/cn官方网站上的:http://appium.io/s ...

随机推荐

  1. nginx与Apache的对比以及优缺点

    本文来自其他文章.如有好的问题,希望各位大神多多分享, 谢谢了..... 今天准备较详细的对比一下apache httpd与nginx两个web服务器的异同点.优缺点.由于我并不是做web开发的,所以 ...

  2. FMDB的简单实用

    一.FMDB 的框架引入点击此处去GitHub下载 二.FMDB 的优缺点 优点:使用起来更加面向对象,省去了很多麻烦.冗余的C语言代码:对比苹果自带的Core Data框架,更加轻量级和灵活:提供了 ...

  3. Python3实现ICMP远控后门(下)之“Boss”出场

    ICMP后门 前言 第一篇:Python3实现ICMP远控后门(上) 第二篇:Python3实现ICMP远控后门(上)_补充篇 第三篇:Python3实现ICMP远控后门(中)之"嗅探&qu ...

  4. python 信息收集器和CMS识别脚本

    前言: 信息收集是渗透测试重要的一部分 这次我总结了前几次写的经验,将其 进化了一下 正文: 信息收集脚本的功能: 1.端口扫描 2.子域名挖掘 3.DNS查询 4.whois查询 5.旁站查询 CM ...

  5. SSH免密码登录Linux服务器

    作者:荒原之梦 原文链接:http://zhaokaifeng.com/?p=587 操作环境: 客户机操作系统:Ubuntu Linux 服务器操作系统:CentOS Linux 免密登陆的原理: ...

  6. Servlet到底是单例还是多例你了解吗?

    为一个Java Web开发者,你一定了解和学习过Servlet.或许还曾在面试中被问到过Servelt是单例还是多例这个问题. 遇到这个问题,你是否曾深入了解过,还是百度或者Google了一下,得到答 ...

  7. setInterval setTimeout 详解

    JavaScript的setTimeout与setInterval是两个很容易欺骗别人感情的方法,因为我们开始常常以为调用了就会按既定的方式执行, 我想不少人都深有同感, 例如 setTimeout( ...

  8. Android 自定义控件 轻松实现360软件详情页

    转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/43649913,本文出自:[张鸿洋的博客] 1.概述 最近有不少朋友私聊问应用宝. ...

  9. 交换两个局部变量Integer的值

    反射是很强大的,谁说的final修饰的就不能改变, 通过反射获取成员变量,之后可以取消访问修饰符,也就是说private的也可以访问, 在修改常量(final修饰的),之后就可以对其做任何操作了 如下 ...

  10. Maven项目中,系统设置的CLASSPATH环境变量问题

    在Maven项目中,系统的CLASSPATH环境变量失效了吗?在用Maven开发登录网站时,servlet-api出现错误,jdbc也出现错误,都是ClassNotFoundException,但这两 ...