1、創建工作目錄
bassy@ubuntu:~/Desktop$ mkdir develop
bassy@ubuntu:~/Desktop$ cd develop
bassy@ubuntu:~/Desktop/develop$
2、安裝git工具
bassy@ubuntu:~/Desktop/develop$ sudo apt-get install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
...
3、下載ffmepg源碼
bassy@ubuntu:~/Desktop/develop$ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
Cloning into 'ffmpeg'...
remote: Counting objects: 516515, done.
remote: Compressing objects: 100% (114032/114032), done.
^Cceiving objects: 6% (34752/516515), 8.20 MiB | 141.00 KiB/s
bassy@ubuntu:~/Desktop/develop$ cd ffmpeg/
bassy@ubuntu:~/Desktop/develop/ffmpeg$ ll
total 1584
drwxrwxrwx 18 bassy bassy 4096 Jun 6 10:27 ./
drwxrwxr-x 3 bassy bassy 4096 Jun 7 08:08 ../
-rwxrw-rw- 1 bassy bassy 56143 Jun 6 10:26 Changelog*
-rwxrw-rw- 1 bassy bassy 73279 Jun 6 10:26 cmdutils.c*
-rwxrw-rw- 1 bassy bassy 24505 Jun 6 10:26 cmdutils.h*
-rwxrw-rw- 1 bassy bassy 10627 Jun 6 10:26 cmdutils_opencl.c*
drwxrwxrwx 13 bassy bassy 4096 Jun 6 10:26 compat/
-rwxrw-rw- 1 bassy bassy 228905 Jun 6 10:26 configure*
-rwxrw-rw- 1 bassy bassy 418 Jun 6 10:26 CONTRIBUTING.md*
-rwxrw-rw- 1 bassy bassy 18092 Jun 6 10:26 COPYING.GPLv2*
-rwxrw-rw- 1 bassy bassy 35147 Jun 6 10:26 COPYING.GPLv3*
-rwxrw-rw- 1 bassy bassy 26526 Jun 6 10:26 COPYING.LGPLv2.1*
-rwxrw-rw- 1 bassy bassy 7651 Jun 6 10:26 COPYING.LGPLv3*
-rwxrw-rw- 1 bassy bassy 274 Jun 6 10:26 CREDITS*
drwxrwxrwx 4 bassy bassy 4096 Jun 6 10:26 doc/
drwxrwxrwx 2 bassy bassy 4096 Jun 6 10:26 ffbuild/
-rwxrw-rw- 1 bassy bassy 169685 Jun 6 10:26 ffmpeg.c*
-rwxrw-rw- 1 bassy bassy 2412 Jun 6 10:26 ffmpeg_cuvid.c*
-rwxrw-rw- 1 bassy bassy 15057 Jun 6 10:26 ffmpeg_dxva2.c*
-rwxrw-rw- 1 bassy bassy 44795 Jun 6 10:26 ffmpeg_filter.c*
-rwxrw-rw- 1 bassy bassy 19841 Jun 6 10:26 ffmpeg.h*
-rwxrw-rw- 1 bassy bassy 148299 Jun 6 10:26 ffmpeg_opt.c*
-rwxrw-rw- 1 bassy bassy 3064 Jun 6 10:26 ffmpeg_qsv.c*
-rwxrw-rw- 1 bassy bassy 6720 Jun 6 10:26 ffmpeg_vaapi.c*
-rwxrw-rw- 1 bassy bassy 4469 Jun 6 10:26 ffmpeg_vdpau.c*
-rwxrw-rw- 1 bassy bassy 6642 Jun 6 10:26 ffmpeg_videotoolbox.c*
-rwxrw-rw- 1 bassy bassy 132011 Jun 6 10:26 ffplay.c*
-rwxrw-rw- 1 bassy bassy 134506 Jun 6 10:26 ffprobe.c*
-rwxrw-rw- 1 bassy bassy 128352 Jun 6 10:26 ffserver.c*
-rwxrw-rw- 1 bassy bassy 51173 Jun 6 10:26 ffserver_config.c*
-rwxrw-rw- 1 bassy bassy 5814 Jun 6 10:26 ffserver_config.h*
drwxrwxrwx 7 bassy bassy 4096 Jun 6 10:27 .git/
-rwxrw-rw- 1 bassy bassy 50 Jun 6 10:26 .gitattributes*
-rwxrw-rw- 1 bassy bassy 279 Jun 6 10:26 .gitignore*
-rwxrw-rw- 1 bassy bassy 595 Jun 6 10:26 INSTALL.md*
drwxrwxrwx 14 bassy bassy 49152 Jun 6 10:26 libavcodec/
drwxrwxrwx 3 bassy bassy 4096 Jun 6 10:26 libavdevice/
drwxrwxrwx 4 bassy bassy 16384 Jun 6 10:26 libavfilter/
drwxrwxrwx 3 bassy bassy 20480 Jun 6 10:26 libavformat/
drwxrwxrwx 6 bassy bassy 4096 Jun 6 10:26 libavresample/
drwxrwxrwx 12 bassy bassy 4096 Jun 6 10:26 libavutil/
drwxrwxrwx 2 bassy bassy 4096 Jun 6 10:26 libpostproc/
drwxrwxrwx 6 bassy bassy 4096 Jun 6 10:26 libswresample/
drwxrwxrwx 7 bassy bassy 4096 Jun 6 10:26 libswscale/
-rwxrw-rw- 1 bassy bassy 4368 Jun 6 10:26 LICENSE.md*
-rwxrw-rw- 1 bassy bassy 28407 Jun 6 10:26 MAINTAINERS*
-rwxrw-rw- 1 bassy bassy 7142 Jun 6 10:26 Makefile*
drwxrwxrwx 2 bassy bassy 4096 Jun 6 10:26 presets/
-rwxrw-rw- 1 bassy bassy 1893 Jun 6 10:26 README.md*
-rwxrw-rw- 1 bassy bassy 8 Jun 6 10:26 RELEASE*
drwxrwxrwx 7 bassy bassy 4096 Jun 6 10:27 tests/
drwxrwxrwx 2 bassy bassy 4096 Jun 6 10:27 tools/
-rwxrw-rw- 1 bassy bassy 474 Jun 6 10:26 .travis.yml*
4、安裝NDK
bassy@ubuntu:~/Desktop/develop$ ll
total 16
drwxrwxr-x 4 bassy bassy 4096 Jun 7 08:29 ./
drwxr-xr-x 5 bassy bassy 4096 Jun 7 08:19 ../
drwxr-xr-x 11 bassy bassy 4096 Mar 15 14:20 android-ndk-r14b/
drwxrwxrwx 18 bassy bassy 4096 Jun 6 10:27 ffmpeg/
5、ffmpeg編譯配置
NDK=/home/bassy/Desktop/develop/android-ndk-r14b
SYSROOT=$NDK/platforms/android-14/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"
TARGET_ARCH="arm"
function build_one
{
./configure \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=android \
--arch=$TARGET_ARCH\
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fPIC -DANDROID $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
}
build_one
bassy@ubuntu:~/Desktop/develop/ffmpeg$ sudo chmod +x build_android.sh
[sudo] password for bassy:
bassy@ubuntu:~/Desktop/develop/ffmpeg$ ll *build_*
-rwxrwxr-x 1 bassy bassy 777 Jun 7 08:36 build_android.sh*
...
Program options:
--disable-programs do not build command line programs
--disable-ffmpeg disable ffmpeg build
--disable-ffplay disable ffplay build
--disable-ffprobe disable ffprobe build
--disable-ffserver disable ffserver build
Documentation options:
--disable-doc do not build documentation
--disable-htmlpages do not build HTML documentation pages
--disable-manpages do not build man documentation pages
--disable-podpages do not build POD documentation pages
--disable-txtpages do not build text documentation pages
Component options:
--disable-avdevice disable libavdevice build
--disable-avcodec disable libavcodec build
--disable-avformat disable libavformat build
--disable-swresample disable libswresample build
--disable-swscale disable libswscale build
...
6、開始編譯
bassy@ubuntu:~/Desktop/develop/ffmpeg$ sudo ./build_android.sh
...
INSTALL libavutil/lzo.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/ffversion.h
INSTALL libavutil/libavutil.pc
bassy@ubuntu:~/Desktop/develop/ffmpeg$
7、查看編譯結果
bassy@ubuntu:~/Desktop/develop/ffmpeg/android/arm$ ll
total 16
drwxr-xr-x 4 root root 4096 Jun 7 09:03 ./
drwxr-xr-x 3 root root 4096 Jun 7 09:03 ../
drwxr-xr-x 8 root root 4096 Jun 7 09:03 include/
drwxr-xr-x 3 root root 4096 Jun 7 09:03 lib/
bassy@ubuntu:~/Desktop/develop/ffmpeg/android/arm$ ll lib/
total 138992
drwxr-xr-x 3 root root 4096 Jun 7 09:03 ./
drwxr-xr-x 4 root root 4096 Jun 7 09:03 ../
-rw-r--r-- 1 root root 90607318 Jun 7 09:03 libavcodec.a
-rw-r--r-- 1 root root 13182384 Jun 7 09:03 libavfilter.a
-rw-r--r-- 1 root root 33612772 Jun 7 09:03 libavformat.a
-rw-r--r-- 1 root root 1636078 Jun 7 09:03 libavutil.a
-rw-r--r-- 1 root root 377648 Jun 7 09:03 libswresample.a
-rw-r--r-- 1 root root 2886158 Jun 7 09:03 libswscale.a
drwxr-xr-x 2 root root 4096 Jun 7 09:03 pkgconfig/
- libavcodec encoding/decoding library
- libavfilter graph-based frame editing library
- libavformat I/O and muxing/demuxing library
- libavdevice special devices muxing/demuxing library
- libavutil common utility library
- libswresample audio resampling, format conversion and mixing
- libpostproc post processing library
- libswscale color conversion and scaling library
沒有更多推薦了,返回首頁