FFmpeg在Android上的移植优化步骤
http://blog.csdn.net/feixiang_john/article/details/7894188
从事多媒体软件开发的人几乎没有不知道FFmpeg的,很多视频播放器都是基于FFmpeg开发的。如今最火的智能手机操作系统Android上的很多第三方视频播放器也是基于FFmpeg实现全格式支持。由于Android通常跑在ARM处理器上,而且Android使用了自己的libc库(即bionic),因此要在Android上编译和使用FFmpeg需要做一些移植工作,好在FFmpeg本身用C写成,很好地支持跨平台移植,实现这个目的并不难,事实上已经有很多前辈做过这方面的工作并公开了他们的成果。
1. Rockplayer:
http://rockplayer.freecoder.org/index_cn.html
http://blog.csdn.net/harry_helei/article/details/6322767
2. havlenapetr:
http://github.com/havlenapetr/FFMpeg
http://blog.csdn.net/scut1135/article/details/6536157
http://hi.baidu.com/eefolks/blog/item/e0329e4682859129cefca351.html
http://ajavn.com/anzhuotuandui/4351.html
3. halfninja:
https://github.com/halfninja/android-ffmpeg-x264
4. olvaffe's:
http://gitorious.org/~olvaffe/ffmpeg/ffmpeg-android
http://www.nujk.com/ffmpeg-on-android
5. 流媒体开发论坛 - 罗索工作室:
http://www.rosoo.net/a/201108/14834.html
http://bbs.rosoo.net/thread-6252-1-1.html
当下本人也做这方面的事情,主要是优化ffmpeg编解码的性能,当然首先就是要搭建环境,编译代码,测试代码性能,然后优化模块,编译测试和调试,最终再测试性能:看了很多文章,对于一些新手是有点帮助,但是都不是很全面,下面简单记录下我如何搭建环境,如何编译,测试:
可以使用Rockplayer的方案进行实践。Rockplayer是Android上最有名的第三方视频播放器之一,其开发者根据LGPL协议公开了所使用的FFmpeg源码,该方案用Android NDK将FFmpeg源码编译生成一个单独的共享库libffmpeg.so,其中静态链接了libavformat、libavcodec、libavutil等模块,要使用FFmpeg只需要调用这一个.so即可。当然有了这个库还只是第一步,要利用FFmpeg开发一个自己的播放器或者把FFmpeg集成到Android本身的播放引擎stagefright中还需要很多其他工作,包括针对硬件平台进行优化。目前我做的只是编译出libffmpeg.so以及将FFmpeg自带的工具ffmpeg在adb shell中跑起来。我是在Android 3.2(Honeycomb)上编译FFmpeg,所用NDK版本为r7,在Android的其他版本上编译也大同小异。
题外话:Rockplayer之前也和他们谈过合作的事情,一家几个人搞得小型公司(其实也谈不上公司了),office在上海张江一个不起眼的小区里,也不能说他们没有技术含量,只能说他们找到一个突破口,能挣点小钱,他们的android手机播放器设计原则是支持要全,画质要清晰,性能不是主要,面向中高档手机,配置相对来说就高些。
下面把具体编译步骤描述如下,假定NDK安装在~/android-ndk-r7:
1. 首先从FFmpeg官网下载最新的release版本源码ffmpeg-0.11.tar.gz解压缩到Android源码树的ffmpeg/下。
2 准备一个编译脚本build_android.sh并放在ffmpeg/下面,这个脚本也是Rockplayer提供的,需做一些修改,其内容附在后面。我目前用的也会附在后面。
3 在ffmpeg目录下运行./build_android.sh开始编译FFmpeg,编译好的libffmpeg.so会放在文件夹android里面,一共有3个版本分别对应3种ARM体系结构,包括armv7-a、armv7-a-vfp、armv6_vfp,根据所运行的硬件平台选取其中一个版本。为了编译使用FFmpeg的程序时可以方便地找到libffmpeg.so,可将它复制到$OUT/system/lib/和$OUT/obj/lib/,当然这一步也可以加在build_android.sh中做。
4. 接下来就是编译可执行文件ffmpeg了,这个工具可以在命令行下完成FFmpeg提供的几乎所有功能包括编码、解码、转码等,也是用来调试和验证很有用的工具。其实上述编译完后在$ANDROID_BUILD_TOP/external/ffmpeg/下也会生成ffmpeg,但是在设备上无法运行。为了编出能在设备上运行的ffmpeg,可以写一个简单的Android.mk,其内容如下:
- LOCAL_PATH:= $(call my-dir)
- include $(CLEAR_VARS)
- LOCAL_SRC_FILES:= \
- cmdutils.c \
- ffmpeg.c
- LOCAL_C_INCLUDES :=
- LOCAL_SHARED_LIBRARIES := \
- libffmpeg
- LOCAL_PRELINK_MODULE := false
- LOCAL_MODULE := ffmpeg
- include $(BUILD_EXECUTABLE)
也可以在E:\android-ndk-r7-windows\android-ndk-r7\samples\test-libstdc++\jni这个目录修改下Android.mk, 修改为:
- LOCAL_PATH:= $(call my-dir)
- include $(CLEAR_VARS)
- LOCAL_SRC_FILES := ffmpeg.c cmdutils.c
- #LOCAL_PREBUILT_LIBS := libffmpeg
- LOCAL_ARM_MODE := arm
- LOCAL_C_INCLUDES += \
- $(LOCAL_PATH)/include \
- $(LOCAL_PATH)/include/libavcodec \
- $(LOCAL_PATH)/ \
- $(LOCAL_PATH)/include/libavfilter \
- $(LOCAL_PATH)/include/libavdevice \
- $(LOCAL_PATH)/include/libavutil
- #LOCAL_LDLIBS := -L$(LOCAL_PATH) -lffmpeg
- LOCAL_LDLIBS := libffmpeg.so
- LOCAL_MODULE := ffmpeg
- include $(BUILD_EXECUTABLE)
当然要把ffmpeg.c cmdutils.c和libffmpeg.so拷贝到当前目录。
5. 将上面编好的libffmpeg.so和ffmpeg分别用adb push复制到设备的/system/lib/和/system/bin/,push之前可先对libffmpeg.so做一下strip否则太大。现在就可以在adb shell中运行ffmpeg了,使用方法与在PC上相同。当然如果要用到其他开源库例如x264那么还需要把它们也移植到Android。
以上是基本的步骤,仅供参考,可以根据具体情况修改build_android.sh里面的配置选项。如前所述,编译FFmpeg只是第一步,后续还有很多工作需要做,今后如果有进展再贴上来。
最后附上build_android.sh供参考,在此也感谢Rockplayer的开发者:
- #!/bin/bash
- ######################################################
- # FFmpeg builds script for Android+ARM platform
- #
- # This script is released under term of
- # CDDL (http://www.opensource.org/licenses/cddl1)
- # Wrote by pinxue (~@gmail.com) from RockPlayer.com
- # 2010-8 ~ 2011-4
- ######################################################
- ######################################################
- # Usage:
- # put this script in top of FFmpeg source tree
- # ./build_android
- #
- # It generates binary for following architectures:
- # ARMv6
- # ARMv6+VFP
- # ARMv7+VFPv3-d16 (Tegra2)
- # ARMv7+Neon (Cortex-A8)
- #
- # Customizing:
- # 1. Feel free to change ./configure parameters for more features
- # 2. To adapt other ARM variants
- # set $CPU and $OPTIMIZE_CFLAGS
- # call build_one
- ######################################################
- NDK=~/android-ndk-r7
- PLATFORM=$NDK/platforms/android-8/arch-arm/
- PREBUILT=../../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3
- function build_one
- {
- # -fasm : required. Android header file uses asm keyword instead of __asm__ , but most of c dialect (like ansi,c99,gnu99) implies -fno-asm.
- # ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h: In function '___arch__swab32':
- # ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h:25: error: expected ')' before ':' token
- # -fno-short-enums : optimized. Else FFmpeg obj will generate a huge number of warning for variable-size enums,
- # though we may suppress them by --no-enum-size-warning, it would be better to avoid it.
- # .../ld: warning: cmdutils.o uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
- # --extra-libs="-lgcc" : required. Else cannot solve some runtime function symbols
- # ... undefined reference to `__aeabi_f2uiz'
- # --enable-protocols : required. Without this option, the file open always fails mysteriously.
- # FFmpeg's av_open_input_file will invoke file format probing functions, but because most of useful demuxers has flag of zero
- # which cause them are ignored during file format probling and fall to url stream parsing,
- # if protocols are disabled, the file:// url cannot be opened as well.
- # $PREBUILT/bin/arm-eabi-ar d libavcodec/libavcodec.a inverse.o : required.
- # FFmpeg includes two copies of inverse.c both in libavutil and libavcodec for performance consideration (not sure the benifit yet)
- # Without this step, final ld of generating libffmpeg.so will fail silently, if invoke ld through gcc, gcc will collect more reasonable error message.
- # -llog: debug only, FFmpeg itself doesn't require it at all.
- # With this option, we may simply includes "utils/Log.h" and use LOGx() to observe FFmpeg's behavior
- # PS, it seems the toolchain implies -DNDEBUG somewhere, it would be safer to use following syntax
- # #ifdef NDEBUG
- # #undef NDEBUG
- # #define HAVE_NDEBUG
- # #endif
- # #include "utils/Log.h"
- # #ifdef HAVE_NDEBUG
- # #define NDEBUG
- # #undef HAVE_NDEBUG
- # #endif
- # --whole-archive : required. Else ld generate a small .so file (about 15k)
- # --no-stdlib : required. Android doesn't use standard c runtime but invited its own wheal (bionic libc) because of license consideration.
- # space before \ of configure lines: required for some options. Else next line will be merged into previous lines's content and cause problem.
- # Especially the --extra-cflags, the next line will pass to gcc in this case and configure will say gcc cannot create executable.
- # many options mentioned by articles over internet are implied by -O2 or -O3 already, need not repeat at all.
- # two or three common optimization cflags are omitted because not sure about the trade off yet. invoke NDK build system with V=1 to find them.
- # -Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x mentioned by almost every articles over internet, but it is not required to specify at all.
- # -Dipv6mr_interface=ipv6mr_ifindex : required. Android inet header doesn't use ipv6mr_interface which is required by rfc, seems it generate this user space header file directly from kernel header file, but Linux kernel has decided to keep its own name for ever and ask user space header to use rfc name.
- # HAVE_SYS_UIO_H : required. Else:
- # In file included from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/socket.h:29,
- # from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/sys/socket.h:33,
- # from libavformat/network.h:35,
- # from libavformat/utils.c:46:
- #~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/uio.h:19: error: redefinition of 'struct iovec'
- #
- # --disable-doc : required because of strange bug of toolchain.
- ./configure --target-os=linux \
- --prefix=$PREFIX \
- --enable-cross-compile \
- --extra-libs="-lgcc" \
- --arch=arm \
- --cc=$PREBUILT/bin/arm-eabi-gcc \
- --cross-prefix=$PREBUILT/bin/arm-eabi- \
- --nm=$PREBUILT/bin/arm-eabi-nm \
- --sysroot=$PLATFORM \
- --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
- --disable-shared \
- --enable-static \
- --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
- --enable-parsers \
- --enable-encoders \
- --enable-decoders \
- --enable-muxers \
- --enable-demuxers \
- --enable-swscale \
- --enable-swscale-alpha \
- --disable-ffplay \
- --disable-ffprobe \
- --disable-ffserver \
- --enable-network \
- --enable-indevs \
- --disable-bsfs \
- --enable-filters \
- --enable-avfilter \
- --enable-protocols \
- --enable-asm \
- $ADDITIONAL_CONFIGURE_FLAG
- #make clean
- make -j4 install
- $PREBUILT/bin/arm-eabi-ar d libavcodec/libavcodec.a inverse.o
- $PREBUILT/bin/arm-eabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libavfilter/libavfilter.a libswscale/libswscale.a libavdevice/libavdevice.a libswresample/libswresample.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-eabi/4.4.3/libgcc.a
- }
- #arm v6
- CPU=armv6
- OPTIMIZE_CFLAGS="-marm -march=$CPU"
- PREFIX=./android/$CPU
- ADDITIONAL_CONFIGURE_FLAG=
- #build_one
- #arm v7vfpv3
- CPU=armv7-a
- OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
- PREFIX=./android/$CPU
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
- #arm v7vfp
- CPU=armv7-a
- OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU "
- PREFIX=./android/$CPU-vfp
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
- #arm v7n
- CPU=armv7-a
- OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
- PREFIX=./android/$CPU
- ADDITIONAL_CONFIGURE_FLAG=--enable-neon
- build_one
- #arm v6+vfp
- CPU=armv6
- OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU"
- PREFIX=./android/${CPU}_vfp
- ADDITIONAL_CONFIGURE_FLAG=
- build_one
下面是我使用的 build_android.sh文件:
- #!/bin/bash
- ######################################################
- # FFmpeg builds script for Android+ARM platform
- #
- # This script is released under term of
- # CDDL (http://www.opensource.org/licenses/cddl1)
- ######################################################
- # Usage:
- # put this script in top of FFmpeg source tree
- # ./build_android
- #
- # It generates binary for following architectures:
- # ARMv6
- # ARMv6+VFP
- # ARMv7+VFPv3-d16 (Tegra2)
- # ARMv7+Neon (Cortex-A8)
- #
- # Customizing:
- # 1. Feel free to change ./configure parameters for more features
- # 2. To adapt other ARM variants
- # set $CPU and $OPTIMIZE_CFLAGS
- # call build_one
- ######################################################
- NDK=E:/android-ndk-r7-windows/android-ndk-r7
- PLATFORM=$NDK/platforms/android-8/arch-arm/
- PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows
- function build_one
- {
- # -fasm : required. Android header file uses asm keyword instead of __asm__ , but most of c dialect (like ansi,c99,gnu99) implies -fno-asm.
- # ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h: In function '___arch__swab32':
- # ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/asm/byteorder.h:25: error: expected ')' before ':' token
- # -fno-short-enums : optimized. Else FFmpeg obj will generate a huge number of warning for variable-size enums,
- # though we may suppress them by --no-enum-size-warning, it would be better to avoid it.
- # .../ld: warning: cmdutils.o uses variable-size enums yet the output is to use 32-bit enums; use of enum values across objects may fail
- # --extra-libs="-lgcc" : required. Else cannot solve some runtime function symbols
- # ... undefined reference to `__aeabi_f2uiz'
- # --enable-protocols : required. Without this option, the file open always fails mysteriously.
- # FFmpeg's av_open_input_file will invoke file format probing functions, but because most of useful demuxers has flag of zero
- # which cause them are ignored during file format probling and fall to url stream parsing,
- # if protocols are disabled, the file:// url cannot be opened as well.
- # $PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o : required.
- # FFmpeg includes two copies of inverse.c both in libavutil and libavcodec for performance consideration (not sure the benifit yet)
- # Without this step, final ld of generating libffmpeg.so will fail silently, if invoke ld through gcc, gcc will collect more reasonable error message.
- # -llog: debug only, FFmpeg itself doesn't require it at all.
- # With this option, we may simply includes "utils/Log.h" and use LOGx() to observe FFmpeg's behavior
- # PS, it seems the toolchain implies -DNDEBUG somewhere, it would be safer to use following syntax
- # #ifdef NDEBUG
- # #undef NDEBUG
- # #define HAVE_NDEBUG
- # #endif
- # #include "utils/Log.h"
- # #ifdef HAVE_NDEBUG
- # #define NDEBUG
- # #undef HAVE_NDEBUG
- # #endif
- # --whole-archive : required. Else ld generate a small .so file (about 15k)
- # --no-stdlib : required. Android doesn't use standard c runtime but invited its own wheal (bionic libc) because of license consideration.
- # space before \ of configure lines: required for some options. Else next line will be merged into previous lines's content and cause problem.
- # Especially the --extra-cflags, the next line will pass to gcc in this case and configure will say gcc cannot create executable.
- # many options mentioned by articles over internet are implied by -O2 or -O3 already, need not repeat at all.
- # two or three common optimization cflags are omitted because not sure about the trade off yet. invoke NDK build system with V=1 to find them.
- # -Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf.x mentioned by almost every articles over internet, but it is not required to specify at all.
- # -Dipv6mr_interface=ipv6mr_ifindex : required. Android inet header doesn't use ipv6mr_interface which is required by rfc, seems it generate this user space header file directly from kernel header file, but Linux kernel has decided to keep its own name for ever and ask user space header to use rfc name.
- # HAVE_SYS_UIO_H : required. Else:
- # In file included from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/socket.h:29,
- # from ~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/sys/socket.h:33,
- # from libavformat/network.h:35,
- # from libavformat/utils.c:46:
- #~/android/android-ndk-r4/build/platforms/android-5/arch-arm//usr/include/linux/uio.h:19: error: redefinition of 'struct iovec'
- #
- # --disable-doc : required because of strange bug of toolchain.
- ./configure --target-os=linux \
- --prefix=$PREFIX \
- --enable-cross-compile \
- --extra-libs="-lgcc" \
- --arch=arm \
- --enable-memalign-hack \
- --enable-gpl \
- --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
- --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
- --nm=$PREBUILT/bin/arm-linux-androideabi-nm \
- --sysroot=$PLATFORM \
- --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
- --disable-shared \
- --enable-static \
- --extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -L$PLATFORM/usr/lib -lc -lm -ldl -llog" \
- --enable-parsers \
- --enable-decoders \
- --enable-swscale \
- --disable-ffplay \
- --disable-ffprobe \
- --disable-ffserver \
- --enable-network \
- --enable-indevs \
- --enable-optimizations \
- --enable-asm \
- --enable-swresample \
- --disable-debug
- $ADDITIONAL_CONFIGURE_FLAG
- #make clean
- make -j4 install
- $PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
- $PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libavfilter/libavfilter.a libswscale/libswscale.a libswresample/libswresample.a libavresample/libavresample.a libpostproc/libpostproc.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
- }
- ##arm v6
- #CPU=armv6
- #OPTIMIZE_CFLAGS="-marm -march=$CPU"
- #PREFIX=./android/$CPU
- #ADDITIONAL_CONFIGURE_FLAG=
- ##build_one
- #
- ##arm v7vfpv3
- #CPU=armv7-a
- #OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
- #PREFIX=./android/$CPU
- #ADDITIONAL_CONFIGURE_FLAG=
- #build_one
- #
- ##arm v7vfp
- #CPU=armv7-a
- #OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU "
- #PREFIX=./android/$CPU-vfp
- #ADDITIONAL_CONFIGURE_FLAG=
- #build_one
- #arm v7n
- CPU=armv7-a
- OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
- PREFIX=./android/$CPU
- ADDITIONAL_CONFIGURE_FLAG=--enable-neon
- build_one
- ##arm v6+vfp
- #CPU=armv6
- #OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU"
- #PREFIX=./android/${CPU}_vfp
- #ADDITIONAL_CONFIGURE_FLAG=
- #build_one
6. 把编译好的libffmpeg.so 和 可执行文件 ffmpeg 文件push到 手机里面运行测试! 下面是操作步骤:
a: 拷贝文件到手机sdcard
E:\android-ndk-r7-windows\android-ndk-r7\samples\test-libstdc++\libs\armeabi>
拷贝可执行文件
adb push ffmpeg /sdcard/ttt
4507 KB/s (144248 bytes in 0.031s)
拷贝库
adb push liffmpeg.so /sdcard/ttt
3756 KB/s (8233079 bytes in 2.140s)
b: 从手机sdcard 拷贝到系统bin目录和系统lib目录
E:\android-ndk-r7-windows\android-ndk-r7\samples\test-libstdc++\libs\armeabi>adb
shell
$ su
su
# cd /system/bin
cd /system/bin
# rm ffmpeg
rm ffmpeg
# cat /sdcard/ttt/ffmpeg > ffmpeg
cat /sdcard/ttt/ffmpeg > ffmpeg
# chmod 777 ffmpeg
chmod 777 ffmpeg
# cd ../lib
cd /system/lib
# rm libffmpeg.so
rm libffmpeg.so
# cat /sdcard/ttt/libffmpeg.so >libffmpeg.so
cat /sdcard/ttt/libffmpeg.so >libffmpeg.so
# chmod 777 libffmpeg.so
chmod 777 libffmpeg.so
# cd ../bin
cd /system/bin
运行可执行文件:
./ffmpeg -i /sdcard/ttt/test.264 /sdcard/ttt/output.yuv
FFmpeg在Android上的移植优化步骤的更多相关文章
- FFmpeg在Android上的移植之第一步
http://blog.sina.com.cn/s/blog_69a04cf40100x1fr.html 从事多媒体软件开发的人几乎没有不知道FFmpeg的,很多视频播放器都是基于FFmpeg开发的. ...
- android开发中图片优化步骤
android开发中图片优化方法 1.图片加载方法,方便用户加载图片 /*** * 加载本地图片 * @param context:主运行函数实例 * @param bitAdress:图片地址,一般 ...
- ffmpeg在android上输出滑屏问题处理
ffmpeg部分机器上有花屏的问题 原代码例如以下: while(av_read_frame(formatCtx, &packet)>=0 && !_stop & ...
- ffmpeg在am335x上的移植
交叉编译工具:arm-linux-gcc 一.先下载一下文件 1. yasm-1.2.0.tar.gz 2. x264-snapshot-20140424-2245.tar.bz2 3. xvidco ...
- FFmpeg的Android平台移植—编译篇
摘要:本文主要介绍将FFmpeg音视频编解码库移植到Android平台上的编译和基本测试过程. 环境准备: ubuntu-12.04.5 android-ndk64-r10-linux-x86_64. ...
- Ionic在Android上部署app步骤
详情链接:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/ionic%E5%9C%A8android%E4%B8%8A%E9%83% ...
- STemWin5.22在STM32F103上的移植步骤
源:STemWin5.22在STM32F103上的移植步骤
- clapack在android上移植
参考 https://www.cnblogs.com/hrlnw/p/4128217.html 如何在android上进行android库编译 https://blog.csdn.net/h3c4le ...
- 系列篇|编译可在Android上运行的依赖库(一):glib库
前言 这是系列文章,它们由<编译可在Android上运行的glib库>及其他4篇文章组成,这4篇文章在“编译依赖库”一节中列出.由于glib库依赖于其他第三方库,所以需要先将依赖的第三方库 ...
随机推荐
- django1.8读书笔记模型高级进阶
一.访问外键和多对多值 例如:模型类定义如下 from django.db import models class Publisher(models.Model): name = models.Cha ...
- javascript Set data structures
集合(set)是一组无序的,但彼此之间又有一定相关性的数据集.每个成员在数组中只能出现一次. 在使用集合(set)之前最好先理解一下内容: 1.不包含任何成员的集合称为空集合. 2.如果两个集合的成员 ...
- [hihoCoder] #1158 : 质数相关
时间限制:2000ms 单点时限:1000ms 内存限制:256MB 描述 两个数a和 b (a<b)被称为质数相关,是指a × p = b,这里p是一个质数.一个集合S被称为质数相关,是指S中 ...
- 用VIM打造C语言编写器
1.先用vim --version命令查看一下都是安装了那些vim特性,以及版本等等情况. vim --version VIM - Vi IMproved 7.4 (2013 Aug 10, comp ...
- jquery 可拖拽的窗体控件实现代码
引入JQUERY框架.把这个控件代码放到一个js文件里面直接引入就可以了控件代码 $.fn.myDrag = function() { var self = $(this); self.css(&qu ...
- C#使用CodeDom动态加载cs文件
public static object Create(string path) { var provOptions = new Dictionary<string, string>(); ...
- 在 Chrome 开发者工具中调试 node.js
命令行工具 devtool ,它可以在 Chrome 的开发者工具中运行 Node.js 程序. 下面的记录显示了在一个 HTTP 服务器中设置断点的情况. 该工具基于 Electron 将 Node ...
- Spark性能优化(1)——序列化、内存、并行度、数据存储格式、Shuffle
序列化 背景: 在以下过程中,需要对数据进行序列化: shuffling data时需要通过网络传输数据 RDD序列化到磁盘时 性能优化点: Spark默认的序列化类型是Java序列化.Java序列化 ...
- OCILIB开源的C/C++ Oracle驱动
OCILIB是一个开源的.跨平台的Oracle驱动,可以高效的操作Oracle数据库. OCILIB库: - 提供丰富的.全特性的.容易使用的API - 运行在所有的Oracle平台 - 使用标准的I ...
- C语言 · 三角形
算法提高 12-1三角形 时间限制:1.0s 内存限制:256.0MB 问题描述 为二维空间中的点设计一个结构体,在此基础上为三角形设计一个结构体.分别设计独立的函数计算三角形的周长 ...