bravobit / FFmpeg-Android

FFMpeg/FFprobe compiled for Android
https://bravobit.nl/
MIT License
741 stars 176 forks source link

Well, when I try to execute the ffmpeg it tells me the following error, it could help me. #2

Closed orlando9006 closed 6 years ago

orlando9006 commented 6 years ago

FFmpeg: Exception while trying to run: [/data/app/com.example.trabajo.democameradraw-2/lib/arm/ffmpeg.so, -version] java.io.IOException: Error running exec(). Command: [/data/app/com.example.trabajo.democameradraw-2/lib/arm/ffmpeg.so, -version] Working Directory: null Environment: null I already gave him the permissions in the manifiest of reading and writing <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.example.trabajo.democameradraw">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

cuando se inicializa el ffmpeg es obligatorio hacerlo en la activity principal. por que necesito usarlo en otra activity? protected void onCreate(Bundle savedInstanceState) { if (FFmpeg.getInstance(this).isSupported()) { ffmpeg= FFmpeg.getInstance(this); // ffmpeg is supported } else { Log.d("Ffmpeg","Este dispositivo no soporta Ffmpeg"); // ffmpeg is not supported }

execFFmpegBinary(new String[]{"-version"}, 0);

private void execFFmpegBinary(final String[] command, final int type) { if (ffmpeg == null) { Log.d("Tag", "ffmpeg : null"); ffmpeg = FFmpeg.getInstance(X00000011111.this); } try { ffmpeg.getInstance(this).execute(command, new ExecuteBinaryResponseHandler() { @Override public void onFailure(String s) { Log.d("TAG", "FAILED with output : " + s); runOnUiThread( new Runnable() { @Override public void run() { new MaterialDialog.Builder(X00000011111.this) .title(R.string.Information)

            }

            @Override
            public void onSuccess(String s) {
                Log.d("TaG", "SUCCESS with output :" + s);

            }
Brianvdb commented 6 years ago

Could you please post the full error stacktrace?

Do you also have runtime permission for reading and writing files?

Also please let us know:

orlando9006 commented 6 years ago

when I ask if (FFmpeg.getInstance(X00000011111.this.getApplicationContext()).isSupported()) { ffmpeg= FFmpeg.getInstance(X00000011111.this.getApplicationContext()); // ffmpeg is supported } else { Log.d("Ffmpeg","Este dispositivo no soporta Ffmpeg"); // ffmpeg is not supported } answer me D/FFmpeg: Build.CPU_ABI : armeabi-v7a D/Ffmpeg: ffmpeg is not supported

Android 6.0.1 LG k4(2017)

orlando9006 commented 6 years ago

the error full is E/FFmpeg: Exception while trying to run: [/data/app/com.example.trabajo.democameradraw-2/lib/arm/ffmpeg.so, -version] java.io.IOException: Error running exec(). Command: [/data/app/com.example.trabajo.democameradraw-2/lib/arm/ffmpeg.so, -version] Working Directory: null Environment: null, thanks

Brianvdb commented 6 years ago

Thanks. Could you try with the new version (1.0.4) I just uploaded:

dependencies {
    implementation 'nl.bravobit:android-ffmpeg:1.0.4'
}

Let me know if it works, if not please paste all the logging here. I added some more logging.

orlando9006 commented 6 years ago

Excuse me for bothering you again, the problem is when I run (FFmpeg.getInstance (this) .isSupported ()) { I returned E / FFmpeg: file does not exist, if you could guide me, thanks

Brianvdb commented 6 years ago

Could you post your gradle build file? And do you have the same issue on the emulator?

orlando9006 commented 6 years ago

apply plugin: 'com.android.application'

android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.example.trabajo.democameradraw" minSdkVersion 17 targetSdkVersion 25 versionCode 1 versionName "1.0"

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
repositories {
    jcenter()
    mavenCentral()

    maven { url "https://dl.bintray.com/drummer-aidan/maven" }
    maven { url 'https://jitpack.io' }
}
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:design:25.3.1'
    compile 'com.afollestad:material-camera:0.4.4'
    compile 'com.zhihu.android:matisse:0.4.3'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'gun0912.ted:tedpermission:1.0.2'
    compile 'id.zelory:compressor:2.1.0'
    compile 'com.github.tamir7.contacts:contacts:1.1.7'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.iceteck.silicompressorr:silicompressor:2.1'
    compile 'nl.bravobit:android-ffmpeg:1.0.4'
    compile 'com.wang.avi:library:2.1.3'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8'
   // compile 'com.madhavanmalolan.android:ffmpegandroidlibrary:0.0.4'
    //compile 'com.writingminds:FFmpegAndroid:0.3.2'
}

}

yes with the emulator too, this is the answer D/FFmpeg: Build.CPU_ABI : x86 12-13 11:09:38.748 2993-2993/com.example.trabajo.democameradraw E/FFmpeg: file does not exist I am developing the app in android studio on windows, that could be the cause of the error?

orlando9006 commented 6 years ago

I was using writingminds: FFmpegAndroid: 0.3.2 and it worked fine, what happens is that I need to convert a gif to webm, and for that you need the libcpx and ffmpegAndroid codec library: 0.3.2 does not have that library enabled and it gives me error when I try to execute this command -i your_gif.gif -c: v libvpx -crf 12 -b: v 500K output.webm, does not recognize libvpx, so I asked him if he knew how to enable that library in that application.

orlando9006 commented 6 years ago

I was debugging the app and the problem seems to be this, when he looks for the type of micro that the one of my phone is to armeabi-v7a, he tries to look in File ffmpeg = FileUtils.getFFmpeg (this.context.provide ()) these path data / app / com.example.trabajo.democamaradraw-1 / lib / arm / ffmpeg.so, but the armno folder exists inside lib which exists is armeabi-v7a / ffmpeg.so, regards

Brianvdb commented 6 years ago

Thanks for that. This issue is now fixed in this version: compile 'nl.bravobit:android-ffmpeg:1.0.5'

Let me know if it works for you!

orlando9006 commented 6 years ago

good, with its latest update the app compiles without any problem, I was researching and to be able to convert to webm with ffmpeg it is necessary to have enabled the libraries, libvpxu for the video codec and libvorbis for the audio, you believe if it is not annoying, that I can enable these two libraries, carefully orlando9006, very good project.

Brianvdb commented 6 years ago

Fixed in ff465abb14fee1c417233f6dacf715bca59db654

@orlando9006 Please create a new issue if you want libvpxu added.

orlando9006 commented 6 years ago

ok,thanks