flutterffmpegflutter-ffmpeg

ffmpeg_kit_flutter operation not permitted for audio operations


I'm trying to trim an audio file using ffmpeg_kit_flutter but I keep getting the error:

audio/path/output.mp3: Operation not permitted.

This is the ffmpeg command that I'm using:

final cmd="-y -i \"$audioPath\" -ss $audioStartTime -to $audioEndTime -c:a libmp3lame $outPutName";

And I've also tried :

final cmd="-y -i \"$audioPath\" -ss $audioStartTime -to $audioEndTime -c copy $outPutName";

But the error is still the same. I'm using the ffmpeg_kit_flutter_full_gpl package.


Solution

  • I managed to fix it. I had set my custom directory to:

    /storage/emulated/0/Pictures/myapp 
    

    Problem was Pictures directory does not allow apps to write audio files to it. Switching to:/storage/emulated/0/Music/myapp Fixed the problem