manim-slides icon indicating copy to clipboard operation
manim-slides copied to clipboard

[BUG] `utils.reverse_video_file` causes excessive RAM usage

Open jungerm2 opened this issue 9 months ago • 11 comments

Description

EDIT: This issue actually comes from reverse_video_file. See below.

I'm aware this is likely an av bug, but I'm filling it here because others might encounter it.

It seems manim-slides' concatenate_video_files eats up too much RAM (it crashes my 16GB laptop) and can cause severe OS crashes. I've tried to fix this bug on my end by monkey-patching it to use manimCE's equivalent of concatenate_video_files like so:

import manim_slides
from manim_slides.logger import logger

# Yet another bad idea... but it works **shrug**
def _concatenate_video_files(files: list[Path], dest: Path) -> None:
    logger.warn("Warning: Using monkey-patched `concatenate_video_files`")
    renderer = CairoRenderer()
    writer = SceneFileWriter(renderer, "NotARealScene")
    writer.combine_files(files, dest)
manim_slides.slide.base.concatenate_video_files = _concatenate_video_files

The above works fine most of the time (which raises the question: why does manim-slides have its own version of combine files then?), but also causes OOMs just like the original version.

A long-term fix would be great, but I understand this might be out of scope. In the meanwhile, I'm trying to render out my slides in HQ because I've a presentation coming up in a few days, and, while they render fine with -ql (which I was using to prototype the slides), I can't seem to render them in HQ. Any temporary fixes I could do?

Version

Latest at time of writing (manim-slides, version 5.1.7)

Platform

Linux, Fedora 40

Screenshots

No response

Additional information

No response

jungerm2 avatar May 20 '24 23:05 jungerm2