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
FFmpeg OOM triggers on video export (mp4, webm, maybe more) #799
Comments
Update: looks like this only applies when the resolution is (scaled?)-- I tried the same thing, but native res, and it exported flawlessly-- potentially FFmpeg has an issue with supersampling? |
I think this might be a standard out of memory (OOM) problem. I was able to record and save your graph at 1920x1080@30fps with 120 frames of length without issues. Even if your system has enough "free" memory to allocate all frames and data during processing, the OS can still deny that memory to Firefox and Firefox has no other option, but to throw an exception. Also, you mentioned that it only works at native resolution, but the "native" resolution has nothing special as far the Video Creator is concerned because Desmos generates frames with the desired resolution as you are capturing. By the time you export, the images used to create the video are correctly sized and need no scaling. However, if at a lower resolution you still have a crash, that could be an issue that needs further investigation. |
Wow! This is a well-put-together bug report. I especially appreciate the profiler recording. Looks like it starts out with one worker, then switches to another, then there's 7. (Maybe that's ffmpeg.wasm trying to multi-thread). My normal recommendation here is to make sure you have plenty of free RAM, but yeah it sometimes (often) OOMs earlier than you'd expect. As a workaround, you can export as ZIP instead of video, then put the frames together with a local copy of ffmpeg. I don't know how to start debugging this. Maybe by looking through ffmpeg.wasm issues. ffmpegwasm/ffmpeg.wasm#136 suggests |
Sorry for the late reply, forgot to check my gh .-. when I say native resolution, what I mean is that it saves fine when set to 1724x1259, which is the desmos display size I'm using, but when I set it to 1080x1080, it OOMs every time. I should have plenty of memory, unless 16gb somehow isn't enough for this-- it's definitely possible that Firefox isn't getting enough memory, but I doubt it, given that this is the first time I've OOMed on ff, ever (and I'm running arch, which I've never seen just straight up deny any application enough memory to function properly (unless it was literally out of memory)). I can't remember if the ff profiler capture has the memory usage of my entire system, but I'll probably give it another run to check my OS memory usage (and also check journalctl/dmesg, which I forgot last time). |
It's possible there's a bug somewhere in ffmpeg that's trying to allocate more memory than it needs. I don't see how though. 1080x1080 is a normal-looking resolution. I would rather expect 1724x1259 to have that bug, if the bug did exist, since it's an odd resolution. |
Title pretty much describes it-- FFmpeg begins making the video, then stops at ~45%. The logs show errors originating from FFmpeg, indicating an OOM event-- looks like it can't handle larger file sizes? I'm not quite sure why this would be an issue though, because this is triggering when exporting a video at 1080x1080@30, with 120 frames, which really shouldn't be that big... and worse, once this happens, if you try to press "cancel", the entire page freezes, and must be closed forcefully.
The graph is here, here's a video of the issue happening, you can find a firefox profiler recording here, and here are the logs:
The text was updated successfully, but these errors were encountered: