react-native-video-processing icon indicating copy to clipboard operation
react-native-video-processing copied to clipboard

OutOfMemory error on Android while trimming.

Open rajeevrocker7 opened this issue 5 years ago • 1 comments

Current Behavior

I noticed in android you are using 'com.googlecode.mp4parser:isoparser:1.1.20' to trim.

When trimming a video the native call goes to genVideoUsingMp4Parser() method and it crashes with log: Fatal Exception: java.lang.OutOfMemoryError: Failed to allocate a 2065855864 byte allocation with 21747093 free bytes and 491MB until OOM, target footprint 43494189, growth limit 536870912 at java.nio.HeapByteBuffer.(HeapByteBuffer.java:54) at java.nio.HeapByteBuffer.(HeapByteBuffer.java:49) at java.nio.ByteBuffer.allocate(ByteBuffer.java:282) at com.googlecode.mp4parser.AbstractBox.parse(AbstractBox.java:110) at com.coremedia.iso.AbstractBoxParser.parseBox(AbstractBoxParser.java:107) at com.googlecode.mp4parser.BasicContainer.next(BasicContainer.java:185) at com.googlecode.mp4parser.BasicContainer.hasNext(BasicContainer.java:161) at com.googlecode.mp4parser.util.LazyList.blowup(LazyList.java:30) at com.googlecode.mp4parser.util.LazyList.size(LazyList.java:77) at com.googlecode.mp4parser.BasicContainer.getBoxes(BasicContainer.java:80) at com.googlecode.mp4parser.authoring.samples.DefaultMp4SampleList.(DefaultMp4SampleList.java:36) at com.coremedia.iso.boxes.mdat.SampleList.(SampleList.java:33) at com.googlecode.mp4parser.authoring.Mp4TrackImpl.(Mp4TrackImpl.java:64) at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:57) at com.shahenlibrary.utils.VideoEdit.genVideoUsingMp4Parser(VideoEdit.java:107) at com.shahenlibrary.utils.VideoEdit.startTrim(VideoEdit.java:94) at com.shahenlibrary.VideoPlayer.VideoPlayerView.trimMedia(VideoPlayerView.java:367) at com.shahenlibrary.VideoPlayer.VideoPlayerViewManager.receiveCommand(VideoPlayerViewManager.java:132) at com.shahenlibrary.VideoPlayer.VideoPlayerViewManager.receiveCommand(VideoPlayerViewManager.java:42) ...

Same issue is coming in that 'com.googlecode.mp4parser:isoparser:1.1.20' library but they have fixed it some PR (https://github.com/sannies/mp4parser/pull/288) (https://github.com/sannies/mp4parser/pull/205) OR in latest version of com.googlecode.mp4parser:isoparser

@shahen94 Please help..

Expected Behavior

Trimming should work even with mp4Parser , if there is still time for ffmpeg implmentations.

Can you please solve this with updated library 'com.googlecode.mp4parser:isoparser:1.1.22' for same with updated readme?

Your Environment

software version
react-native-video-processing v1.13.0
react-native v0.59.10
node v12.12.0

rajeevrocker7 avatar Mar 23 '20 09:03 rajeevrocker7

Just send a PR with the updated lib version and he'll merge it. @rajeevrocker7

xlogix avatar Apr 18 '20 11:04 xlogix