permission is denied using Android Q ffmpeg": error=13, Permission denied

后端 未结 5 2326
逝去的感伤
逝去的感伤 2020-12-28 15:24

I want to get the frames from the RTSP video using ffmpeg. But for android 10 above I am getting error as below.

 E/FFmpeg: Exception while trying to run: [L         


        
5条回答
  •  爱一瞬间的悲伤
    2020-12-28 15:54

    From Android Q onwards, you cannot execute binaries in your app's private data directory.

    From the issuetracker: https://issuetracker.google.com/issues/128554619

    The change to block exec() on application data files for targetAPI >= Q is working-as-intended. Please see https://android-review.googlesource.com/c/platform/system/sepolicy/+/804149 for background on this change. Calling exec() on writable application files is a W^X (https://en.wikipedia.org/wiki/W%5EX) violation and represents an unsafe application practice. Executable code should always be loaded from the application APK.

    While 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 .

    Additionally, please be aware that executables executed via exec() are not managed according to the Android process lifecycle, and generally speaking, exec() is discouraged from Android applications. While not Android documentation, Using "exec()" with NDK covers this in some detail. Relying on exec() may be problematic in future Android versions.

提交回复
热议问题