Mac下面编译Android FFmpeg3.2.4
来源:互联网 发布:nginx 1.12.0 配置 编辑:程序博客网 时间:2024/05/17 23:11
需要搞直播,打算使用ffmpeg进行推流,于是在Mac下进行了编译FFMmpeg。
1、下载ffmpeg源码,我下载的是ffmpeg-3.2.4;
2、配置好build_android.sh编译安卓脚本,脚本如下,
cd /Users/xxxx/Documents/DevTool/ffmpeg-3.2.4NDK=/Users/xxxx/Documents/DevTool/AndroidSDK/android-sdk-macosx/ndk-bundleSYSROOT=$NDK/platforms/android-9/arch-arm/TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64function build_one{./configure \ --prefix=$PREFIX \ --enable-shared \ --disable-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=linux \ --arch=arm \ --enable-cross-compile \ --sysroot=$SYSROOT \ --extra-cflags="-Os -fpic $ADDI_CFLAGS" \ --extra-ldflags="$ADDI_LDFLAGS" \ $ADDITIONAL_CONFIGURE_FLAG make clean make make install}CPU=armPREFIX=$(pwd)/android/$CPU ADDI_CFLAGS="-marm"build_one
我这里选择的CPU的架构是arm,有其他需要可自行添加;
3、为脚本赋予可执行权限;
chmod -R 775 build_android.sh
4、执行脚本,经过一番编译等待之后,我这边编译了几遍大约在十五分钟编译完成;
5、打开AS,我的测试版本是AS 2.3版本,所以使用的是CMakelist.txt来进行编译的,把刚才编译好的源码复制到项目的libs下面;
6、编译CMakelist.txt文件,完整的如下;
//For more information about using CMake with Android Studio, read the//documentation: https://d.android.com/studio/projects/add-native-code.html//Sets the minimum version of CMake required to build the native library.cmake_minimum_required(VERSION 3.4.1)find_library( # Sets the name of the path variable. log-lib # Specifies the name of the NDK library that # you want CMake to locate. log )set(distribution_DIR ${CMAKE_SOURCE_DIR}/../../../../libs)add_library( avutil-55 SHARED IMPORTED )set_target_properties( avutil-55 PROPERTIES IMPORTED_LOCATION ../../../../libs/arm/libavutil-55.so )add_library( swresample-2 SHARED IMPORTED )set_target_properties( swresample-2 PROPERTIES IMPORTED_LOCATION ../../../../libs/arm/libswresample-2.so )add_library( avcodec-57 SHARED IMPORTED )set_target_properties( avcodec-57 PROPERTIES IMPORTED_LOCATION ../../../../libs/arm/libavcodec-57.so )add_library( avfilter-6 SHARED IMPORTED)set_target_properties( avfilter-6 PROPERTIES IMPORTED_LOCATION ../../../../libs/arm/libavfilter-6.so )add_library( swscale-4 SHARED IMPORTED)set_target_properties( swscale-4 PROPERTIES IMPORTED_LOCATION ../../../../libs/arm/libswscale-4.so )add_library( avformat-57 SHARED IMPORTED)set_target_properties( avformat-57 PROPERTIES IMPORTED_LOCATION ../../../../libs/arm/libavformat-57.so )set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")add_library( native-lib SHARED src/main/cpp/native-lib.cpp )include_directories(libs/include)//target_include_directories(native-lib PRIVATE libs/include)target_link_libraries(native-lib ${avutil-55} ${swresample-2} ${avcodec-57} ${avfilter-6} ${swscale-4} ${avformat-57} ${log-lib} )
7、编译运行,成功,明天就可以开撸直播了,哈哈,附上下载链接。
阅读全文
0 0
- Mac下面编译Android FFmpeg3.2.4
- VS2015编译FFMpeg3.2.4
- Ubuntu编译Android FFmpeg3.24
- Ubuntu环境编译FFmpeg3.2.2-for-android
- FFMpeg3.3.3编译Android库文件
- mac 安装cordova,编译android下面的app
- FFmpeg3.2最新版编译Mediacodec For Android脚本
- VS2015编译FFmpeg3.3.1源码
- VS2015编译FFmpeg3.3.1源码
- ffmpeg3.2.4安装
- ffmpeg3
- ffmpeg3.3 编译 android 系统版本 32位 和64 位 动态库
- FFmpeg3.1.3移植到Android
- CentOS7下编译安装ffmpeg3.1.5
- 使用VisualStudio2013编译ffmpeg3.1全过程
- win10 msys2 vs2015 ffmpeg3.2.2 编译
- win7 msys2 vs2015 ffmpeg3.2.2 编译
- ubuntu 下ffmpeg3.3的编译
- 二 丶语法基础
- UVA
- 梯度下降算法
- 笔记12--js基础知识
- NYOJ 喷水装置(二)
- Mac下面编译Android FFmpeg3.2.4
- fork函数的相关知识和使用
- websocket C# server
- COM接口函数参数定义如果缺省[in][out]则默认为[in]
- 大数运算
- orcale数据库-----------1
- jar文件解析,加载,卸载的简单实现
- 20170726(总结)
- 19+ JavaScript 常用的简写技巧