bgrins / videoconverter.js

[UNMAINTAINED] Convert videos in your browser
http://bgrins.github.io/videoconverter.js/
Other
2.35k stars 300 forks source link

Browser crashes when loading large video files #12

Open vgiotsas opened 10 years ago

vgiotsas commented 10 years ago

When trying to load large files as ArrayBuffer, FileReader will try to load the entire file in the memory which eventually will cause the browser to crash. Is there a way to avoid this from happening? In my use case I just need to extract the video metadata, so I tried slicing but it doesn't really help if the moov atom is at the end of the file. Any other suggestions will be appreciated!

bgrins commented 10 years ago

This crash is happening even before the ffmpeg script is running, so there isn't really much that we can do about it. Which browser are you seeing this with? I don't really have any suggestions, besides maybe filing bugs with the browser(s) that you are running into this with and including a basic test case (without any videoconverter stuff - just using FileReader.

The only other thing I could think of is using FileReaderSync instead, though if it is a memory issue with the ArrayBuffer that probably won't help. I have a little wrapper that abstracts some of that away here: https://github.com/bgrins/filereader.js/. In fact, you could try with the same file on that demo page in 'Sync' mode and see if it causes a crash.