Merge video with audio in flutter

Viewed 1458

Hello folks need some suggestion for merging video with audio in flutter. I am able to achieve it using below FFmpeg command however output video quality is bad even though size is almost equal to the original video. Is there any other plugin which lighter and easier to use than FFmpeg. If not how can I make sure FFmpeg don't affect quality of video

flutterFFmpeg
              .execute("-y -i $recordingFilePath -i $selectedSoundPath -map 0:v -map 1:a  -shortest $mergedFilePath")
1 Answers

You just have to fiddle with various ffmpeg options to find the one that suits your use-case. For me, the following options work.

final FlutterFFmpeg _flutterFFmpeg = FlutterFFmpeg();

_flutterFFmpeg.execute("-i video.mp4 -i audio.mp4 -c copy output.mp4")
              .then((return_code) => print("Return code $return_code"));

This retains the source quality.

Related