I usually render my animation into image sequence format, It usually takes a lot of time, so I turn off my monitor and come back later to check the rendered result then find that blender crashed before rendering all the frames.

Since rendering can be done from the command prompt I thought about writing a script (running in my OS) to automatically restart rendering from the last successful rendered frame until all frames are finished*.

But I believe this problem is facing a lot of people out there, is there a way to deal with it? instead of reinventing the wheel?

  • for example if the total render time is 8 hours I don't want come back to check my computer every 20 minutes (some times this is not available I'm asleep or away from my PC)
  • 1
    $\begingroup$ It might be overkill, but perhaps this is something like what you are looking for $\endgroup$ – gandalf3 Nov 13 '15 at 21:51
  • $\begingroup$ yeah it's an overkill, but you highlighted a good place to begin searching from, thank you :) $\endgroup$ – Ahmed Ali Nov 14 '15 at 11:20

Blender actually can do this already; if you disable Overwrite in Render settings > Output, Blender will skip rendering frames where the output file already exists.

See Does Blender resume rendering after returning from hibernation in Windows 7?

On linux you could write a short shell script to restart the render in case of a crash, e.g.

#!/usr/bin/env bash
while true; do
    blender $@ # $@ contains all the arguments passed to the shell script

Save it in a file (e.g. persistent_blender.sh), give it execute permissions and run it like so:

./persistent_blender.sh -b '/path/to/file.blend' -a

Where the arguments tell blender to render the animation of the specified file.

Of course you could make something much nicer and handle all sorts of things (such as stopping when all the output files exist and have a size > 0).

  • $\begingroup$ this is not what I meant, I need a script to restart rendering automatically instead of checking my computer every short period of time. for example if the total render time is 8 hours I don't want come back to check my computer every 20 minutes (some times this is not available I'm asleep or away from my PC) $\endgroup$ – Ahmed Ali Nov 13 '15 at 21:08
  • $\begingroup$ @AhmedAli You could write a simple loop which simply runs blender repeatedly until all the frames are rendered. $\endgroup$ – gandalf3 Nov 13 '15 at 21:27
  • $\begingroup$ I agree, I'm Just checking if somebody out there has already done this. $\endgroup$ – Ahmed Ali Nov 13 '15 at 21:36
  • 7
    $\begingroup$ Why is blender crashing in the first place? $\endgroup$ – user1853 Nov 13 '15 at 21:36
  • $\begingroup$ Yes, why is Blender crashing? I render to image files almost 24 hours a day. Blender has never crashed doing this in 200 days. Windows has crashed, but not Blender. (2.72, 2.73 & 2.76,on W7 and W10, 20Gb RAM.) Do you know that it was just Blender that crashed & not the O/S? $\endgroup$ – The Beachdancer Nov 18 '15 at 13:31

I would write an Autohotkey watchdog script for that. Save this code as watchdog.ahk or smth.

  1. Uncheck overwrite images,
  2. open Blender file,
  3. then run this script, it will show the popup,
  4. start initial rendering manually and go to sleep =)

It'll restart Blender if it crashes, open the same file, and send ctrl-f12 again. /repeat/

TIMER = 5000
WinWaitActive, ahk_class GHOST_WindowClass
WinGetTitle, title, A
file := RegExReplace(title, ".*\[(.*)\]$", "$1")
if file=
    msgbox, CANNOT GET FILENAME FROM TITLE: "%title%"
TrayTip, blender, % "Now watching for " file
    IfWinNotExist, %title% ahk_class GHOST_WindowClass
        IfWinExist, ahk_exe blender.exe
            goto next
        TrayTip, blender, % "Restarting " file
        Run, C:\Program Files\Blender Foundation\blender\blender.exe %file%
        WinWaitActive, ahk_class GHOST_WindowClass
        Sleep, 2000
        Send, ^{f12}
    Sleep TIMER

PS: Pressing Shift-0 closes the script and removes it from Tray.

  • $\begingroup$ Worth mentioning this is for windows OS only. $\endgroup$ – batFINGER Jan 25 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.