Pavan Kumar
Pavan Kumar

Reputation: 53

Using flutter how to merge audio file with sync of any video like camera action like that there is any specific package is available in flutter

I have been searching for the packages or any method for the particular problem, i googled but i didn't find any solution , So my issue is , i want functionality like ticktock App , user can select any music audio and they can play according to that user can do action, with sync of both audio and video i want output file as video. how can i achieve this , is there any method or any packages are avalibale in flutter . i have done selecting audio and video recording feature but i ma stuck with the merging both , if FFmpeg package we can use means , how to use that packages .. please explain me guys.

Upvotes: 5

Views: 3786

Answers (1)

Marc Sanny
Marc Sanny

Reputation: 1141

In FFmpeg You can do it by playing the audio, recording video and then merging two files like

final FlutterFFmpeg _ffMpeg = FlutterFFmpeg();

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

With FFmpeg You need to find the command that suits You the best.

But... Personally I think FFmpeg isn't a good choice:

  1. It is heavy
  2. You can't use it in commercial projects (I might be wrong, please correct me if I am)

What I suggest

You can record video and have audio file and video with Flutter. Then use platform specific code.

Even if you don't have experience in specific language I found those two libraries that could help:

iOS: https://github.com/dev-labs-bg/swift-video-generator (does exactly what You need).

Android: https://github.com/israel-fl/bitmap2video (I'm not sure if works with videos, but it accepts bitmaps)

Upvotes: 2

Related Questions