react native ffmpeg haw write to external storage

46 Views Asked by At

iam trying to take a part from an audio file and create another file with it but i keep getting permissions denied or Read-only file system error :

function:export const handleVideoLoad = (selectedVideo: any) => {
 
 FFmpegKit.execute(
   `-ss 00:00:00 -i ${selectedVideo.url.split(" ").join("")} -t 00:20:00 -map 0 -c copy ${
     'ardsh.mp3'
   }`,
 ).then(async session => {
   const state = FFmpegKitConfig.sessionStateToString(
     await session.getState(),
   );
   const returnCode = await session.getReturnCode();
   const failStackTrace = await session.getFailStackTrace();
   const duration = await session.getDuration();

   if (ReturnCode.isSuccess(returnCode)) {
     console.log(`Encode completed successfully in ${duration} milliseconds;`);
   } else if (ReturnCode.isCancel(returnCode)) {
     console.log('Encode canceled');
   } else {
     console.log(
       `Encode failed with state ${state} and rc ${returnCode}.${
         (failStackTrace, '\\n')
       }`,
     );
   }
 });
};

i already have the permissions in Manifest file and i have the android:requestLegacyExternalStorage="true"

error:


 Audio: pcm_s16le ([1][0][0][0] / 0x0001), 24000 Hz, mono, s16, 384 kb/s
 LOG
 LOG  ardsh.mp3: Read-only file system
 LOG  Encode failed with state COMPLETED and rc 1.\n
0

There are 0 best solutions below