Sub topic 13
Rendering from the Command Line
Prerequisites and the command-line workflow
This chapter assumes that you can navigate Blender, have a saved scene with a camera, and can run commands in a terminal. You should also understand the scene's frame range and output settings.
Command-line rendering runs Blender without opening its normal interface. This is useful for repeatable renders, long jobs, and render machines. The usual workflow is:
- Save and check the
.blendfile. - Choose an output directory and filename pattern.
- Run Blender in background mode.
- Check the terminal output and inspect the generated files.
Render one still image
The -b option starts Blender in background mode. The -o option sets the output path. The -F option selects the file format, and -x 1 adds the file extension. The -f option renders one frame.
blender -b scene.blend -o //renders/still_#### -F PNG -x 1 -f 1This command renders frame 1 from the scene's active camera. The #### characters reserve four digits for the frame number, so the result is typically named still_0001.png.
The // prefix means “relative to the directory containing the blend file.” It makes a project easier to move between computers. You can also use an absolute path, such as /home/user/project/renders/still_####.
Render an image sequence
For animation, an image sequence is usually safer than writing directly to a video. If one frame fails, you can render that frame again without repeating the entire animation.
blender -b scene.blend -o //renders/frame_#### -F PNG -x 1 -s 1 -e 48 -aHere, -s 1 sets the start frame, -e 48 sets the end frame, and -a renders the animation. The output contains frames 1 through 48.
The output option must identify separate files. Do not use a fixed filename such as frame.png, because every frame would overwrite the previous one.
Render video from the command line
To render directly to video, configure the scene's Output properties first. Set the file format to FFmpeg video, then choose the container, codec, and quality. Save the blend file with those settings.
Then run:
blender -b scene.blend -o //renders/clip_ -s 1 -e 120 -aBlender uses the saved FFmpeg settings and writes the animation to the configured path. Direct video output is convenient, but a sequence gives better recovery and makes it easier to change encoding later.
Check failures
If Blender renders a black or empty image, verify the active camera, camera position, visibility, lights, and render engine in the saved file. If frames are missing, check the start and end values and look for errors in the terminal. If the output is in the wrong folder, inspect whether the path is relative to the blend file.
Exercise
Which command renders frames 1 through 48 as numbered PNG files without opening Blender's interface?
Show answer
blender -b scene.blend -o //renders/frame_#### -F PNG -x 1 -s 1 -e 48 -a