Sub topic 11
Rendering Straight to Video with FFmpeg
This chapter assumes you can set Blender’s active camera, choose an output folder, and create a basic animation with keyframes. You should also understand the frame range and frame rate in the Output properties.
How direct video rendering works
Blender renders each frame, then sends the frames to FFmpeg. FFmpeg is the library Blender uses to encode video. The result is one video file instead of a folder of separate images.
The output has three important parts:
| Setting | What it controls | Example |
|---|---|---|
| Container | The file wrapper | MPEG-4 |
| Codec | How video data is compressed | H.264 |
| Quality | The compression level | Medium |
A common delivery choice is an MPEG-4 container with the H.264 codec. This combination produces an .mp4 file that most players and web platforms support.
Configure the Output properties
Open the Output Properties and set the following values:
- Set the resolution and percentage.
- Set the frame rate, such as 24 or 30 fps.
- Set the frame start and end.
- Set the output folder and file name.
- Set File Format to FFmpeg Video.
- Choose MPEG-4 as the container.
- Choose H.264 as the video codec.
- Choose a quality value such as Medium.
- Disable audio if the scene has no sound.
The frame rate changes the playback duration. For example, 120 frames at 24 fps produces a five-second video. The same 120 frames at 30 fps produces a four-second video.
Direct video output is convenient, but it is less resilient than an image sequence. If encoding fails at frame 97, you may need to repeat the render. An image sequence lets you keep completed frames and encode them later.
Render an animation to an MP4 file
The following script configures a 120-frame render and writes an H.264 video. Run it in Blender’s Scripting workspace or from Blender’s Python console.
import os
import bpy
scene = bpy.context.scene
scene.frame_start = 1
scene.frame_end = 120
scene.render.fps = 24
scene.render.resolution_x = 1920
scene.render.resolution_y = 1080
scene.render.resolution_percentage = 100
scene.render.image_settings.file_format = "FFMPEG"
scene.render.ffmpeg.format = "MPEG4"
scene.render.ffmpeg.codec = "H264"
scene.render.ffmpeg.constant_rate_factor = "MEDIUM"
scene.render.ffmpeg.audio_codec = "NONE"
output_dir = bpy.path.abspath("//renders")
os.makedirs(output_dir, exist_ok=True)
scene.render.filepath = "//renders/clip"
bpy.ops.render.render(animation=True)The constant_rate_factor value controls the quality and file size. Higher quality usually requires more storage. Lower quality produces a smaller file but can introduce blockiness, banding, or blurred detail. Render a short section first before committing to a long animation.
Common failure modes
- A video has the wrong duration when the frame rate does not match the intended playback rate.
- A file is unexpectedly large when the quality is too high or the resolution is excessive.
- A render has no visible animation when the active camera or animated object is different from the one you inspected.
- A video contains no sound when audio is disabled or no sound strips are present.
- An existing file disappears when the output path and name were reused.
Exercise
You need a five-second animation at 24 fps with broadly compatible playback. Which frame range and video settings should you choose?
Show answer
Use 120 frames, set the frame rate to 24 fps, choose FFmpeg Video with an MPEG-4 container, use the H.264 codec, and select a quality level appropriate for the target file size.