command line help

Hey,
I’ve been trying to figure out how to get faster renders by using blender via command line but I’m having a lot of problems.
It’s most likely something really basic; can anyone tell me what I’m doing wrong? Here’s the command line:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Owner>cd C:\Program Files\Blender Foundation\Blender

C:\Program Files\Blender Foundation\Blender>blender h-
Compiled with Python version 2.5.
‘import site’ failed; use -v for traceback
Warning: could not determine argv[0] path
Checking for installed Python… No installed Python found.
Only built-in modules are available. Some scripts may not run.
Continuing happily.

Blender quit

C:\Program Files\Blender Foundation\Blender> h-
‘h-’ is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Blender Foundation\Blender>blender -h
Blender 2.44 (sub 0) Build
Usage: blender [options …] [file]

Render options:
-b <file> Render <file> in background
-S <name> Set scene <name>
-f <frame> Render frame <frame> and save it
-s <frame> Set start to frame <frame> (use with -a)
-e <frame> Set end to frame (use with -a)<frame>
-o <path> Set the render path and file name.
Use // at the start of the path to
render relative to the blend file.
Use # in the filename to be replaced with the frame number
eg: blender -b foobar.blend -o //render_# -F PNG -x 1
-F <format> Set the render format, Valid options are…
TGA IRIS HAMX FTYPE JPEG MOVIE IRIZ RAWTGA
AVIRAW AVIJPEG PNG BMP FRAMESERVER
(formats that can be compiled into blender, not available on all systems)
HDR TIFF EXR MPEG AVICODEC QUICKTIME CINEON DPX
-x <bool> Set option to add the file extension to the end of the file.
-t <threads> Use amount of <threads> for rendering

Animation options:
-a <file(s)> Playback <file(s)>
-p <sx> <sy> Open with lower left corner at <sx>, <sy>
-m Read from disk (Don’t buffer)

Window options:
-w Force opening with borders (default)
-W Force opening without borders
-p <sx> <sy> <w> <h> Open with lower left corner at <sx>, <sy>
and width and height <w>, <h>

Game Engine specific options:
-g fixedtime Run on 50 hertz without dropping frames
-g vertexarrays Use Vertex Arrays for rendering (usually faster)
-g noaudio No audio in Game Engine
-g nomipmap No Texture Mipmapping
-g linearmipmap Linear Texture Mipmapping instead of Nearest (default)

Misc options:
-d Turn debugging on
-noaudio Disable audio on systems that support audio
-h Print this help text
-y Disable script links, use -Y to find out why its -y
-P <filename> Run the given Python script (filename or Blender Text)
-R Register .blend extension
-v Print Blender version and exit

C:\Program Files\Blender Foundation\Blender>blender -b BNN.blend -f 1
Compiled with Python version 2.5.
‘import site’ failed; use -v for traceback
Warning: could not determine argv[0] path
Checking for installed Python… No installed Python found.
Only built-in modules are available. Some scripts may not run.
Continuing happily.
Loading BNN.blend failed: Unable to open
ERROR: No camera

Blender quit

C:\Program Files\Blender Foundation\Blender>blender -b BNN.blend -f 1
Compiled with Python version 2.5.
‘import site’ failed; use -v for traceback
Warning: could not determine argv[0] path
Checking for installed Python… No installed Python found.
Only built-in modules are available. Some scripts may not run.
Continuing happily.
Loading BNN.blend failed: Unable to open
ERROR: No camera

Blender quit

C:\Program Files\Blender Foundation\Blender>blender -b test blend with command p
rompt.blend -f 1
Compiled with Python version 2.5.
‘import site’ failed; use -v for traceback
Warning: could not determine argv[0] path
Checking for installed Python… No installed Python found.
Only built-in modules are available. Some scripts may not run.
Continuing happily.
Loading test failed: Unable to open
Loading blend failed: Unable to open
Loading with failed: Unable to open
Loading command failed: Unable to open
Loading prompt.blend failed: Unable to open
ERROR: No camera

Blender quit

C:\Program Files\Blender Foundation\Blender>blender -b gingerbread man.blend -f
1
Compiled with Python version 2.5.
‘import site’ failed; use -v for traceback
Warning: could not determine argv[0] path
Checking for installed Python… No installed Python found.
Only built-in modules are available. Some scripts may not run.
Continuing happily.
Loading gingerbread failed: Unable to open
Loading man.blend failed: Unable to open
ERROR: No camera

Blender quit

C:\Program Files\Blender Foundation\Blender>blender -b wheel.blend -f 1
Compiled with Python version 2.5.
‘import site’ failed; use -v for traceback
Warning: could not determine argv[0] path
Checking for installed Python… No installed Python found.
Only built-in modules are available. Some scripts may not run.
Continuing happily.
Loading wheel.blend failed: Unable to open
ERROR: No camera

Blender quit

C:\Program Files\Blender Foundation\Blender>

You failed to specify the render destination and format.

blender -b blendfile.blend -f 1 -o //render.TGA -F TGA -x 1

This renders; but for some strange reason only in the tmp directory. Perhaps somebody else could answer that problem?

I have been trying to figure this out, too
I still get:
Compiled with Python version 2.5.
Warning: could not determine argv[0] path
Checking for installed Python… got it!

and blender crashes. what is argv[0] path? how do I fix this problem.

Nigholith: Thanks! I’ll try that next time I have a large render to do (right now I have, in my greed, accidentally tried to create an object with FAR to many subdivisions and now I’m paying the price)

I guess the tutorial I was trying to follow was out of date. Thanks again!

in general simplest way is to write a .bat file (windows) or shell script (unix based, so mac and linux).
same thing you would type in normally, but in a text file, just rename the extension to .bat or .sh respectively. then doubleclick (windows) or chmod it to be executable (unix) and run it.
easy to maintain and fix, as opposed to typing a wall of text each time you render.

egan,
argv[0] would be the first argument in your command, so you probably have your blender path written incorrectly.
note, unless you have created a proper environment variable, you must specify the full path to the blender executable (this is for a bat or shell script, just “blender” is fine from the cmd if you’re already in the blender directory, I find bat files simpler, and you only have to write the fluff once and then its just copy paste for new ones)

Nigholith,
that is because your render output is //render.tga
this renders to the default directory. if you want it to go somewhere specific, give it an absolute path (eg: C:/mydocs/foldername or /u/myname/myfolder depending on your OS)

christtheblend,
unless your blend file is in the blender directory (unlikely, and not really a great idea anyways), you need to specify the full path to the blender file you want to open.
gingerbread.blend doesn’t cut it since your comp has no idea where that might be.

by default, your OS will only look in the current directory for programs and files you want to run. the exception is to make environment variables, which is a set of locations that the OS will check if it cannot find the file or program in the current directory.

some more info on cmd line rendering
http://wiki.blender.org/index.php/Manual/Rendering_From_Command_Line

that was all a bit terse, let me know if there are any questions or if I was unclear.

EDIT:

nigholith and chris,
you do not need to specify render destination or format.

minimally, you need to call the blender executable (duh), the blend file you want to use, and whether or not its a still image or a render.
if unspecified, all other settings will be taken from what is in the blend file already.
eg: output files will go to wherever they’re set to go inside the blend file, or to the default, if not specified anywhere.
whatever settings you put in the command line will override setting in the blend, but they are not required.

Could you give an example of a .bat file? Mine didn’t work:

 C\:Documents and Settings\Egan\Files\Programs\Blender\Blender.exe -b 

C\:Documents and Settings\Egan\Files\Projects\Computer\Setup.blend -f 1 

-o C\:Documents and Settings\Egan\Desktop.png -F png -x 1

ahhh, doy, forgot to mention something simple.

if your path has spaces in it (yours does), you need to surround each path in quotes, so that its treated as one path.

eg, your OS is looking for blender in C:/Documents, which doesn’t exist

this is a working bat file. note the quotes around the blender path, and the output path. the file path doesn’t need them because there are no spaces.


"C:\Program Files\Blender Foundation\Blender\blender.exe" -b 

C:\donCos\Squito\squitorigfin2.blend -o "C:\Documents and Settings\Don 

Kim\Desktop\render" -F JPEG -x 1 -f 1

this should all be on one line.
this will create render0001.jpg on my desktop

for an animation, it would look like


"C:\Program Files\Blender Foundation\Blender\blender.exe" -b 

C:\donCos\Squito\squitorigfin2.blend  -F PNG  -s 001 -e 010 -a -x 1

this would render a png sequence from frames 1 through 10.

it looks like your format is fine, just add the quotes and it should work.
also, note that I specified no output path here. In that case, it will default to the path specified in the blend file itself.

C:/Documents and Settings/Program Files seems strange though…isn’t it just C:/Program Files on most systems?

When I run, it it still doesn’t work, so I tried it from command prompt so I could see what was wrong (instead of just glimpsing a window flash with words) here is what it said:

 Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Egan&gt;CD Files

C:\Documents and Settings\Egan\Files&gt;Blender.bat

C:\Documents and Settings\Egan\Files&gt;"C\:Documents and Settings\Egan\Files\Progr
ams\Blender\Blender.exe" -b "C\:Documents and Settings\Egan\Files\Projects\Compu
ter\Setup.blend" -f 1 -o "C\:Documents and Settings\Egan\Desktop.png" -F png -x
1
The filename, directory name, or volume label syntax is incorrect.

C:\Documents and Settings\Egan\Files&gt;

anythng I missed?

you have C: instead of C:\ in one of your paths (the first one)

edit:
and the last one

for windows, I think the easiest way to get the path without errors is to open up explorer (or whatever filebrowser you use), go to the desired directory, and copy the filepath from the address bar.
I hate typing long strings and I always make mistakes like that.

Ahh, I simply assumed it’d just use the working directory. Thanks zdk.

no problem,
also, you can use “./” to render to the working directory.

also, blender does have some weird path quirks IIRC, but I don’t immediately recall a specific one.

Oops! Thank you for your help.