2

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.

Vijay
  • 3,152
  • 3
  • 24
  • 33

2 Answers2

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.

Mayank Sugandhi
  • 397
  • 1
  • 7
  • 22
Ravi Vaghela
  • 3,420
  • 2
  • 23
  • 51
  • Hi.. Thanks for the suggestion. But now I am using this solutions only,. But I can not do the compression in background. That mean I want to take the video and compress in background. But this solution can only compress the video in fore ground. That mean it depends upon the UI. We have to inject the UI information. So that user need to wait till compression. So that only I decided to move to this. If I compile the ffmpeg lib mean I can move the compile process in background. Please let me know any other idea. – Vijay Apr 06 '16 at 06:39
  • you can work with onProgess method in, and if video in big size that time you have to done in background, because android can't handle large amount of process. – Ravi Vaghela Apr 06 '16 at 06:42
  • @Ravi :- ultimate .. very very thank full to you., i have voted you for a right answer.. Thank you but you have to change you library in answer i think you forget to editing, – Mayank Sugandhi May 03 '16 at 05:59
2

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

  • Now this error is gone. But Now I am facing another issue in this same command. `Could not find toolchain: /home/vijay/Android/Sdk/ndk-bundle/toolchains/x86-4.8/prebuilt/linux-x86_64 Please use --toolchain= with the name of a toolchain supported by the source NDK.` – Vijay Apr 06 '16 at 06:58
  • Working perfectly without ```--system``` – Florida Apr 15 '16 at 04:24