Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of memory issue with large files #7

Open
Sateesh2 opened this issue Aug 1, 2016 · 9 comments
Open

Out of memory issue with large files #7

Sateesh2 opened this issue Aug 1, 2016 · 9 comments

Comments

@Sateesh2
Copy link

Sateesh2 commented Aug 1, 2016

When I select a large file to trim, on clicking save app crashes with below log

FATAL EXCEPTION: pool-1-thread-1 Process: life.knowledge4.videocroppersample, PID: 32469 java.lang.OutOfMemoryError: Failed to allocate a 440786855 byte allocation with 11418026 free bytes and 239MB until OOM at java.nio.ByteBuffer.allocate(ByteBuffer.java:56) 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$1.hasNext(LazyList.java:55) at com.coremedia.iso.IsoFile.getMovieBox(IsoFile.java:102) at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:51) at life.knowledge4.videotrimmer.utils.TrimVideoUtils.genVideoUsingMp4Parser(TrimVideoUtils.java:71) at life.knowledge4.videotrimmer.utils.TrimVideoUtils.startTrim(TrimVideoUtils.java:65) at life.knowledge4.videotrimmer.K4LVideoTrimmer$12.execute(K4LVideoTrimmer.java:362) at life.knowledge4.videotrimmer.utils.BackgroundExecutor$Task.run(BackgroundExecutor.java:212) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:154) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

@kevalpatel2106
Copy link
Contributor

Can you specify your device model and android version you have?

@Sateesh2
Copy link
Author

Sateesh2 commented Sep 6, 2016

Hi, I was using OnePlus 2 and file size was more than 150 mb. Later I took
your code and replaced mp4parser with ffmpeg and it worked fine.

On Sep 6, 2016 3:10 PM, "Keval Patel" notifications@github.com wrote:

Can you specify your device model and android version you have?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#7 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGaFlHDuZxPx0FPIdgheDcO98eHBXXm3ks5qnTUCgaJpZM4JZgjf
.

@dogo
Copy link
Contributor

dogo commented Sep 6, 2016

@Sateesh2 could you please propose a PR with those changes? they are really interesting

@Sateesh2
Copy link
Author

@dogo I just created PR with above-mentioned changes. Sorry for the late reply

@ashishvirani29
Copy link

i have same issue please give solution.

@Sateesh2
Copy link
Author

Hi, Ashish, the reason for the out of memory issue is the latest mp4parser changes. So I took the current project and rolled back mp4parser to "com.googlecode.mp4parser:isoparser:1.1.7". You may need to update one or two lines in TrimVideoUtils class. Let me know if you are stuck.

@kushmpatel
Copy link

@Sateesh2 Hi I am facing the same problem. So can you please give me a code? I have changed my dependency from "com.googlecode.mp4parser:isoparser:1.1.20" to "com.googlecode.mp4parser:isoparser:1.1.7".

@Sateesh2
Copy link
Author

Sateesh2 commented Oct 6, 2017

In TrimVideoUtils.java file go to genVideoUsingMp4Parser() method, in the first line of this method change FileDataSourceViaHeapImpl to FileDataSourceImpl.

@anuj7sharma
Copy link

Changing FileDataSourceViaHeapImpl to FileDataSourceImpl is not helping. Crash issue still persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants