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

Crash - Compress video from videocamera #48

Closed JakubBrecher closed 3 years ago

JakubBrecher commented 3 years ago

If I compress video recorded directly from the camera, a library error will occur. Only on certain devices. Crash happens at the end of the compression

I use this intent - Intent(MediaStore.ACTION_VIDEO_CAPTURE)

Xiaomi Max Android 7.1.1

Stacktrace: Process: cz.skodaauto.connect.addon.carfeedback.sample, PID: 21280 java.lang.AssertionError: The given long is not in the range of uint32 (-3071) at com.coremedia.iso.IsoTypeWriter.writeUInt32(IsoTypeWriter.java:28) at com.coremedia.iso.boxes.TimeToSampleBox.getContent(TimeToSampleBox.java:75) at com.googlecode.mp4parser.AbstractBox.getBox(AbstractBox.java:142) at com.googlecode.mp4parser.BasicContainer.writeContainer(BasicContainer.java:216) at com.googlecode.mp4parser.AbstractContainerBox.getBox(AbstractContainerBox.java:88) at com.googlecode.mp4parser.BasicContainer.writeContainer(BasicContainer.java:216) at com.googlecode.mp4parser.AbstractContainerBox.getBox(AbstractContainerBox.java:88) at com.googlecode.mp4parser.BasicContainer.writeContainer(BasicContainer.java:216) at com.googlecode.mp4parser.AbstractContainerBox.getBox(AbstractContainerBox.java:88) at com.googlecode.mp4parser.BasicContainer.writeContainer(BasicContainer.java:216) at com.googlecode.mp4parser.AbstractContainerBox.getBox(AbstractContainerBox.java:88) at com.googlecode.mp4parser.BasicContainer.writeContainer(BasicContainer.java:216) at com.googlecode.mp4parser.AbstractContainerBox.getBox(AbstractContainerBox.java:88) at com.abedelazizshe.lightcompressorlibrary.MP4Builder.finishMovie(MP4Builder.java:151) at com.abedelazizshe.lightcompressorlibrary.Compressor.compressVideo(Compressor.kt:415) at com.abedelazizshe.lightcompressorlibrary.VideoCompressor$startCompression$2.invokeSuspend(VideoCompressor.kt:97) 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:738) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

AbedElazizShe commented 3 years ago

Thank you for openinig the issue. Could you please provide an original sample video so I can debug and find the cause?. Thank you.

JakubBrecher commented 3 years ago

The error only occurs if I shoot the video directly from the application. When I shoot it outside the application and only then compress it, everything works fine.

AbedElazizShe commented 3 years ago

@JakubBrecher Could you please try the latest version? I added an apk to README if you want to try the sample first. Please close the issue if the problem is fixed. Thank you