ebg11
ebg11

Reputation: 1046

ffmpeg arguments with flutter for video upload to firebase

I have been trying to use ffmpeg to compress a videos file size so I can upload to firebase storage.

I've ran the code on windows cmd and it works. But when i run it on flutter the quality of the video is terrible. I have also specified many values for the -crf param but the output videos quality and file size are always the same.

int processSuccess = await _flutterFFmpeg.execute(["-i", "file1.mp4", "-crf", "23", "fileoutput.mp4"]);

I had to change the package to video as the execution would fail on the default import as it could not find the -crf param.

  flutter_ffmpeg:
    git:
      url: git://github.com/tanersener/flutter-ffmpeg.git
      ref: v0.2.1
      path: packages/flutter_ffmpeg_video

Am I doing something wrong with the execution arguments or is the import I'm using not the correct package. Sorry I'm very new to ffmpeg.

Thanks for the help.

https://github.com/tanersener/flutter-ffmpeg

Upvotes: 1

Views: 2590

Answers (3)

vishwajit76
vishwajit76

Reputation: 2448

Use flutter_ffmpeg package 21-packages as per your requirement.

Configuration

In Android Edit android/build.gradle file and define package name in ext.flutterFFmpegPackage variable.

 ext {
  flutterFFmpegPackage  = "<package name>"//e.g "full-gpl"
 }

Upvotes: 0

taner
taner

Reputation: 83

I see that you are using the video package of flutter_ffmpeg which unfortunately doesn't include GPL licensed libraries like x264. If you use a GPL licensed package like min-gpl, https-gpl or full-gpl then your output video will be encoded with x264 and have better quality.

Upvotes: 1

ebg11
ebg11

Reputation: 1046

Ended up using flutter_video_compress for compression. Works well https://pub.dartlang.org/packages/flutter_video_compress

Upvotes: 2

Related Questions