# Why is this background render/script for the command line not working?

I'm trying to run Blender as a background process via batch process (or directly from the command line), neither seem to work. Has anyone done this before? I'm using the following pages for guidance:

When rendering, it should use the info in the .blend file (.PNG vs AVI, frame rate, etc.) by default. For both of these, there is a file called ANIMATION.blend already created.

Here is the FIRST script, to render in the background:

cd\program files\blender foundation\blender
blender -b C:\pathtofile\ANIMATION.blend -o C:\pathtofile\renders\ -x


It gives me:

found bundled python: C:\Program Files\Blender Foundation\Blender\2.78\python

Blender quit


But does not actually render anything, either in /tmp, or the output file above, or the one in the .blend file already.

If I just render the animation via the in Blender GUI, it works fine.

Any ideas? Is it broken or am I doing something wrong?

You haven't given the command to render the animation, which is -a. The command line isn't just for rendering, so unless you explicitly tell blender you want to render, it won't.

Your first command should look like this:

blender -b C:\pathtofile\ANIMATION.blend -o C:\pathtofile\renders\ -x -a

• Thanks, that worked! Now I have a new problem, it says there is no camera present, I'll figure that one out myself. – J Rowoldt Oct 10 '16 at 23:25
• Creating the animation .blend file from the command line still doesn't work, though. :) – J Rowoldt Oct 10 '16 at 23:26
• 'No camera present' means there isn't a camera in the file that it can render from. You have to add a camera object. As for the animation file, it probably means there is an error in your Python script. – Ray Mairlot Oct 10 '16 at 23:36
• Thanks again! Solved it with the follow line, highlighted: – J Rowoldt Oct 11 '16 at 17:33
• cam = bpy.data.cameras.new("Camera") cam_obj = bpy.data.objects.new("Camera", cam) bpy.context.scene.objects.link(cam_obj) bpy.context.scene.camera = cam_obj <--added this line – J Rowoldt Oct 11 '16 at 17:35