Description
Hi. I stumbled across this library and it looks very promising.
I added this to my application:
public class App extends application {
@Override
public void onCreate() {
AndroidAudioConverter.load(this, new ILoadCallback() {
@Override
public void onSuccess() {
android.util.Log.d(TAG, "FFmpeg is supported by the device. Succesfully loaded AndroidAudioConverter library.");
}
@Override
public void onFailure(Exception error) {
// FFmpeg is not supported by device
Log.w(TAG, "FFmpeg is not supported by this device.", error);
}
});
}
}
And got the following error:
W/Application: FFmpeg is not supported by this device.
java.lang.Exception: Failed to loaded FFmpeg lib
at cafe.adriel.androidaudioconverter.AndroidAudioConverter$1.onFailure(AndroidAudioConverter.java:50)
at com.github.hiteshsondhi88.libffmpeg.FFmpegLoadLibraryAsyncTask.onPostExecute(FFmpegLoadLibraryAsyncTask.java:54)
at com.github.hiteshsondhi88.libffmpeg.FFmpegLoadLibraryAsyncTask.onPostExecute(FFmpegLoadLibraryAsyncTask.java:8)
at android.os.AsyncTask.finish(AsyncTask.java:771)
at android.os.AsyncTask.access$900(AsyncTask.java:199)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I then looked into the source code of your project and found that the load method does this:
try {
FFmpeg.getInstance(context).loadBinary(new FFmpegLoadBinaryResponseHandler() {
@Override
public void onStart() {
}
@Override
public void onSuccess() {
loaded = true;
callback.onSuccess();
}
@Override
public void onFailure() {
loaded = false;
callback.onFailure(new Exception("Failed to loaded FFmpeg lib"));
}
@Override
public void onFinish() {
}
});
} catch (Exception e){
loaded = false;
callback.onFailure(e);
}
}
So, I pasted that into my code and replaced catch (exception e) {...}
with catch(exception e) {e.printStackTrace();
.
I ran that and got the following error:
E/FFmpeg: issue in coping binary from assets to data.
java.io.FileNotFoundException: x86/ffmpeg
at android.content.res.AssetManager.nativeOpenAsset(Native Method)
at android.content.res.AssetManager.open(AssetManager.java:874)
at android.content.res.AssetManager.open(AssetManager.java:851)
at com.github.hiteshsondhi88.libffmpeg.FileUtils.copyBinaryFromAssetsToData(FileUtils.java:29)
at com.github.hiteshsondhi88.libffmpeg.FFmpegLoadLibraryAsyncTask.doInBackground(FFmpegLoadLibraryAsyncTask.java:27)
at com.github.hiteshsondhi88.libffmpeg.FFmpegLoadLibraryAsyncTask.doInBackground(FFmpegLoadLibraryAsyncTask.java:8)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
So this means that FFmpeg is not installed I guess?
I looked into the source code of the ffmpeg-android-java and found where the FFmpeg file should be located.
I ran:
System.out.println(this.getFilesDir() + File.separator + "ffmpeg");
And got as output:
I/System.out: /data/user/0/be.ksa.voetje/files/ffmpeg
I then ran
System.out.println(new File(this.getFilesDir() + File.separator + "ffmpeg").exists());
And got false, so the file does indeed not exist.
I'm unfamiliar with the FFmpeg library, so I really have no idea on what I should do now.
If you could help me with this one, that would be wonderful.
Thank you in advance.
Jonas