FFMPEG error showing while complile for android

2020-04-17 07:13发布

问题:

I am trying to add ffmpeg into my android project. I am using ubuntu 14.04 OS.

I am following this link. Link

But I am getting error while executing this line.

$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --toolchain=x86-4.8 --arch=x86 --system=linux-x86_64 --platform=android-14 --install-dir=/tmp/vplayer

I am getting this following error.

HOST_OS=linux
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
HOST_NUM_CPUS=1
BUILD_NUM_CPUS=2
ERROR: Unknown option '--system'. See --help for usage.

Please help me how to solve this issue and add ffmpeg into my project.

回答1:

It seems --system is not required as a command line parameter.

try this -

$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --help

It will show you the actual use of --system

Or you can try to run the command without giving the system details, here is what you can execute -

$ANDROID_NDK/build/tools/make-standalone-toolchain.sh --toolchain=x86-4.8 --arch=x86 --platform=android-14 --install-dir=/tmp/vplayer



回答2:

You can use FFmpeg android with implement FFmpeg Android Java library in your project. see below

use gradle

   compile 'com.writingminds:FFmpegAndroid:0.3.2' 

and implement code in your project that are below.

Load Binary

You must load binary code.

 FFmpeg ffmpeg = FFmpeg.getInstance(context);
try {
 ffmpeg.loadBinary(new LoadBinaryResponseHandler() {

@Override
public void onStart() {}

@Override
public void onFailure() {}

@Override
public void onSuccess() {}

@Override
public void onFinish() {}
});
} catch (FFmpegNotSupportedException e) {
 // Handle if FFmpeg is not supported by device
}

Execute Binary

Here you have pass ffmpeg command for your task.

  FFmpeg ffmpeg = FFmpeg.getInstance(context);
  try {
  // to execute "ffmpeg -version" command you just need to pass "-version"
  ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {

@Override
public void onStart() {}

@Override
public void onProgress(String message) {}

@Override
public void onFailure(String message) {}

@Override
public void onSuccess(String message) {}

@Override
public void onFinish() {}
 });
} catch (FFmpegCommandAlreadyRunningException e) {
 // Handle if FFmpeg is already running
 }

More information reffer this link.