How can I reduce the video recording size in flutter?

2,877

To reduce the size, you can employ any or both of these 2 methods:

Resolution

You can see them in the example controller = CameraController(cameras[0], ResolutionPreset.medium);, change this to ResolutionPreset.low or some other customer value (does not have to be preset)

Encoding

You can use different encoding algorithms, such as FFmpeg using this plugin https://pub.dartlang.org/packages/flutter_ffmpeg. See also this question and its answers how to reduce size of video before upload to server programmatically in android

Share:
2,877
divyanshu bhargava
Author by

divyanshu bhargava

Developer who code little green bots

Updated on December 09, 2022

Comments

  • divyanshu bhargava
    divyanshu bhargava over 1 year

    I'm using flutter camera plugin to record the video. But the recorded video size is too big. Something around 20mb for 1 min. How can I reduce the size (one of which is how to reduce resolution)? Also I have changed my VideoEncodingBitRate to 3000000. Like this mediaRecorder.setVideoEncodingBitRate(3000000);.