NDK编译ffmpeg程序
2015-04-21 20:49
218 查看
参考: /article/10519818.html
1. 用Android NDK自带的脚本做一个独立的工具链:
[root@localhost work]# pwd
/root/work
[root@localhost work]# ls
android-ndk-r10d ffmpeg-2.6.2.tar.bz2
[root@localhost work]# tar xjf ffmpeg-2.6.2.tar.bz2
[root@localhost work]# ls android-ndk-r10d/
build ndk-depends ndk-which samples
docs ndk-gdb platforms sources
find-win-host.cmd ndk-gdb-py prebuilt tests
GNUmakefile ndk-gdb.py README.TXT toolchains
ndk-build ndk-gdb-py.cmd RELEASE.TXT
ndk-build.cmd ndk-stack remove-windows-symlink.sh
[root@localhost work]# android-ndk-r10d/build/tools/make-standalone-toolchain.sh --platform=android-8 --toolchain=arm-linux-androideabi-4.9
Copying prebuilt binaries...
Copying sysroot headers and libraries...
Copying c++ runtime headers and libraries...
Creating package file: /tmp/ndk-root/arm-linux-androideabi-4.9.tar.bz2
Cleaning up...
Done.
注: --toolchain=arm-linux-androideabi-4.9 取决于NDK子目录/toolchains下提供了哪些文件夹(工具链)
2. 将工具链bin目录加到PATH环境变量
[root@localhost work]# tar xjf /tmp/ndk-root/arm-linux-androideabi-4.9.tar.bz2
[root@localhost work]# export PATH=$PATH:/root/work/arm-linux-androideabi-4.9/bin/
3. 配置ffmpeg代码
[root@localhost work]# cd ffmpeg-2.6.2
[root@localhost ffmpeg-2.6.2]# mkdir ../temp
[root@localhost ffmpeg-2.6.2]# ./configure --enable-cross-compile --target-os=linux --arch=arm --cross-prefix=arm-linux-androideabi- --disable-doc --disable-debug --prefix=/root/work/temp
这里输出一条警告,貌似不影响:WARNING: arm-linux-androideabi-pkg-config not found, library detection may fail.
4. 编译安装(安装到刚才 --perfix= 指定的目录中去)
[root@localhost ffmpeg-2.6.2]# make; make install;
[root@localhost ffmpeg-2.6.2]# cd ..; ls temp
bin include lib share
[root@localhost ffmpeg-2.6.2]# ls temp/bin
ffmpeg ffprobe ffserver
以上是生成的arm二进制程序
5. 复制到Android上运行,添加可执行权限需要手机 root 过
将生成的ffmpeg,ffprobe复制到手机存储空间;
然后adb shell进Android系统:
$ su
# mount
......
/dev/block/mmcblk1p21 /system ext3 ro,noatime,nodiratime,barrier=1,data=ordered
0 0
......
#mount -o remount /dev/block/mmcblk1p21 /system/
将/system目录重新挂载为可读可写
# cp /sdcard/ffmpeg /system/bin/
# cp /sdcard/ffprobe /system/bin/
然后试下运行效果
# ffmpeg -version
ffmpeg -version
ffmpeg version 2.6.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9 (GCC) 20140827 (prerelease)
configuration: --enable-cross-compile --target-os=linux --arch=arm --cross-prefi
x=arm-linux-androideabi- --disable-doc --disable-debug --prefix=/root/work/temp
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
1. 用Android NDK自带的脚本做一个独立的工具链:
[root@localhost work]# pwd
/root/work
[root@localhost work]# ls
android-ndk-r10d ffmpeg-2.6.2.tar.bz2
[root@localhost work]# tar xjf ffmpeg-2.6.2.tar.bz2
[root@localhost work]# ls android-ndk-r10d/
build ndk-depends ndk-which samples
docs ndk-gdb platforms sources
find-win-host.cmd ndk-gdb-py prebuilt tests
GNUmakefile ndk-gdb.py README.TXT toolchains
ndk-build ndk-gdb-py.cmd RELEASE.TXT
ndk-build.cmd ndk-stack remove-windows-symlink.sh
[root@localhost work]# android-ndk-r10d/build/tools/make-standalone-toolchain.sh --platform=android-8 --toolchain=arm-linux-androideabi-4.9
Copying prebuilt binaries...
Copying sysroot headers and libraries...
Copying c++ runtime headers and libraries...
Creating package file: /tmp/ndk-root/arm-linux-androideabi-4.9.tar.bz2
Cleaning up...
Done.
注: --toolchain=arm-linux-androideabi-4.9 取决于NDK子目录/toolchains下提供了哪些文件夹(工具链)
2. 将工具链bin目录加到PATH环境变量
[root@localhost work]# tar xjf /tmp/ndk-root/arm-linux-androideabi-4.9.tar.bz2
[root@localhost work]# export PATH=$PATH:/root/work/arm-linux-androideabi-4.9/bin/
3. 配置ffmpeg代码
[root@localhost work]# cd ffmpeg-2.6.2
[root@localhost ffmpeg-2.6.2]# mkdir ../temp
[root@localhost ffmpeg-2.6.2]# ./configure --enable-cross-compile --target-os=linux --arch=arm --cross-prefix=arm-linux-androideabi- --disable-doc --disable-debug --prefix=/root/work/temp
这里输出一条警告,貌似不影响:WARNING: arm-linux-androideabi-pkg-config not found, library detection may fail.
4. 编译安装(安装到刚才 --perfix= 指定的目录中去)
[root@localhost ffmpeg-2.6.2]# make; make install;
[root@localhost ffmpeg-2.6.2]# cd ..; ls temp
bin include lib share
[root@localhost ffmpeg-2.6.2]# ls temp/bin
ffmpeg ffprobe ffserver
以上是生成的arm二进制程序
5. 复制到Android上运行,添加可执行权限需要手机 root 过
将生成的ffmpeg,ffprobe复制到手机存储空间;
然后adb shell进Android系统:
$ su
# mount
......
/dev/block/mmcblk1p21 /system ext3 ro,noatime,nodiratime,barrier=1,data=ordered
0 0
......
#mount -o remount /dev/block/mmcblk1p21 /system/
将/system目录重新挂载为可读可写
# cp /sdcard/ffmpeg /system/bin/
# cp /sdcard/ffprobe /system/bin/
然后试下运行效果
# ffmpeg -version
ffmpeg -version
ffmpeg version 2.6.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9 (GCC) 20140827 (prerelease)
configuration: --enable-cross-compile --target-os=linux --arch=arm --cross-prefi
x=arm-linux-androideabi- --disable-doc --disable-debug --prefix=/root/work/temp
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
相关文章推荐
- Ubuntu12.10 64位 + android-ndk-r9 编译ffmpeg遇到的问题
- 编译ndk可执行程序 直接用cygwin编译 不用eclipse
- 手工编译一个ndk程序
- Ubuntu12.04 32位 + android-ndk-r9c 编译ffmpeg遇到的问题记录
- NDK编译Android字符界面的可执行程序
- ffmpeg不同版本的NDK编译
- Android:WIN10+MinGW+NDK编译FFmpeg
- 用Eclipse调试ndk编译的c程序
- 使用ubuntu14和ndk 编译ffmpeg在android平台的so动态库
- ffmpeg使用NDK r9编译
- android-ndk-r7 编译 ffmpeg-0.10
- Mac下ndk编译ffmpeg2.1.4
- Ubuntu下安装配置NDK、独立交叉编译工具编译C/C++程序
- AndroidStudio2.2.3版本使用CMake编译NDK工程(ffmpeg)
- Ubuntu 14.04 NDK R9 编译ffmpeg2.4
- 利用 CMake 和 NDK 交叉编译 Android 下的可执行程序
- 编译程序依赖于 ffmpeg和x264 的链接顺序
- NDK编译Android上运行的C可执行程序
- windows环境下用ndk编译出供android的ffmpeg
- ffmpeg2.2在ubuntu下使用NDK编译——并在android工程下测试使用