Reputation: 143
I am facing this strange issue on android emulator while trying to compress a video to be uploaded to Firebase.
I am using video compress plugin for flutter: video compress
Most of time it does a good job of compressing videos but sometimes it makes the video size double or more then that. For example a 36mb video gets compressed to almost 20mb but sometimes it gets to 60mb after compression.
I have also tested the compression with different videos and results are always different. Sometimes the video gets compressed but sometimes the size of the video gets doubled or more then that.
Any insights on the particular issue or suggestion.
Upvotes: 2
Views: 1661
Reputation: 3652
One thought is the "Duration" field. So it actually is supposed to do nothing if your video is below the set threshold. No compression will happen on files shorter than this threshold but it still passes the file through the plugin code. I've seen file sizes increase that way, but not specifically by that much, it could be possible though. That plugin does have it's hiccups occasionally.
These are the settings I use on a production App:
MediaInfo? info;
try {
info = await VideoCompress.compressVideo(file.path,
quality: VideoQuality.Res640x480Quality,
deleteOrigin: false,
includeAudio: true,
frameRate: 24
//duration: 30 //do not use this!
);
} catch (e) {
VideoCompress.cancelCompression();
}
Upvotes: 1