Headless command line render - render output options not working

I am using 2.91

I am rendering a scene (remotely/ssh) with the following command

blender -b new.blend -E CYCLES -f 1 -o //frame_ -F PNG -x 1 -- --cycles-device CPU

I did not find the rendered image relative to my blend file, instead I see the following output. It appears to be that the render output option is not used by blender, it still write the image to the /tmp directory instead of next to my blend file.

Fra:1 Mem:49.06M (Peak 49.60M) | Time:00:27.91 | Remaining:00:00.00 | Mem:1.84M, Peak:2.24M | Scene, View Layer | Rendered 509/510 Tiles, Sample 128/128
Fra:1 Mem:48.95M (Peak 49.60M) | Time:00:27.92 | Mem:1.73M, Peak:2.24M | Scene, View Layer | Rendered 510/510 Tiles
Fra:1 Mem:48.95M (Peak 49.60M) | Time:00:27.92 | Mem:1.73M, Peak:2.24M | Scene, View Layer | Finished
Fra:1 Mem:47.11M (Peak 49.60M) | Time:00:27.92 | Sce: Scene Ve:0 Fa:0 La:0
Saved: '/tmp/0001.png'
 Time: 00:28.52 (Saving: 00:00.60)

Blender quit

Try putting the output specification before the frame spec, it works like an interpreter reading attributes in sequence, so the way you have written it, when it renders it does not yet know where you want the output.

blender -b new.blend -E CYCLES -o //frame_  -f 1 

Because it reads a “chain” you can actually stack several commands into one command phrase


Per the documentation, arguments are exectuted in the order they’re given so your -f 1 argument needs to be last (excepting passing arguments to the python interpreter)

Also, this:
-- --cycles-device CPU
To my knowledge won’t do anything at all and I’m curious where you got the idea to do it.
-- means the end of argument parsing and anything beyond it is used to communicate with python scripts. --cycles-device isn’t an a valid argument regardless.

Thank you for the suggestion and feedback @csimeon and @init_pixel , I got it working and without the trailing “–” options.


You may also want to add piping of the messages to a file so you can follow-up whats happening, I always do.
My command line looks like this:

“C:\Program Files\Blender Foundation\blender-2.91.0-windows64\blender” -b “ThisFile.blend” -S “Scene” -o “//Renders/Render## date” -f 3…14 > 1.txt

Writing the full path of the Blender executional is in case you have several Blender version installations or you have a “movable” installation.
The hashtags allow you to name the renders based on the frame numbers, in case you are rendering several. I usually bind my cameras to frame and get a batch of renders in one command like this.
The piping is “> 1.txt” will send all the interesting messages to a file you can read

Also when rendering several frames you may be interested in the following syntax forms:

start to end consecutive frames : … -s 01 -e 09 -a (-a is for “animate” and works for ranges)
the above can also be written directly as a range of frames (not animation) -f 01…09
individual non sequential frames : … -f 08 -f 09 (can also be written as “-f 01,09,02” no spaces after commas)

You can freely combine several sets of frames in any syntax, or even different scenes, remember though the order matters, write as you would actually be executing sequentially (eg in your original question no point of specifying an output directory after you have rendered and saved)