FFmpeg/libx264 build for Android

Source: Internet
Author: User

Http://demo860.blogspot.com/2010/06/ffmpeg-libx264-build-for-android.html

 

 

 

FFmpeg/libx264 build for android1) Requirement

-Ndk R4: Please use ndk R4 instead of ndk R3.

-Using ndk R4 new option, you can know the detail build option.

-Please get FFMPEG http://www.ffmpeg.org/download.html

-Please get libx264 http://www.videolan.org/developers/x264.html

2) Build option for libx264

Export arm_root =/export/home/Android/ndk
Export arm_inc = $ arm_root/build/platforms/Android-5/arch-arm/usr/include/
Export arm_lib = $ arm_root/build/platforms/Android-5/arch-arm/usr/lib/
Export arm_tool = $ arm_root/build/prebuilt/linux-x86/arm-eabi-4.4.0
Export arm_libo = $ arm_tool/lib/GCC/ARM-Eabi/4.4.0
Export Path = $ arm_tool/bin: $ path
Export arm_pre = arm-Eabi

./Configure -- prefix =/sdcard/arm_and/
-- Disable-gpac/
-- Extra-cflags = "-I $ arm_inc-FPIC-dandroid-FPIC-mthumb-interwork-ffunction-sections-funwind-tables-fstack-prote
Ctor-fno-short-enums-d1_arm_arch_5 _-d1_arm_arch_5t _-blank _-d1_arm_arch_5te _-wno-psabi-March = armv5te-MTU
Ne = XScale-msoft-float-mthumb-OS-fomit-frame-pointer-fno-strict-aliasing-Finline-Limit = 64-dandroid-wa, -- noexecstack-
MMD-MP "/
-- Extra-ldflags = "-nostdlib-bdynamic-wl, -- no-undefined-wl,-Z, noexecstack-wl,-Z, nocopyreloc-wl,-soname,/System
/Lib/libz. So-wl,-rpath-link = $ arm_lib,-dynamic-linker =/system/bin/linker-L $ arm_lib-nostdlib $ arm_lib/crtbegin_dynamic.o $ ar
M_lib/crtend_android.o-LC-lm-LDL-lgcc "/
-- Cross-Prefix =$ {arm_pre}--- disable-ASM -- disable-pthread -- Host = arm-Linux/

3) Build option for FFMPEG

Export arm_root =/export/home/Android/ndk
Export arm_inc = $ arm_root/build/platforms/Android-5/arch-arm/usr/include/
Export arm_lib = $ arm_root/build/platforms/Android-5/arch-arm/usr/lib/
Export arm_tool = $ arm_root/build/prebuilt/linux-x86/arm-eabi-4.4.0
Export arm_libo = $ arm_tool/lib/GCC/ARM-Eabi/4.4.0
Export Path = $ arm_tool/bin: $ path
Export arm_pre = arm-Eabi
Export lib_inc =/sdcard/arm_and/include
Export lib_lib =/sdcard/arm_and/lib

./Configure/
-- Target-OS = Linux/
-- Arch = armv5te/
-- Enable-Cross-compile/
-- Cc = $ arm_tool/bin/$ {arm_pre}-gcc/
-- Cross-Prefix = $ arm_tool/bin/$ {arm_pre }-/
-- Extra-cflags = "-FPIC-dandroid-FPIC-mthumb-interwork-ffunction-sections-funwind-tables-fstack-protector-fno-short-enums-d1_arm_arch_5 _-Threshold __-
Export _-d1_arm_arch_5te _-wno-psabi-March = armv5te-mtune = XScale-msoft-float-mthumb-OS-fomit-frame-pointer-fno-strict-aliasing- finline-Limit = 64-d
Android-wa, -- noexecstack-MMD-MP "/
-- Enable-static/
-- Disable-shared -- enable-libx264 -- enable-GPL/
-- Disable-ASM -- disable-yasm/
-- Prefix =/sdcard/arm_and/
-- Disable-amd3dnow -- disable-amd3dnowext -- disable-MMX -- disable-mmx2 -- disable-SSE -- disable-ssse3/
-- Extra-cflags = "-I $ arm_inc-STD = gnu99-I $ lib_inc "/
-- Extra-libs = "-LC-lm-LDL-lgcc-LZ-lx264 "/
-- Extra-ldflags = "-L $ lib_lib-wl,-rpath-link = $ lib_lib-nostdlib-bdynamic-wl, -- no-undefined-wl,-Z, noexecstack-wl,-Z, nocopyreloc-wl,-soname,/system/lib/libz. so
-Wl,-rpath-link = $ arm_lib,-dynamic-linker =/system/bin/linker-L $ arm_lib-nostdlib $ arm_lib/crtbegin_dynamic.o $ arm_lib/crtend_android.o"

4) You will get 4 files ..

-FFMPEG, ffprobe, ffserver, x264.
-Because we didn't ready SDL, we can't get ffplay.

5) how to use it?

-Because Android support a few codecs, it's a little bit difficult to play some common files.
So, FFMPEG/ffserver will run on Android device to change stream format.

-For this one, Howard Chu, FFMPEG team member already check it. https://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2010-May/088706.html

-Screen capture to use ffserver/FFMPEG to play h264/AAc/mpeg ps stream file on Android emulator.

 

-Unfortunately, the x264 doesn't work well on Android, need to check x264/FFMPEG.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.