madhavanmalolan / ffmpegandroidlibrary

One line integration for FFMPEG Library in Android
MIT License
90 stars 15 forks source link

Crash when calling 'run()' #4

Closed bkatgithub closed 6 years ago

bkatgithub commented 6 years ago

Hi,

I am doing a build based on the instructions in your blog. When I run it, it crashes when calling 'run(String[])'. I added some debug statements in the run function and it seems to be in the call to 'main(argc, argv)' in ffmpeg_controller.c. Logcat has the following messages. Am I missing something in my setup?

12-01 21:45:50.306 D: killProcessQuiet, pid=10581 12-01 21:45:50.306 D: com.android.server.am.ActivityManagerService.appDiedLocked:5092 com.android.server.am.ActivityManagerService$AppDeathRecipient.binderDied:1212 android.os.BinderProxy.sendDeathNotice:559 12-01 21:45:50.306 I: Recipient 10581 12-01 21:45:50.316 W: HtcSystemUPHandler The policy is disabled. AppId: activity_history, category: launch 12-01 21:45:50.316 I: WIN DEATH: Window{2973480c u0 bk.sandbox.ndktest/bk.sandbox.ndktest.MainActivity} 12-01 21:45:50.396 D: Receive mPhoneStateListener 12-01 21:45:50.396 D: Receive mPhoneStateListener, getGsmSignalStrength22 12-01 21:45:50.396 D: onSignalStrengthsChanged 12-01 21:45:50.396 D: processRegCheck. needtoregister: true, mRegistered: false, type: 1, mRtype: 0, Mobile: DISCONNECTED, Wifi: CONNECTED_ROVE_IN, pauseims: DEFAULT 12-01 21:45:50.396 D: doIPServiceUnregistration: Abort: mAtomicDereg.get()=false 12-01 21:45:50.396 D: doIPServiceUnregistration: Abort: mRegistered=false 12-01 21:45:50.396 D: doIPServiceUnregistration: Abort: mAtomicReg.get()=false 12-01 21:45:50.396 D: destroyService. false 12-01 21:45:50.396 D: SignalStrength: 5 12-01 21:45:50.396 D: level=5/5 12-01 21:45:50.426 I: Process bk.sandbox.ndktest (pid 10581) has died 12-01 21:45:50.426 W: Force removing ActivityRecord{1ae37c4f u0 bk.sandbox.ndktest/.MainActivity t27280}: app died, no saved state

madhavanmalolan commented 6 years ago

Can you share the command you are trying to execute?

On 02-Dec-2017 8:21 AM, "bkatgithub" notifications@github.com wrote:

Hi,

I am doing a build based on the instructions in your blog https://medium.com/madhavanmalolan/ffmpeg-for-android-b307f2613c82. When I run it, it crashes when calling 'run(String[])'. I added some debug statements in the run function and it seems to be in the call to 'main(argc, argv)' in ffmpeg_controller.c. Logcat has the following messages. Am I missing something in my setup?

12-01 21:45:50.306 D: killProcessQuiet, pid=10581 12-01 21:45:50.306 D: com.android.server.am.ActivityManagerService.appDiedLocked:5092 com.android.server.am.ActivityManagerService$AppDeathRecipient.binderDied:1212 android.os.BinderProxy.sendDeathNotice:559 12-01 21:45:50.306 I: Recipient 10581 12-01 21:45:50.316 W: HtcSystemUPHandler The policy is disabled. AppId: activity_history, category: launch 12-01 21:45:50.316 I: WIN DEATH: Window{2973480c u0 bk.sandbox.ndktest/bk.sandbox.ndktest.MainActivity} 12-01 21:45:50.396 D: Receive mPhoneStateListener 12-01 21:45:50.396 D: Receive mPhoneStateListener, getGsmSignalStrength22 12-01 21:45:50.396 D: onSignalStrengthsChanged 12-01 21:45:50.396 D: processRegCheck. needtoregister: true, mRegistered: false, type: 1, mRtype: 0, Mobile: DISCONNECTED, Wifi: CONNECTED_ROVE_IN, pauseims: DEFAULT 12-01 21:45:50.396 D: doIPServiceUnregistration: Abort: mAtomicDereg.get()=false 12-01 21:45:50.396 D: doIPServiceUnregistration: Abort: mRegistered=false 12-01 21:45:50.396 D: doIPServiceUnregistration: Abort: mAtomicReg.get()=false 12-01 21:45:50.396 D: destroyService. false 12-01 21:45:50.396 D: SignalStrength: 5 12-01 21:45:50.396 D: level=5/5 12-01 21:45:50.426 I: Process bk.sandbox.ndktest (pid 10581) has died 12-01 21:45:50.426 W: Force removing ActivityRecord{1ae37c4f u0 bk.sandbox.ndktest/.MainActivity t27280}: app died, no saved state

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/madhavanmalolan/ffmpegandroidlibrary/issues/4, or mute the thread https://github.com/notifications/unsubscribe-auth/ACA3Fcw3EJOAjLwLoCCLSLe7yeLDQftgks5s8LsygaJpZM4QzJE3 .

bkatgithub commented 6 years ago

Thanks.

I added sanityCheck function in ffmpeg_controller.c to return a string to make sure calls are getting to the jni function. And that call works - and I get the return value back in java. The call to run() causes the crash.

` String filesDir = "/storage/sdcard0/Download/"; Controller c = new Controller();

// sanity check to make sure calls are reaching jni funciton. // This works. String sanity = c.sanityCheck(); System.err.println("RESPONSE FROM SANITYCHECK: " + sanity);

// call to run() causes a crash c.run(new String[] { "-y",
"-i", filesDir + "in.mp4", "-vcodec", "copy", "-an",
filesDir + "out.mp4" });

`

madhavanmalolan commented 6 years ago

Do you have write access on the directory? Do you have external write permissions?

Also please use "Controller.getInstance()" instead of "new Controller()". Controller is a singleton class. Using "new Controller" doesnot load the FFMPEG libs.

bkatgithub commented 6 years ago

Thanks Madhavan! My external write permission was not enabled. Setting that and changing how Controller is instantiated has helped me get past that issue. I am able to work with ffmpeg now.