Skip to content

Android Crash: java.lang.AssertionError: uint32 overflow (org.mp4parser.AudioSampleEntry) #383

@daylami555

Description

@daylami555

Current behavior
The app crashes immediately (Native Crash) when attempting to compress certain video files on Android. The crash occurs deep in org.mp4parser with an AssertionError: The given long is not in the range of uint32. It seems related to audio metadata parsing on specific video files (e.g., AI-generated footage). JavaScript try/catch cannot handle this error as it kills the process.
Video.getVideoMetaData(uri) is also undefined/unavailable in this version to pre-check the file. Workaround: Checking file size before compression helps, but doesn't guarantee safety against this specific metadata crash.

Expected behavior
The library should handle metadata parsing errors gracefully or allow try/catch to handle the failure without crashing the entire application.

Platform
Android
iOS
React Native Version
0.81.5 (Expo 54)

React Native Compressor Version
1.13.0

Reproducible Steps And Demo
Call Video.compress(uri, { compressionMethod: 'auto' }) on Android.
Use a video file with specific audio metadata (likely large internal duration values).
App crashes instantly with the stack trace below.

Logs : ERROR Your app just crashed. See the error below.
java.lang.AssertionError: The given long is not in the range of uint32 (6291456000)
org.mp4parser.tools.IsoTypeWriter.writeUInt32(IsoTypeWriter.java:28)
org.mp4parser.boxes.sampleentry.AudioSampleEntry.getBox(AudioSampleEntry.java:295)
org.mp4parser.BasicContainer.writeContainer(BasicContainer.java:138)
org.mp4parser.boxes.iso14496.part12.SampleDescriptionBox.getBox(SampleDescriptionBox.java:102)
org.mp4parser.BasicContainer.writeContainer(BasicContainer.java:138)
org.mp4parser.support.AbstractContainerBox.getBox(AbstractContainerBox.java:82)
org.mp4parser.BasicContainer.writeContainer(BasicContainer.java:138)
org.mp4parser.support.AbstractContainerBox.getBox(AbstractContainerBox.java:82)
org.mp4parser.BasicContainer.writeContainer(BasicContainer.java:138)
org.mp4parser.support.AbstractContainerBox.getBox(AbstractContainerBox.java:82)
org.mp4parser.BasicContainer.writeContainer(BasicContainer.java:138)
org.mp4parser.support.AbstractContainerBox.getBox(AbstractContainerBox.java:82)
org.mp4parser.BasicContainer.writeContainer(BasicContainer.java:138)
org.mp4parser.support.AbstractContainerBox.getBox(AbstractContainerBox.java:82)
com.reactnativecompressor.Video.VideoCompressor.video.MP4Builder.finishMovie(MP4Builder.kt:127)
com.reactnativecompressor.Video.VideoCompressor.compressor.Compressor.start(Compressor.kt:402)
com.reactnativecompressor.Video.VideoCompressor.compressor.Compressor.access$start(Compressor.kt:29)
com.reactnativecompressor.Video.VideoCompressor.compressor.Compressor$compressVideo$2.invokeSuspend(Compressor.kt:120)
com.reactnativecompressor.Video.VideoCompressor.compressor.Compressor$compressVideo$2.invoke(Unknown Source:8)
com.reactnativecompressor.Video.VideoCompressor.compressor.Compressor$compressVideo$2.invoke(Unknown Source:4)
kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:42)
kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:164)
kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
com.reactnativecompressor.Video.VideoCompressor.compressor.Compressor.compressVideo(Compressor.kt:58)
com.reactnativecompressor.Video.VideoCompressor.VideoCompressorClass$startCompression$2.invokeSuspend(VideoCompressorClass.kt:101)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:832)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
› Reloading apps

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions