I am slightly new to flutter development and have been looking at ways to implement compression in my app. So far the library that seems to work is light_compressor. I have written code that as such does not show any errors but during execution, the video does not get compressed, in fact sometimes the videos get stuck in playback at the half way point.
final dynamic compressedVid =
await _lightCompressor.compressVideo(
path: vid.path,
isMinBitrateCheckEnabled: false,
videoQuality: VideoQuality.very_low,
android: AndroidConfig(
isSharedStorage: true, saveAt: SaveAt.Movies),
ios: IOSConfig(saveInGallery: true),
video: Video(videoName: "test-compressed.mp4"));
Do I need to set a bitrate or something to get better results?
I am using android api levels 30 through 34 to test the app. The same issue persists on all of them.
So it turns out that the issue was that I was reading the video to be compressed from the cache. I believe that caused some errors because the cache was being over written or something, but saving that video to storage then compressing it solves all issues.