AbedElazizShe / LightCompressor

A powerful and easy-to-use video compression library for android uses MediaCodec API.
Apache License 2.0
524 stars 116 forks source link

Video Compression failed when "keepOriginalResolution = true" #170

Open AbdullahJaved-dev opened 1 year ago

AbdullahJaved-dev commented 1 year ago

I am trying to compress a high-resolution video of size 602 MB. Still, onSuccesscallback is invoked without invoking onProgress, and a video file with a 24kb size is created at the destination location. On debugging it came to know that there's an issue at prepareEncoder(outputFormat: MediaFormat, hasQTI: Boolean). Below is the configuration I'm using for compressing.

Configuration(
    videoNames = listOf("Video_${System.currentTimeMillis()}"),
    quality = VideoQuality.MEDIUM,
    isMinBitrateCheckEnabled = true,
    videoBitrateInMbps = 3,
    disableAudio = false,
    keepOriginalResolution = true
)

Video Info: Size = 602 MB Resolution = 3840 x 2160 Length = 02 minutes 14 seconds

Device: Pixel 5a

AbedElazizShe commented 1 year ago

Thank you @AbdullahJaved-dev , I believe I found the issue and fixed it. Will release a new version soon. The library was build for short videos use cases a few years ago, never imagined it will be used for high quality video :D I need to work on improving the speed of compression especially for long videos. It is quite slow now

albyrock87 commented 4 months ago

@AbedElazizShe I'm still facing this issue with LightComrpessor 1.3.2, when is this fix going to be released?