Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFmpegKit failed to start on brand: OnePlus #392

Closed
neilyoung opened this issue Apr 11, 2022 · 17 comments
Closed

FFmpegKit failed to start on brand: OnePlus #392

neilyoung opened this issue Apr 11, 2022 · 17 comments
Labels
duplicate This issue or pull request already exists no-issue-activity

Comments

@neilyoung
Copy link

Description
First and only order:

String version = FFmpegKitConfig.getVersion();

Expected behavior
Should print the version

Current behavior
Crashed the app

To Reproduce

Screenshots
If applicable, add screenshots to help explain your problem.

Logs

04-11 12:12:58.547  9247  9247 I ffmpeg-kit: Loading ffmpeg-kit.
04-11 12:12:58.551  1194  9583 E MtkOmxVdecExV4L2: [0xd7727280] [ERROR] SetGrallocExtraQPSum graphicBufHandle 0 fd 181 invalid !!
04-11 12:12:58.551  1194  9584 I MtkOmxVdecExV4L2: [0xd7727280] ConvertFrame create job: 43429, fence: 186, LINE: 9946
04-11 12:12:58.552  9247  9247 D AndroidRuntime: Shutting down VM
04-11 12:12:58.555  9247  9247 E AndroidRuntime: FATAL EXCEPTION: main
04-11 12:12:58.555  9247  9247 E AndroidRuntime: Process: com.dji.videostreamdecodingsample, PID: 9247
04-11 12:12:58.555  9247  9247 E AndroidRuntime: java.lang.IllegalStateException: Could not execute method for android:onClick
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.view.View$DeclaredOnClickListener.onClick(View.java:6349)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.view.View.performClick(View.java:7575)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.view.View.performClickInternal(View.java:7531)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.view.View.access$3900(View.java:842)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.view.View$PerformClick.run(View.java:28872)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:938)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:265)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:8360)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at android.view.View$DeclaredOnClickListener.onClick(View.java:6344)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	... 11 more
04-11 12:12:58.555  9247  9247 E AndroidRuntime: Caused by: java.lang.Error: FFmpegKit failed to start on brand: OnePlus, model: DN2103, device: OP515BL1, api level: 30, abis: arm64-v8a armeabi-v7a armeabi, 32bit abis: armeabi-v7a armeabi, 64bit abis: arm64-v8a.
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.arthenica.ffmpegkit.NativeLoader.loadLibrary(NativeLoader.java:50)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.arthenica.ffmpegkit.NativeLoader.loadFFmpegKit(NativeLoader.java:189)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.arthenica.ffmpegkit.FFmpegKitConfig.<clinit>(FFmpegKitConfig.java:145)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.arthenica.ffmpegkit.FFmpegKitConfig.getVersion(FFmpegKitConfig.java:572)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.decades.djistreamerlib.StreamerLib.startRTMP(StreamerLib.java:451)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.dji.videostreamdecodingsample.MainActivity.onClick(MainActivity.java:206)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	... 13 more
04-11 12:12:58.555  9247  9247 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "__emutls_get_address" referenced by "/data/app/~~56c3wYhS1sUR92H0nVd9KQ==/com.dji.videostreamdecodingsample-u-Gt76MeygKCTnLBOntuMA==/lib/arm64/libffmpegkit.so"...
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at java.lang.System.loadLibrary(System.java:1664)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	at com.arthenica.ffmpegkit.NativeLoader.loadLibrary(NativeLoader.java:48)
04-11 12:12:58.555  9247  9247 E AndroidRuntime: 	... 18 more

Environment

  • Platform: Android
  • Architecture:
    adb shell getprop ro.product.cpu.abi says: arm64-v8a

Other
Add any other context about the problem here.

I just included this dependency to my project:

implementation 'com.arthenica:ffmpeg-kit-full:4.5.1'

Need to say, that something similar already worked with your abandoned predecessor project.

@tanersener tanersener added the duplicate This issue or pull request already exists label Apr 11, 2022
@tanersener
Copy link
Collaborator

See #292.

@neilyoung
Copy link
Author

Thanks for the quick answer, but I was not compiling ffmpeg-kit. My NDK is Library/Android/sdk/ndk/21.4.7075529. I'm having admittedly native parts in my app, but not related to ffmpeg-kit

What would be your suggestion? I quickly returned to this implementation org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0 and there is works.

@tanersener
Copy link
Collaborator

#292 affects ffmpeg-kit v4.5.1. We published a patch for it, as the issue says. It is ffmpeg-kit v4.5.1-1. I suggest using that version in your app.

@neilyoung
Copy link
Author

Ah thanks. Got it

@neilyoung
Copy link
Author

OK, no crash, but pipes not working either. Running FFmpegKit.executeAsync on a separate thread. The pipe doesn't start, instead the session callback calls "apply" and terminates it.

Same works good with older lib

@tanersener
Copy link
Collaborator

I have no idea what you mean by pipes not starting. See #215 if you need help please.

I also suggest having a look at the Migration Guide we have for mobile-ffmpeg. It lists API differences between these two projects.

@neilyoung
Copy link
Author

No, how could you? I was not specific enough:

Well, this code works based on the "old" abandoned lib:

    implementation 'com.arthenica:mobile-ffmpeg-min-gpl:4.4'
    implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
  new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                    
                        String ffmpegCommand = "a-valid-command";

                        long result = FFmpeg.executeAsync(ffmpegCommand, new ExecuteCallback() {
                            @Override
                            public void apply(long executionId, int returnCode) {

                              }
                        });

                    }
                    catch (Exception e) {
                      
                    }
  }).start();

The FFMPEG pipe starts and I'm able to write to it from Android.

This other way does not work yet, since the callback immediately fires after start. Same "ffmpegCommand".

    implementation 'com.arthenica:ffmpeg-kit-full:4.5.1-1'

I just replaced the pipeline generation and the start of the pipeline, but the callback is immediately called back and the pipeline doesn't start:

                        FFmpegSession session = FFmpegKit.executeAsync(ffmpegCommand, new FFmpegSessionCompleteCallback() {
                            @Override
                            public void apply(FFmpegSession session) {
                                
                            }
                        });

@tanersener
Copy link
Collaborator

If FFmpegSessionCompleteCallback is called then it should be possible to understand what the problem is by looking at the session object provided. It includes the return code, output, etc. Have you looked at them?

@neilyoung
Copy link
Author

It just says "completed", but it is a "pipe" pipeline, it shouldn't complete on it's own...

image

@tanersener
Copy link
Collaborator

Please go to the README we have for the Android and see the examples we have under the Android API section.

Item 3 shows how to get the details of a session. Use API methods explained there to find at least the returnCode and output. Without those two it is impossible to make a comment.

@neilyoung
Copy link
Author

OK, this change showed me, that libx264 was missing. I recalled from the old project, that I had to add

implementation 'com.arthenica:mobile-ffmpeg-min-gpl:4.4'

Did that and found myself confronted with really a lot of "this and that library are already available...". After having added the the 10th lib to the "pickFirst" list, I generously decided to

pickFirst 'lib/*/*.so'

That at least compiled. At runtime now this instruction, which formerly returned a valid pipe string, returns NULL

ffmpegPipe = FFmpegKitConfig.registerNewFFmpegPipe(context);

and the entire app crashed again with

04-12 10:51:00.567 12161 12161 E AndroidRuntime: Caused by: java.lang.Error: FFmpegKit failed to start on brand: OnePlus, model: DN2103, device: OP515BL1, api level: 30, abis: arm64-v8a armeabi-v7a armeabi, 32bit abis: armeabi-v7a armeabi, 64bit abis: arm64-v8a.
04-12 10:56:11.972 14757 14757 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "av_log_default_callback" referenced by "/data/app/~~hdWNg0yzzf0Lo9FOD7yDqg==/com.dji.videostreamdecodingsample-4poFn17MwSI-z0Zh0aDXGg==/lib/arm64/libffmpegkit.so"...
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at java.lang.System.loadLibrary(System.java:1664)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at com.arthenica.ffmpegkit.NativeLoader.loadLibrary(NativeLoader.java:48)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	... 18 more

@tanersener
Copy link
Collaborator

You have a pickFirst 'lib/*/*.so' in your build.gradle. Most probably it picks up .so files that are different from what ffmpeg-kit expects.

@neilyoung
Copy link
Author

OK, I was wrong. Not 10, but 25 collisions. Even if I mention it explicitly - ffmpegPipe is null.

        pickFirst 'lib/x86/libavcodec.so'
        pickFirst 'lib/x86_64/libswscale.so'
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libavformat.so'
        pickFirst 'lib/arm64-v8a/libavcodec.so'
        pickFirst 'lib/x86/libavformat.so'
        pickFirst 'lib/arm64-v8a/libavutil.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/x86_64/libavdevice.so'
        pickFirst 'lib/arm64-v8a/libavfilter.so'
        pickFirst 'lib/x86/libavdevice.so'
        pickFirst 'lib/x86/libavutil.so'
        pickFirst 'lib/arm64-v8a/libswresample.so'
        pickFirst 'lib/x86/libswscale.so'
        pickFirst 'lib/x86_64/libavutil.so'
        pickFirst 'lib/x86_64/libavcodec.so'
        pickFirst 'lib/x86/libavfilter.so'
        pickFirst 'lib/x86/libswresample.so'
        pickFirst 'lib/arm64-v8a/libavformat.so'
        pickFirst 'lib/x86_64/libswresample.so'
        pickFirst 'lib/arm64-v8a/libswscale.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
        pickFirst 'lib/x86_64/libavfilter.so'
        pickFirst 'lib/arm64-v8a/libavdevice.so'

Wondering, why this didn't happen with

implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'

Never mind. Returning to this solution. That worked for me.

Thanks

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@balloman
Copy link

OK, this change showed me, that libx264 was missing. I recalled from the old project, that I had to add

implementation 'com.arthenica:mobile-ffmpeg-min-gpl:4.4'

Did that and found myself confronted with really a lot of "this and that library are already available...". After having added the the 10th lib to the "pickFirst" list, I generously decided to

pickFirst 'lib/*/*.so'

That at least compiled. At runtime now this instruction, which formerly returned a valid pipe string, returns NULL

ffmpegPipe = FFmpegKitConfig.registerNewFFmpegPipe(context);

and the entire app crashed again with

04-12 10:51:00.567 12161 12161 E AndroidRuntime: Caused by: java.lang.Error: FFmpegKit failed to start on brand: OnePlus, model: DN2103, device: OP515BL1, api level: 30, abis: arm64-v8a armeabi-v7a armeabi, 32bit abis: armeabi-v7a armeabi, 64bit abis: arm64-v8a.
04-12 10:56:11.972 14757 14757 E AndroidRuntime: Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "av_log_default_callback" referenced by "/data/app/~~hdWNg0yzzf0Lo9FOD7yDqg==/com.dji.videostreamdecodingsample-4poFn17MwSI-z0Zh0aDXGg==/lib/arm64/libffmpegkit.so"...
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at java.lang.System.loadLibrary(System.java:1664)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	at com.arthenica.ffmpegkit.NativeLoader.loadLibrary(NativeLoader.java:48)
04-12 10:56:11.972 14757 14757 E AndroidRuntime: 	... 18 more

Hi, how did you fix this specific issue? I seem to have two libraries that are trying to produce .so files and pickfirst is not working.

@neilyoung
Copy link
Author

neilyoung commented Oct 31, 2022

implementation 'com.arthenica:mobile-ffmpeg-min-gpl:4.4'
implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'

At least this is what I find in my build.gradle. Diving deeper into the code I see, that I don't use the crashing functions anymore. I'm doing it using FFmpeg.executeAsync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists no-issue-activity
Projects
None yet
Development

No branches or pull requests

3 participants