AbedElazizShe / LightCompressor

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

Compression quality does not change the final size #137

Closed james04gr closed 11 months ago

james04gr commented 1 year ago

I have a Samsung S22 with Android 12 device. I use CameraX to record a video with my application. I set the VideoCapture like below

videoCapture = VideoCapture.Builder().apply { setAudioBitRate(44_000) setVideoFrameRate(30) setTargetResolution(Size(720, 1080)) setBitRate(50_000) setAudioChannelCount(1) }.build()

The captured video has duration 1minute and is about 9.5MB size. After the capture i compress the video with the below configuration VideoCompressor.start( context = applicationContext, uris = uris, isStreamable = false, storageConfiguration = StorageConfiguration( isExternal = false ), configureWith = Configuration( quality = quality, isMinBitrateCheckEnabled = false, videoBitrate = null, disableAudio = false, keepOriginalResolution = false ), listener = object : CompressionListener { ...

As i can see in the OnSuccess callback, the output size is almost the same regardless of the quality i choose. Specifically i see that

I attach the 2 videos in case you want to make some tests https://www.mediafire.com/file/pgfogpcyukqibqw/1.mp4/file https://www.mediafire.com/file/gb9ihpsfpzpk9vv/2.mp4/file

Why is this happening?

AbedElazizShe commented 1 year ago

Hi @james04gr thank you for openning the issue and the provided samples. It's indeed very strange. i was able to compress video 1 ro 3.8MB on VERY_LOW quality. I will try to use the same device for testing as all my devices are pixles.

I will get back to you.