2

I trying to compress video in react native using react-native-ffmpeg .

I am picking video using react-native-image-picker.

I tried using command -y -i ${inputVideo} -vcodec h264 -acodec mp3 ${finalVideo}.

But it is failing with rc:1. My code:-

 RNFFmpeg.execute(
            str_cmd,
        ).then(result => {
             if (result.rc === 0) {
                 console.log("successfully compressed");
             } else {
                 console.log("error",result);
             }
          });

Thanks!

Aman Ullah
  • 49
  • 7
Shahanshah Alam
  • 565
  • 7
  • 22

1 Answers1

1

If I remember correctly, you have to include the input video into the directory for your app.

You should be able to do so with react-native-fs.

And here is the relevant code from the react-native-ffmeg example project.

Jose Miralles
  • 483
  • 7
  • 12