Yesterday I had to render a 3d animation for a colleague working on 3D television. He needed a short street-view video with depth map. Because there were some problems with some real world footage he wanted to use, he asked me to create an artificial video in Blender. After I created a simple scene with some models from www.katorlegaz.com, I wanted to render the whole animation overnight on one of the computers in our lab. I had some trouble with getting the command line arguments right and wanted to share this, in case someone else has the same problem.
I first tried
blender -b -a foo.blend
-b is for background mode, so I could log out from the computer after I started the job, the options
-a is for (according to the command line help):
render frames from start to end (inclusive), only works when used after -b
I thought this was the bare minimum to get the job done. However, nothing happened but this:
Compiled with Python version 2.5. Checking for installed Python... got it! ERROR: No camera Blender quit
Huh, no camera? There was an active camera, the scene rendered just fine from the UI, I checked my file over and over and everything seemed all right.
The problem is that, unlike most command line tools I'm used to, command line Blender consumes the arguments in the given order. So with the command
blender -b -a foo.blend Blender executes the
-a before it loads the file
foo.blender, which explains why it can't find a camera.
The solution is to put the
-a and other optionally arguments after the file name:
blender -b foo.blend -a
The help info you get from
blender -h gives another example:
Note: Arguments are executed in the order they are given. eg: "blender -b test.blend -f 1 -o /tmp" ...may not render to /tmp because '-f 1' renders before the output path is set "blender -b -o /tmp test.blend -f 1" ...may not render to /tmp because loading the blend file overwrites the output path that was set "blender -b test.blend -o /tmp -f 1" works as expected.