简体   繁体   English

在ubuntu中使用NDK为Android构建ffmpeg时出错

[英]Error on building ffmpeg for android using NDK in ubuntu


An ffmpeg android for android 2.3+ which allows me to decompress/add watermark/recompress a video file. ffmpeg android,适用于Android 2.3+,可让我解压缩/添加水印/重新压缩视频文件。 I need to have it working on all current CPUs. 我需要让它在所有当前CPU上都能正常工作。

What I did so far 我到目前为止所做的

I looked in a lot of sources for guidance. 我在很多资源中寻找指导。 Most of the articles are obsolete or simply not work. 大多数文章已过时或根本不起作用。 Not to mention the whole struggle I went to from installing ubuntu on virtualBox, an OS which I never seen before. 更不用说我从在VirtualBox上安装ubuntu到整个过程,这是我从未见过的操作系统。 The whole java/sdk/ndk install was pretty easy but I had hard times in setting the PATH variables and most importantly WHERE to set them. 整个java / sdk / ndk安装非常简单,但是我很难设置PATH变量,最重要的是在哪里设置它们。

So, here is my structure: The default folder path is /home/alin in which I have 所以,这是我的结构:默认文件夹路径是/home/alin 在此处输入图片说明

The PATH is set in etc/profile and I can confirm that it works. PATH是在etc/profile设置的,我可以确认它是否有效。 I know that it works because running java -version or ndk-build run just fine 我知道这行得通,因为运行java -versionndk-build运行得很好

> ANDROID_SDK=/home/alin/android/sdk ANDROID_NDK=/home/alin/android/ndk
> JAVA_HOME=/usr/local/java/jdk1.8.0_20
> PATH=$PATH:$HOME/bin:$JAVA_HOME/bin:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools:$ANDROID_NDK
> export JAVA_HOME export ANDROID_SDK export ANDROID_NDK export PATH

I have downloaded the latest sources from ffmpeg.org and saved it in ndk/sources folder, in sources I have created an android_build.sh file as from ( http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/ ) 我已经从ffmpeg.org下载了最新的资源,并将其保存在ndk/sources文件夹中。在我创建的android_build.sh文件中,该sources来自( http://www.roman10.net/how-to-build-ffmpeg- with-ndk-r9 /

在此处输入图片说明

#!/bin/bash

NDK=/home/alin/android/ndk
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-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)/android/$CPU 

ADDI_CFLAGS="-marm"

build_one

When running the .sh file I get this: 运行.sh文件时,我得到以下信息: 在此处输入图片说明

Trying different build.sh sometimes I got different errors... so I have no idea what to do next. 尝试使用不同的build.sh有时会遇到不同的错误...所以我不知道下一步该怎么做。

Please guide me to: 请指导我:

  • be able to build ffmpeg 能够建立ffmpeg
  • make it compatible with as many devices as possible. 使它与尽可能多的设备兼容。

Thank you. 谢谢。

I know, its too late.. but it may help somebody who come across this problem: 我知道,为时已晚..但它可能会帮助遇到此问题的人:

Just put that build_android.sh file inside source/ffmpeg folder . 只需将build_android.sh文件放入source / ffmpeg文件夹中即可

I have compiled FFMPEG from 2 different different sources here https://github.com/android-native-libraries 我在这里从2个不同的来源编译了FFMPEG https://github.com/android-native-libraries

please feel free to use the library files 请随时使用库文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM