AbedElazizShe / LightCompressor

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

Video compression failed,video from Google Photos #185

Open UmairYousafzai opened 10 months ago

UmairYousafzai commented 10 months ago

If I select the video from Google Photos then compression fails, the logs are mentioned below and i'm using Android 11 with oppo A5

 An error has occurred!
                                                                                                    java.lang.IllegalArgumentException
                                                                                                        at android.media.MediaCodec.native_configure(Native Method)
                                                                                                        at android.media.MediaCodec.configure(MediaCodec.java:2126)
                                                                                                        at android.media.MediaCodec.configure(MediaCodec.java:2042)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.prepareEncoder(Compressor.kt:516)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.start(Compressor.kt:199)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.access$start(Compressor.kt:30)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invokeSuspend(Compressor.kt:134)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:8)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor$compressVideo$2.invoke(Unknown Source:4)
                                                                                                        at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:89)
                                                                                                        at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:169)
                                                                                                        at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:53)
                                                                                                        at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:180)
                                                                                                        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:570)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
                                                                                                        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)