[FFmpeg-user] Flutter FFmpeg

a a cowlol at outlook.com
Sun Apr 12 14:27:17 EEST 2020


**Description**
Description of what the issue is about.
Hi. I have written a ffmpeg command that try to get a file to around 20mb using Flutter FFmpeg. The max file a user can choose is 150mb. I choose which command to use based on the original file size. The command i use is:

```
  int resultCode = await _ffmpeg.executeWithArguments([
        "-noautorotate",
        "-i",
        fileToCompress.path,
        "-movflags",
        "+faststart",
        "-vcodec",
        "libx264",
        "-crf",
        "<DYNAMIC VAR - options : 18, 20, 24, 28, 31>",
        '-preset:v',
        '<DYNAMIC VAR - options : "veryfast","faster">',
        "-vf",
        "format=yuv420p",
        result.path
      ]);
```

**Current behaviour**
This works well on android (testing with a oneplus 6) as it always seems to compress the file to <20MB in a reasonable time. However when i test this on IOS (Iphone SE) the imagepicker seems to compress the video first e.g. 150MB to 25MB. Which I then attempt to compress the 25MB again with above command with params "veryfast" and 18.

The file always gets larger that the original 25mb and it takes forever to execute (>3min). Similar behaviour is experienced when I use different params e.g. 24 and faster.

If I manually record a video the imagepicker doesn't compress it and it works the same as android.

**Expected behaviour**
Is there a way I can get this more reliable  in terms of actually always lowering the file size, regardless of whether the file has already been compressed first or not, and possibly improving the execution speed.

 I am worried if the user precompresses the file using something else, such as another app, this will have the same effect.

I have tried using  "h264" as the video codec and this doesn't improve anything.

Thanks a lot
Tom


More information about the ffmpeg-user mailing list