Creating movies¶
Godot can record non-real-time video and audio from any 2D or 3D project. This kind of recording is also called offline rendering. There are many scenarios where this is useful:
Recording game trailers for promotional use.
Recording cutscenes that will be displayed as pre-recorded videos in the final game. This allows for using higher quality settings (at the cost of file size), regardless of the player's hardware.
Recording procedurally generated animations or motion design. User interaction remains possible during video recording, and audio can be included as well (although you won't be able to hear it while the video is recording).
Comparing the visual output of graphics settings, shaders, or rendering techniques in an animated scene.
With Godot's animation features such as the AnimationPlayer node, Tweeners, particles and shaders, it can effectively be used to create any kind of 2D and 3D animations (and still images).
If you are already used to Godot's workflow, you may find yourself more productive by using Godot for video rendering compared to Blender. That said, renderers designed for non-real-time usage such as Cycles and Eevee can result in better visuals (at the cost of longer rendering times).
Compared to real-time video recording, some advantages of non-real-time recording include:
Use any graphics settings (including extremely demanding settings) regardless of your hardware's capabilities. The output video will always have perfect frame pacing; it will never exhibit dropped frames or stuttering. Faster hardware will allow you to render a given animation in less time, but the visual output remains identical.
Render at a higher resolution than the screen resolution, without having to rely on driver-specific tools such as NVIDIA's Dynamic Super Resolution or AMD's Virtual Super Resolution.
Render at a higher framerate than the video's target framerate, then post-process to generate high-quality motion blur. This also makes effects that converge over several frames (such as temporal antialiasing, SDFGI and volumetric fog) look better.
Warning
This feature is not designed for capturing real-time footage during gameplay.
Players should use something like OBS Studio or SimpleScreenRecorder to record gameplay videos, as they do a much better job at intercepting the compositor than Godot can do using Vulkan or OpenGL natively.
That said, if your game runs at near-real-time speeds when capturing, you can still use this feature (but it will lack audible sound playback, as sound is saved directly to the video file).
Enabling Movie Maker mode¶
To enable Movie Maker mode, click the "movie reel" button in the top-right corner of the editor before running the project:
The icon gets a background matching the accent color when Movie Maker mode is enabled:
Movie Maker status is not persisted when the editor quits, so you must re-enable Movie Maker mode again after restarting the editor if needed.
Note
Toggling Movie Maker mode while running the project will not have any effect until the project is restarted.
Before you can record video by running the project, you still need to configure the output file path. This path can be set for all scenes in the Project Settings:
Alternatively, you can set the output file path on a per-scene basis by adding a
String metadata with the name movie_file
to the scene's root node. This
is only used when the main scene is set to the scene in question, or when
running the scene directly by pressing F6 (Cmd + R on macOS).
The path specified in the project settings or metadata can be either absolute, or relative to the project root.
Once you've configured and enabled Movie Maker mode, it will be automatically used when running the project from the editor.
Command line usage¶
Movie Maker can also be enabled from the command line:
godot --path /path/to/your_project --write-movie output.avi
If the output path is relative, then it is relative to the project folder,
not the current working directory. In the above example, the file will be
written to /path/to/your_project/output.avi
. This behavior is similar to the
--export
command line argument.
Since Movie Maker's output resolution is set by the viewport size, you can
adjust the window size on startup to override it if the project uses the
disabled
or canvas_items
stretch mode:
godot --path /path/to/your_project --write-movie output.avi --resolution 1280x720
Note that the window size is clamped by your display's resolution. See Rendering at a higher resolution than the screen resolution if you need to record a video at a higher resolution than the screen resolution.
The recording FPS can also be overridden on the command line, without having to edit the Project Settings:
godot --path /path/to/your_project --write-movie output.avi --fixed-fps 30
Note
The --write-movie
and --fixed-fps
command line arguments are both available
in exported projects. Movie Maker mode cannot be toggled while the project is running,
but you can use the OS.execute() method to
run a second instance of the exported project that will record a video file.
Choosing an output format¶
Output formats are provided by the MovieWriter class. Godot has 2 built-in MovieWriters, and more can be implemented by extensions:
AVI (recommended)¶
AVI container with MJPEG for video and uncompressed audio. Features lossy video compression, resulting in medium file sizes and fast encoding. The lossy compression quality can be adjusted by changing Editor > Movie Writer > MJPEG Quality.
The resulting file can be viewed in most video players, but it must be converted to another format for viewing on the web or by Godot with the VideoStreamPlayer node. MJPEG does not support transparency. AVI output is currently limited to a file of 4 GB in size at most.
To use AVI, specify a path to an .avi
file to be created in the
Editor > Movie Writer > Movie File project setting.
PNG¶
PNG image sequence for video and WAV for audio. Features lossless video compression, at the cost of large file sizes and slow encoding. This is designed to be encoded to a video file with an external tool after recording.
Transparency is supported, but the root viewport must have its
transparent_bg
property set to true
for transparency to be visible on
the output image. This can be achieved by enabling the Rendering > Transparent
Background advanced project setting. Display > Window > Size > Transparent
and Display > Window > Per Pixel Transparency > Enabled can optionally be
enabled to allow transparency to be previewed while recording the video, but
they do not have to be enabled for the output image to contain transparency.
To use PNG, specify a .png
file to be created in the
Editor > Movie Writer > Movie File project setting. The generated .wav
file will have the same name as the .png
file (minus the extension).
Custom¶
If you need to encode directly to a different format or pipe a stream through third-party software, you can extend the MovieWriter class to create your own movie writers. This should typically be done using GDExtension for performance reasons.
Configuration¶
In the Editor > Movie Writer section of the Project Settings, there are several options you can configure. Some of them are only visible after enabling the Advanced toggle in the top-right corner of the Project Settings dialog.
Mix Rate Hz: The audio mix rate to use in the recorded audio when writing a movie. This can be different from the project's mix rate, but this value must be divisible by the recorded FPS to prevent audio from desynchronizing over time.
Speaker Mode: The speaker mode to use in the recorded audio when writing a movie (stereo, 5.1 surround or 7.1 surround).
MJPEG Quality: The JPEG quality to use when writing a video to an AVI file, between
0.01
and1.0
(inclusive). Higher quality values result in better-looking output at the cost of larger file sizes. Recommended quality values are between0.75
and0.9
. Even at quality1.0
, JPEG compression remains lossy. This setting does not affect audio quality and is ignored when writing to a PNG image seq