osx build ffmpeg for android

时间:2018-04-04 10:38:13

标签: android macos build ffmpeg

我想为android平台构建ffmpeg源代码。

我已经按照一些教程,但构建失败了。

这是我的配置

  1. build_android.sh文件

    #!/bin/bash
    NDK=/Users/***/Library/Android/ndk/android-ndk-r14b
    SYSROOT=$NDK/platforms/android-19/arch-arm/
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
    function 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=arm
    PREFIX=$(pwd)/androidtest/$CPU
    ADDI_CFLAGS="-marm"
    build_one
    
  2. 配置文件

    我还更改了configure文件

  3. 更改

    SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
    LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
    SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
    SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
    

    SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'  
    LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'  
    SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'  
    SLIB_INSTALL_LINKS='$(SLIBNAME)'
    
    1. 控制台输出
    2. ...
      INSTALL   doc/examples/demuxing_decoding.c
      INSTALL   doc/examples/encode_audio.c
      INSTALL   doc/examples/encode_video.c
      INSTALL   doc/examples/extract_mvs.c
      INSTALL   doc/examples/filter_audio.c
      INSTALL   doc/examples/filtering_audio.c
      INSTALL   doc/examples/filtering_video.c
      INSTALL   doc/examples/http_multiclient.c
      INSTALL   doc/examples/hw_decode.c
      INSTALL   doc/examples/metadata.c
      INSTALL   doc/examples/muxing.c
      INSTALL   doc/examples/qsvdec.c
      INSTALL   doc/examples/remuxing.c
      INSTALL   doc/examples/resampling_audio.c
      INSTALL   doc/examples/scaling_video.c
      INSTALL   doc/examples/transcode_aac.c
      INSTALL   doc/examples/transcoding.c
      INSTALL   doc/examples/vaapi_encode.c
      INSTALL   doc/examples/vaapi_transcode.c
      INSTALL   doc/examples/README
      INSTALL   doc/examples/Makefile
      INSTALL   libavdevice/libavdevice.a
      /bin/sh: ranlib/usr/local/lib/libavdevice.a: No such file or directory
      make: *** [install-libavdevice-static] Error 127
      
      1. 问题
      2. 根据控制台输出,找不到libavdevice.a

        enter image description here

        但我可以在Finder中找到它

        如何解决/bin/sh: ranlib/usr/local/lib/libavdevice.a: No such file or directory错误?

        我搜索了make: *** [install-libavdevice-static] Error 127的一些解析器但不适合我。

2 个答案:

答案 0 :(得分:1)

我也遇到了同样的问题。虽然它已经解决了,但我仍然不知道具体原因。 使用在Android Studio和ffmpeg 4.0中下载的NDK时遇到此错误。解决方案是用3.3.7版本替换ffmepg并重新下载rd版本的ndk而不是使用Android studio中提供的版本。希望这对你有用。 ndk下载链接

答案 1 :(得分:0)

enter image description here

查看您的配置文件以查看是否缺少空格。如果是这样,那么使 '$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"' -> '$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'

相关问题