FFmpeg-Android: Permission denied running version command when targeting Android Q

Not sure if it’s because I am running Android Q beta, or I’m doing something wrong but I am getting the following:

2019-07-26 12:29:01.320 24329-24408/com.android.testffmpeg E/FFmpeg: Exception while trying to run: [/data/user/0/com.android.testffmpeg/files/ffmpeg, -version] java.io.IOException: Cannot run program “/data/user/0/com.android.testffmpeg/files/ffmpeg”: error=13, Permission denied at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050) at nl.bravobit.ffmpeg.ShellCommand.run(ShellCommand.java:15)

All I am doing is calling this function:

`
private fun versionFFmpeg() { FFmpeg.getInstance(TestFFmpegApplication.instance.applicationContext) .execute(arrayOf(“-version”), object : ExecuteBinaryResponseHandler() { override fun onSuccess(message: String?) { Timber.d(message) }

            override fun onProgress(message: String?) {
                Timber.d(message)
            }
        })

}

`

The only setup I have in the code is this:

implementation ‘nl.bravobit:android-ffmpeg:1.1.7’

Can anyone see what it is I am missing, or perhaps there is an issue running on Android Q?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 12
  • Comments: 40

Commits related to this issue

Most upvoted comments

Hi, I didn’t try it myself but probably you can fix it with adding

android:requestLegacyExternalStorage="true"

to application in AndroidManifest.xml

Just change targetSdkVersion 29 to 28 in build.gradle

It worked for me.

No, it still does not work

Someone has solution to run ffmpeg commands in android Q its urgent??

We’re using this library instead now, which is still maintained actively

https://github.com/tanersener/mobile-ffmpeg

Why hasn’t this been merged yet, even Android 11 is about be released, has this project been abandoned?

I have create jniLibs folder then move the lib from assets,but still not work, Is there something i miss?

It’s much more than simply renaming some folders, see https://github.com/bravobit/FFmpeg-Android/pull/130

I found solution on this issue. https://issuetracker.google.com/issues/128554619

exec() no longer works on files within the application home directory, it continues to be supported for files within the read-only /data/app directory. In particular, it should be possible to package the binaries into your application’s native libs directory and enable android:extractNativeLibs=true, and then call exec() on the /data/app artifacts. A similar approach is done with the wrap.sh functionality, documented at https://developer.android.com/ndk/guides/wrap-script#packaging_wrapsh .

It works well on my project(tested on Pixel 3a XL android Q)

Try this library I just tested it on a physical device running Android Q (android 10)

@plazar99 but when you upload app on playstore you have to upgrade your tarketsdkversion to 29 thats the major issue.

I figured out my mistake. I followed the example provided,

  1. implementation ‘com.arthenica:mobile-ffmpeg-full:4.3.1.LTS’ <=== do not use this ===> use this implementation ‘nl.bravobit:android-ffmpeg:1.1.7’

2.use this => ffmpeg.execute(ffcommand, new FFcommandExecuteResponseHandler() { dont use the one in the example provided.

This fixed everything.

I just rebuild it for sdktarget 28, no difference. I’m afraid I’m missing something fundamental here.

Any updates on this?