Skip to content

Exporting

-> DepthFlow supports realtime previews and video exporting.

After creating your Animation (or using a #preset), and sending Inputs images to a scene instance, it's time to run the animation and export them to a shareable video!

Ensure you have FFmpeg installed and available in PATH for video encoding

  • For licensing and size reasons, it cannot be easily distributed, and isn't a hard requirement.
  • Get from your package manager, or put executables in your working directory.

Video

Simply send an output="video.mp4" argument to the scene.main method/command:

scene = MyScene(backend="headless")
scene.main(output="video.mp4")
depthflow main --output video.mp4

✅ Note: See all available options with depthflow main --help, most you already expect:

scene.main(
    output="video.mkv",
    fps=60,
    time=10,
    width=1920,
    height=1080,
    ssaa=1.0,
)

Batch

For exporting multiple videos, you can follow something similar to the batch.py example script, where a scene is reused on many renders over globbing image directories - some notes:

  • Always initialize the scene with a backend=headless for compatibility.
  • Always reset the scene's state before rendering again, as the previous animation ending could leave changes in the camera parameters a second animation doesn't enforce.

Codec

Very large topic, until ShaderFlow documentation is written, you can:

Use your IDE linter to explore the shaderflow.ffmpeg module!

scene = MyScene()
scene.ffmpeg.h264(preset="slow", crf=23)
scene.ffmpeg.h264_nvenc(...)
scene.ffmpeg.h265(...)
scene.main(output="video.mp4")
# See all available codecs
depthflow --help

# See a codec options with
depthflow h264 --help

# Use a codec with settings
depthflow h264 --preset slow --crf 23 main -o video.mp4 (...)

Quality

The main things that affect the final video quality are:

  1. Depthmap precision: DepthFlow is highly sensitive to good relative depths between any two points on the scene, and not object sillhouette precision. Learn more at Inputs/#depth.
  2. SSAA Value: Render at a higher resolution and downscales to output, default being 1.0 (pure). Must only go as high1 as 2 * subsample (default 2), the downscale kernel size, hurts quality otherwise. A value of 2.0 is plenty for final exports.
  3. Resolution: No gains in videos larger than input sources, should at least match it. When using SSAA, zooming, or with large #heights or #offsets, a larger input image has benefits.
  4. Quality parameter: Explained in Camera/#quality.
  5. Image contents: Explained in Inputs/#image.
  6. Encoder settings: Explained in #codec.

Some settings are O(N²) - know your hardware limits!

  • Doubling the resolution is ~4x RAM, CPU usage.
  • Doubling SSAA is exactly 4x GPU usage.

  1. OpenGL driver implementations have a maximum texture size, commonly 16384 or 32768 pixels depending on your GPU. Values above 2.0 may cause crashes for 4k or 8k output videos.