Manav Parikh
Manav Parikh

Reputation: 13

Merging Audio file with Video file in Flutter

I am working on an app which has similar functionality like Instagram reels. I want to know how do I merge a song(audio) while recording the video and then store them both as a video.

Upvotes: 1

Views: 3538

Answers (1)

Rohit Chaurasiya
Rohit Chaurasiya

Reputation: 607

We will do using flutter_ffmpeg package.

create a command like this.

  command = "-y -i $videoPath -i $audioPath -map 0:v -map 1:a -c:v copy "
              "-shortest $savedFileLocation"

to execute command using

 final FlutterFFmpeg _flutterFFmpeg = FlutterFFmpeg();
      _flutterFFmpeg.execute(command.string).then((rc) {
        statusCode = rc;
        print("FFmpeg process exited with rc $rc");
        return statusCode;
      });

Upvotes: 3

Related Questions