Scripted render batch causes Blender to run out of memory

Hi,

I got this simple scene, 1 model with less than 100 polys, 1 backdrop, 3 lights and 2 cameras. The model has shading built up from 3 images (diffuse, bump and a foil shader based on color values).

The model represents a cardboard product with custom print, so I have an illustrator script setup that exports all .AI files to compatible textures and dumps them in the input folder of my Blender project. My blender script then runs through all the different styles, loads and applies the 3 specific images for each style to the shader nodes and renders an image (EEVEE) on camera 1 and a video (140 frames) on camera 2. After rendering, I remove the used texture images from memory.

This all works perfectly if I only render images. However, if I start rendering video as well, it works for 2 or 3 styles, but after that Blender is using so much RAM it starts to hang. Looking at my activity monitor, a chunck of RAM is added to the pile with each frame.

I can imagine that RAM increase during the animation rendering is normal as it combines different renders in a video, but I would expect it to flush RAM once the render sequence is done.

Any thoughts on how to optimise RAM usage in this situation?

Edit: running on Blender 4.0

Thanks,
Andy

Welcome :tada:

actually using the direct render to video approuch… may fit for smaller projects… but for larger it’s better to render the single frames as image and then do the video rendering in post production… this way also any other effect are possible and are also cheaper (only 2D) than a complet 3D recalculation…

I do not exactly know but i guess depending on the video settings the video frames are stored in memory until some compresson/ conversion takes place to a certain degree ( what was it i-frame ??)… and so this uses by far memory than the single images…

Thanks for welcoming me :wink: it’s great to be here

The platform I’m building will allow in-house users to drop in an AI file and get the images and video’s as output, so that’s why I try to narrow required software clients to a minimum. I assume post-processing would be possible directly from the back-end with just a bit more effort. Thanks for the suggestion.

Nonetheless, still curious about alternative solutions as well for running this locally avoiding a third piece of software.