Attention: Here be dragons

This is thelatest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Checking the stable version of the documentation...

Creating movies

Godot can recordnon-real-time video and audio from any 2D or 3D project.This kind of recording is also calledoffline rendering.There are many scenarios where this is useful:

  • Recording game trailers for promotional use.

  • Recording cutscenes that will bedisplayed as pre-recorded videosin 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 interactionremains 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 techniquesin 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 and3D animations (and still images).

If you are already used to Godot's workflow, you may find yourself moreproductive by using Godot for video rendering compared to Blender. That said,renderers designed for non-real-time usage such as Cycles and Eevee can resultin 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) regardlessof your hardware's capabilities. The output video willalways have perfectframe pacing; it will never exhibit dropped frames or stuttering.Faster hardware will allow you to render a given animation in less time, butthe visual output remains identical.

  • Render at a higher resolution than the screen resolution, without having torely on driver-specific tools such as NVIDIA's Dynamic Super Resolution orAMD's Virtual Super Resolution.

  • Render at a higher framerate than the video's target framerate, thenpost-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 likeOBS Studio orSimpleScreenRecorderto record gameplay videos, as they do a much better job at intercepting thecompositor 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-rightcorner of the editorbefore running the project:

Movie Maker mode is disabled, click the "movie reel" icon to enable

Movie Maker mode is disabled, click the "movie reel" icon to enable

A menu will be displayed with options to enable Movie Maker mode and to go tothe settings. The icon gets a background matching the accent color when MovieMaker mode is enabled:

Movie Maker mode is enabled, click the "movie reel" icon again to disable

Movie Maker mode is enabled, click the "movie reel" icon again to disable

Movie Maker status isnot persisted when the editor quits, so you mustre-enable Movie Maker mode again after restarting the editor if needed.

Note

Toggling Movie Maker mode while running the project will not have anyeffect until the project is restarted.

Before you can record video by running the project, you still need to configurethe output file path. This path can be set for all scenes in the Project Settings:

Movie Maker project settings (with Advanced toggle enabled)

Movie Maker project settings (with Advanced toggle enabled)

Alternatively, you can set the output file path on a per-scene basis by adding aString metadata with the namemovie_file to the scene'sroot node. Thisis only used when the main scene is set to the scene in question, or whenrunning the scene directly by pressingF6 (Cmd+R on macOS).

Inspector view after creating a ``movie_file`` metadata of type String

Inspector view after creating amovie_file metadata of type String

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 usedwhen running the project from the editor.

Command line usage

Movie Maker can also be enabled from thecommand line:

godot--path/path/to/your_project--write-movieoutput.avi

If the output path is relative, then it isrelative to the project folder,not the current working directory. In the above example, the file will bewritten to/path/to/your_project/output.avi. This behavior is similar to the--export-release command line argument.

Since Movie Maker's output resolution is set by the viewport size, you canadjust the window size on startup to override it if the project uses thedisabled orcanvas_itemsstretch mode:

godot--path/path/to/your_project--write-movieoutput.avi--resolution1280x720

Note that the window size is clamped by your display's resolution. SeeRendering at a higher resolution than the screen resolution if you need to recorda 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-movieoutput.avi--fixed-fps30

Note

The--write-movie and--fixed-fps command line arguments are both availablein exported projects. Movie Maker mode cannot be toggled while the project is running,but you can use theOS.execute() method torun a second instance of the exported project that will record a video file.

Choosing an output format

Output formats are provided by theMovieWriter class.Godot has 3 built-inMovieWriters, and more can beimplemented by extensions:

OGV (recommended)

OGV container with Theora for video and Vorbis for audio. Features lossy videoand audio compression with a good balance of file size and encoding speed, witha better image quality than MJPEG. It has 4 speed levels that can be adjustedby changingEditor > Movie Writer > Encoding Speed with the fastest onebeing around as fast as AVI with better compression. At slower speed levels, itcan compress even better while keeping the same image quality. The lossycompression quality can be adjusted by changingEditor > Movie Writer > VideoQuality for video andEditor > Movie Writer > Audio Quality for audio.

The Keyframe Interval can be adjusted by changingEditor > Movie Writer >Keyframe Interval. In some cases, increasing this setting can improvecompression efficiency without downsides.

The resulting file can be viewed in Godot withVideoStreamPlayer and most video players but not web browsers. OGVdoes not support transparency.

To use OGV, specify a path to a.ogv file to be created in theEditor >Movie Writer > Movie File project setting.

Note

OGV can only be recorded in editor builds.On the other hand,OGV playbackis possible in both editor and export template builds.

AVI

AVI container with MJPEG for video and uncompressed audio. Features lossy videocompression, resulting in medium file sizes and fast encoding. The lossycompression quality can be adjusted by changingEditor > Movie Writer > Video Quality.

The resulting file can be viewed in most video players, but it must be convertedto another format for viewing on the web or by Godot with the VideoStreamPlayernode. MJPEG does not support transparency. AVI output is currently limited to afile of 4 GB in size at most.

To use AVI, specify a path to a.avi file to be created in theEditor > Movie Writer > Movie File project setting.

PNG

PNG image sequence for video and WAV for audio. Features lossless videocompression, at the cost of large file sizes and slow encoding. This is designedto beencoded to a video file with an external tool after recording.

Transparency is supported, but the root viewportmust have itstransparent_bg property set totrue for transparency to be visible onthe output image. This can be achieved by enabling theRendering > TransparentBackground advanced project setting.Display > Window > Size > TransparentandDisplay > Window > Per Pixel Transparency > Enabled can optionally beenabled to allow transparency to be previewed while recording the video, butthey do not have to be enabled for the output image to contain transparency.

To use PNG, specify a.png file to be created in theEditor > Movie Writer > Movie File project setting. The generated.wavfile 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 throughthird-party software, you can extend the MovieWriter class to create your ownmovie writers. This should typically be done using GDExtension for performancereasons.

Configuration

In theEditor > Movie Writer section of the Project Settings, there areseveral options you can configure. Some of them are only visible after enablingtheAdvanced 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 writinga movie. This can be different from the project's mix rate, but thisvalue must be divisible by the recorded FPS to prevent audio fromdesynchronizing over time.

  • Speaker Mode: The speaker mode to use in the recorded audio when writinga movie (stereo, 5.1 surround or 7.1 surround).

  • Video Quality: The image quality to use when writing a video to an OGV orAVI file, between0.01 and1.0 (inclusive). Higher quality values resultin better-looking output at the cost of larger file sizes. Recommended qualityvalues are between0.75 and0.9. Even at quality1.0, compressionremains lossy. This setting does not affect audio quality and is ignored whenwriting to a PNG image sequence.

  • Movie File: The output path for the movie. This can be absolute orrelative to the project root.

  • Disable V-Sync: If enabled, requests V-Sync to be disabled when writing amovie. This can speed up video writing if the hardware is fast enough torender, encode and save the video at a framerate higher than the monitor'srefresh rate. This setting has no effect if the operating system or graphicsdriver forces V-Sync with no way for applications to disable it.

  • FPS: The rendered frames per second in the output movie. Higher valuesresult in smoother animation, at the cost of longer rendering times and largeroutput file sizes. Most video hosting platforms do not support FPS valueshigher than 60, but you can use a higher value and use that to generate motionblur.

  • Audio Quality: The audio quality to use when writing a video to an OGVfile, between-0.1 and1.0 (inclusive). Higher quality values resultin better audio quality at the cost of very slightly larger file sizes.Recommended quality values are between0.3 and0.5. Even at quality1.0, compression remains lossy.

  • Encoding Speed: The speed level to use when writing a video to an OGVfile. Faster speed levels have less compression efficiency. The image qualitystays barely the same.

  • Keyframe Interval: Also known as GOP (Group Of Pictures), the maximumnumber of inter-frames to use when writing to an OGV file. Higher values canimprove compression efficiency without quality loss but at the cost of slowervideo seeks.

Note

When using thedisabled or2dstretch modes,the output file's resolution is set by the window size. Make sure to resizethe windowbefore the splash screen has ended. For this purpose, it'srecommended to adjust theDisplay > Window > Size > Window Width Override andWindow Height Override advanced project settings.

See alsoRendering at a higher resolution than the screen resolution.

Quitting Movie Maker mode

To safely quit a project that is using Movie Maker mode, use the X button at thetop of the window, or callget_tree().quit() in a script. You can also usethe--quit-afterN command line argument whereN is the number of framesto render before quitting.

PressingF8 (Cmd+. on macOS) or pressingCtrl+C on theterminal running Godot isnot recommended, as it will result in animproperly formatted AVI file with no duration information. For PNG imagesequences, PNG images will not be negatively altered, but the associated WAVfile will still lack duration information. OGV files might end up with slightlydifferent duration video and audio tracks but still valid.

Some video players may still be able to play the AVI or WAV file with workingvideo and audio. However, software that makes use of the AVI or WAV file such asvideo editors may not be able to open the file.Using a video converter programcan help in those cases.

If you're using an AnimationPlayer to control a "main action" in the scene (suchas camera movement), you can enable theMovie Quit On Finish property on theAnimationPlayer node in question. When enabled, this property will make Godotquit on its own when an animation is done playingand the engine is running inMovie Maker mode. Note thatthis property has no effect on looping animations.Therefore, you need to make sure that the animation is set as non-looping.

Using high-quality graphics settings

Themoviefeature tag can be used to overridespecific project settings. This is useful to enable high-quality graphics settingsthat wouldn't be fast enough to run in real-time speeds on your hardware.Remember that putting every setting to its maximum value can still slow downmovie saving speed, especially when recording at higher resolutions. Therefore,it's still recommended to only increase graphics settings if they make a meaningfuldifference in the output image.

This feature tag can also be queried in a script to increase quality settingsthat are set in the Environment resource. For example, to further improve SDFGIdetail and reduce light leaking:

extendsNode3Dfunc_ready():ifOS.has_feature("movie"):# When recording a movie, improve SDFGI cell density# without decreasing its maximum distance.get_viewport().world_3d.environment.sdfgi_min_cell_size*=0.25get_viewport().world_3d.environment.sdfgi_cascades=8

Rendering at a higher resolution than the screen resolution

The overall rendering quality can be improved significantly by rendering at highresolutions such as 4K or 8K.

Note

For 3D rendering, Godot provides aRendering > Scaling 3D > Scaleadvanced project setting, which can be set above1.0 to obtainsupersample antialiasing. The 3D rendering is thendownsampled when it'sdrawn on the viewport. This provides an expensive but high-quality form ofantialiasing, without increasing the final output resolution.

Consider using this project setting first, as it avoids slowing down moviewriting speeds and increasing output file size compared to actuallyincreasing the output resolution.

If you wish to render 2D at a higher resolution, or if you actually need thehigher raw pixel output for 3D rendering, you can increase the resolution abovewhat the screen allows.

By default, Godot uses thedisabledstretch modesin projects. If usingdisabled orcanvas_items stretch mode,the window size dictates the output video resolution.

On the other hand, if the project is configured to use theviewport stretchmode, the viewport resolution dictates the output video resolution. The viewportresolution is set using theDisplay > Window > Size > Viewport Width andViewport Height project settings. This can be used to render a video at ahigher resolution than the screen resolution.

To make the window smaller during recording without affecting the output videoresolution, you can set theDisplay > Window > Size > Window Width OverrideandWindow Height Override advanced project settings to values greater than0.

To apply a resolution override only when recording a movie, you can overridethose settings with themoviefeature tag.

Post-processing steps

Some common post-processing steps are listed below.

Note

When using several post-processing steps, try to perform all of them in asingle FFmpeg command. This will save encoding time and improve quality byavoiding multiple lossy encoding steps.

Converting OGV/AVI video to MP4

While some platforms such as YouTube support uploading the AVI file directly, manyothers will require a conversion step beforehand.HandBrake(GUI) andFFmpeg (CLI) are popular open source toolsfor this purpose. FFmpeg has a steeper learning curve, but it's more powerful.

The command below converts an OGV/AVI video to an MP4 (H.264) video with aConstant Rate Factor (CRF) of 15. This results in a relatively large file, butis well-suited for platforms that will re-encode your videos to reduce theirsize (such as most video sharing websites):

ffmpeg-iinput.avi-crf15output.mp4

To get a smaller file at the cost of quality,increase the CRF value in theabove command.

To get a file with a better size/quality ratio (at the cost of slower encodingtimes), add-presetveryslow before-crf15 in the above command. On thecontrary,-presetveryfast can be used to achieve faster encoding at thecost of a worse size/quality ratio.

Converting PNG image sequence + WAV audio to a video

If you chose to record a PNG image sequence with a WAV file beside it,you need to convert it to a video before you can use it elsewhere.

The filename for the PNG image sequence generated by Godot always contains 8digits, starting at 0 with zero-padded numbers. If you specify an outputpathfolder/example.png, Godot will writefolder/example00000000.png,folder/example00000001.png, and so on in that folder. The audio will be savedatfolder/example.wav.

The FPS is specified using the-r argument. It should match the FPSspecified during recording. Otherwise, the video will appear to be slowed downor sped up, and audio will be out of sync with the video.

ffmpeg-r60-iinput%08d.png-iinput.wav-crf15output.mp4

If you recorded a PNG image sequence with transparency enabled, you need to usea video format that supports storing transparency. MP4/H.264 doesn't supportstoring transparency, so you can use WebM/VP9 as an alternative:

ffmpeg-r60-iinput%08d.png-iinput.wav-c:vlibvpx-vp9-crf15-pix_fmtyuva420poutput.webm

Cutting video

You can trim parts of the video you don't want to keep after the video isrecorded. For example, to discard everything before 12.1 seconds and keeponly 5.2 seconds of video after that point:

ffmpeg-iinput.avi-ss00:00:12.10-t00:00:05.20-crf15output.mp4

Cutting videos can also be done with the GUI toolLosslessCut.

Resizing video

The following command resizes a video to be 1080 pixels tall (1080p),while preserving its existing aspect ratio:

ffmpeg-iinput.avi-vf"scale=-1:1080"-crf15output.mp4

Reducing framerate

The following command changes a video's framerate to 30 FPS, dropping some ofthe original frames if there are more in the input video:

ffmpeg-iinput.avi-r30-crf15output.mp4

Generating accumulation motion blur with FFmpeg

Godot does not have built-in support for motion blur, but it can still becreated in recorded videos.

If you record the video at a multiple of the original framerate, you can blendthe frames together then reduce the frameate to produce a video withaccumulation motion blur. This motion blur can look very good, but it can takea long time to generate since you have to render many more frames per second (ontop of the time spent on post-processing).

Example with a 240 FPS source video, generating 4× motion blur and decreasingits output framerate to 60 FPS:

ffmpeg-iinput.avi-vf"tmix=frames=4, fps=60"-crf15output.mp4

This also makes effects that converge over several frames (such as temporalantialiasing, SDFGI and volumetric fog) converge faster and therefore lookbetter, since they'll be able to work with more data at a given time.SeeReducing framerate if you want to get this benefitwithout adding motion blur.


User-contributed notes

Please read theUser-contributed notes policy before submitting a comment.