AbedElazizShe / LightCompressor

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

The compression operation is very slow #47

Closed mkazemian closed 3 years ago

mkazemian commented 3 years ago

I'm trying to compress 47 MB video but the compression is very slow

Xiaomi Redmi Note 8 with 6 GB of RAM

Video format = mp4 Video size = 47 MB Video duration = 03:27 resolution = 480*480

Did I write wrong? `

    txt_check.visibility = View.GONE
    lin_uploadProgress.visibility = View.VISIBLE

   VideoCompressor.start(path, desFile.path, object : CompressionListener {
            override fun onProgress(percent: Float) {

                val f_percent = percent.toInt()

                txtUploadedStatus.text = "Compressing ..."

                runOnUiThread {
                    txtUploadedPercent.text = "$f_percent%"
                    progress_upload.progress = f_percent

                }

            }

            override fun onStart() {}

            override fun onSuccess() {
                uploadVideo(caption,desFile)

            }

            override fun onFailure(failureMessage: String) {
                mlog("compress fail => $failureMessage")
                txtUploadedStatus.text = "failureMessage"
            }

            override fun onCancelled() {
                mlog("compress has been cancelled")
                // make UI changes, cleanup, etc
            }
        }, VideoQuality.MEDIUM, isMinBitRateEnabled = false, keepOriginalResolution = false
    )

}`
AbedElazizShe commented 3 years ago

Thank you for openinig the issue. I noticed a behaviour like that when the video was already compressed such as a whatsapp video. What is the video's bitrate? If you change isMinBitRateEnabled to true, can it be compressed?

chnouman commented 3 years ago

extremly slow, video size 17mb and taking 35sec