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

Throwing IO Exception when compressing multiple videos at once. #92

Closed ishaan1607 closed 2 years ago

ishaan1607 commented 3 years ago

I am using a cases when there is a list of video uris and I trying to compress those by putting a loop and compressing each file. But VideoCompressor.start() throughs an IOException.

java.io.IOException: Failed to instantiate extractor. at android.media.MediaExtractor.nativeSetDataSource(Native Method) at android.media.MediaExtractor.setDataSource(MediaExtractor.java:203) at com.abedelazizshe.lightcompressorlibrary.compressor.Compressor.compressVideo(Compressor.kt:103) 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)

Here is the crash occurred.

AbedElazizShe commented 3 years ago

@ishaan1607 thank you for opening thid issue. The library does not support multiple compression at the moment, i may add the support in the near future.

Thank you.

RishabJaiswal commented 2 years ago

I am also facing the same issue.

RishabJaiswal commented 2 years ago

I really need this parallel compression feature

gvravikumar commented 2 years ago

for parallel compression you need to crate multiple instances of MediaExtractor.

AbedElazizShe commented 2 years ago

I added support for multiple video compression in v1.1.1. Please try it out and let me know if you face any issues.

There are lots of breaking changes in this version, please see what's new in v1.1.1 section in README before updating.

Thank you.