tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.85k stars 787 forks source link

Android 10: Permission denied #697

Closed jansvanda closed 3 years ago

jansvanda commented 3 years ago

Description When running a command

-i /storage/emulated/0/DCIM/Camera/VID_20210311_160728.mp4 -i /sdcard/DCIM/mockup.png -filter_complex...

on a real device or emulator, the logcat says E/mobile-ffmpeg: /storage/emulated/0/DCIM/Camera/VID_20210311_160728.mp4: Permission denied

i inserted even those two permissions in manifest

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

I included this lib offline inside the lib folder and added

    App: implementation(name:'mobile-ffmpeg-full-4.4', ext:'aar')

    Project:         flatDir { dirs 'libs' }

Expected behavior Run without Error

Current behavior Permission denied error

Screenshots image

Environment

Thanks in advanced for any help

AsynctaskCoffee commented 3 years ago

android:requestLegacyExternalStorage="true" (in manifest) have you tried this ?

jansvanda commented 3 years ago

android:requestLegacyExternalStorage="true" (in manifest) have you tried this ?

Yeah tried several times, Thought that would definitely clear it, but no .....

AsynctaskCoffee commented 3 years ago

You ve declared these permissions inside manifest which is ok but you should also declare (or ask) runtime permissions (+6.0) inside your java or kotlin code, have you declared them too?

jansvanda commented 3 years ago

Oh yeah that was it!!! Thanks a ton!

 private fun requestPermission() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            requestPermissions(
                arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE),
                REQUEST_WRITE_PERMISSION
            )
        } else {
            Log.i(Config.TAG, "Shit permissions.")

        }
    }
AsynctaskCoffee commented 3 years ago

You re welcome 👍🏻

67defalt commented 3 years ago

Hello, Unfortunately none of these solutions are working for me. What I did so far :

The file I'm trying to input is a file named 'in.mp3' located in /storage/emulated/0/Download

I still get « permission denied »

What should I do please ? Thanks.

jansvanda commented 3 years ago

Hello, Unfortunately none of these solutions are working for me. What I did so far :

  • Add permissions to manifest
  • Add android:requestLegacyExternalStorage="true to manifest
  • Add runtime permission (no permission asked because I granted them)

The file I'm trying to input is a file named 'in.mp3' located in /storage/emulated/0/Download

I still get « permission denied »

What should I do please ? Thanks.

How do you reference the file? What is the file path you pass?