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

compression is slow #88

Closed shaktis110 closed 3 years ago

shaktis110 commented 3 years ago

hello sir

device - realme xmax pro ram 6gb.

tested with demo application.

platform - android 8, android 9 , android 10, android 11

Thanks for this wonderful project. I am using this library in production chat application. One thing I noticed is that the compression is slow in the actual device. It takes about 15-20 seconds for compression of 5-10 MB files. I have also downloaded the demo app and its working almost as mentioned above. Is there any way to speed up the compression.

I am not expert in java can it help to improve compression speed?

https://stackoverflow.com/questions/35884600/android-mediacodec-encode-and-decode-in-asynchronous-mode/35885471#35885471

https://github.com/mstorsjo/android-decodeencodetest

thanks for your precious time.

AbedElazizShe commented 3 years ago

@shaktis110 thank you for opening this issue and sorry for the late reply. I have improved the speed and I will release a new verion most probably tomorrow.

lc1 lc2 lc3

shaktis110 commented 3 years ago

thank you so much sir

AbedElazizShe commented 3 years ago

@shaktis110 please try version 0.9.7 and let me know if it's working as expected. Thank you.

shaktis110 commented 3 years ago

respected sir new release version is not working . tested with real device and also with demo application 0.9.7 in logcat E/ACodec: [OMX.google.h264.encoder] configureCodec returning error -61 android.media.MediaCodec$CodecException: Error 0xffffffc3

shaktis110 commented 3 years ago

Screenshot_1630512082

AbedElazizShe commented 3 years ago

Can you please share the error log on the physical device? Emulators are expected not to work due to the lack of hardware encoders.

shaktis110 commented 3 years ago

hello sir

Here is the log of demo.apk from physical device - realme max pro android 11

2021-09-02 11:04:27.915 10538-12191/com.abedelazizshe.lightcompressor D/ACodec: AllocateComponent OMX.MTK.VIDEO.ENCODER.AVC success 2021-09-02 11:04:27.915 10538-12191/com.abedelazizshe.lightcompressor D/ACodec: [OMX.MTK.VIDEO.ENCODER.AVC] Now Loaded 2021-09-02 11:04:27.918 10538-11172/com.abedelazizshe.lightcompressor E/Compressor: Error 0xffffffc3 android.media.MediaCodec$CodecException: Error 0xffffffc3 at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:2127) at android.media.MediaCodec.configure(MediaCodec.java:2043) at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.prepareEncoder(Compressor.kt:495) at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.start(Compressor.kt:207) at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:160) at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:114) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665) 2021-09-02 11:04:27.980 10538-11172/com.abedelazizshe.lightcompressor E/StreamableVideo: last atom in file was not a moov atom

AbedElazizShe commented 3 years ago

Thank you for the details, you can keep using the old version of the library until I fix this later today.

shaktis110 commented 3 years ago

Great, thanks sir !

On Thu, Sep 2, 2021, 11:20 AM Abed Elaziz Shehadeh @.***> wrote:

Thank you for the details, you can keep using the old version of the library until I fix this later today.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AbedElazizShe/LightCompressor/issues/88#issuecomment-911220950, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGODM7H4T3OZ4A2UYLWY33T74GBRANCNFSM5CPVL3MQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

AbedElazizShe commented 3 years ago

It was unsupported codec profile, fixed in 0.9.8. Thank you.

shaktis110 commented 3 years ago

I have tested and it is working perfectly fine with better speed

Thank you very much sir you are a blessing.