Skip to content

Your first render

Create a three-second video with a rounded rectangle on a dark background. The example uses generated shapes, so it needs no images, fonts or audio files.

Expected output: a three-second video of a static rectangle at 640 × 360 pixels, with no audio.

Complete installation first, including the import check. The script uses the CPU backend, so it does not require a GPU.

1. Save the script

Save this example as first_render.py in your Python project, or download the script.

first_render.py
"""A static version of the README quickstart; no external assets required."""

from vestra import Project
from vestra.sources import Color, Rectangle

project = Project(
    size=(640, 360),
    fps=30,
    duration=3,
)

project.root.add(Color("#101c24"))

card = project.root.add(
    Rectangle(width=180, height=140, corner_radius=16, fill="#b8e3bc")
)

card.transform.position = (0.25, 0.5)


if __name__ == "__main__":
    project.render("first-render.mp4", backend="cpu", overwrite=True)

2. Render the video

From the directory containing your script:

uv run python first_render.py

Open first-render.mp4 in the current directory with an MP4-capable video player. It should show the rectangle above for three seconds at 30 frames per second, with no audio.

Rerunning the script replaces first-render.mp4 because it uses overwrite=True. Change the output filename to keep the earlier render.

If the render fails, check installation and rendering troubleshooting.

3. Understand the composition

Part What it does
Project(...) Defines a 640 × 360 pixel canvas, 30 fps and a three-second duration.
Color("#101c24") Describes a solid-colour source that fills the canvas.
Rectangle(...) Describes a 180 × 140 pixel shape with rounded corners and a mint fill.
project.root.add(...) Places a copy of a source in the root composition and returns its layer.
project.render("first-render.mp4", ...) Renders the project and saves it as an MP4.

Both layers inherit the project's three-second duration. The background stays fixed, and card is the rectangle layer you can reposition or animate. For larger compositions, use explicit z values when overlapping layers need a particular drawing order: higher values are drawn on top.

Sizes and positions

The canvas and rectangle dimensions use pixels. A layer's position uses the composition's normalized coordinates:

A canvas with top-left at 0,0, centre at 0.5,0.5, and bottom-right at 1,1. The x axis points right and y points down.

  • (0, 0) is the top-left corner; (1, 1) is the bottom-right.
  • (0.25, 0.5) puts the rectangle 25% across and halfway down the canvas. On this canvas, that is 160 pixels from the left and 180 pixels from the top.
  • The default anchor is the centre of the source, so these coordinates place the rectangle's centre rather than its top-left corner.

card.transform.position = (0.25, 0.5) sets a static position for the whole layer. Changing that property does not change the rectangle's dimensions.

Change the position

Set the position to (0.75, 0.5) and render again. The rectangle should now sit on the right, at x = 480 pixels. In the next tutorial, keyframes move it between these two positions during one video.

Continue to your first animation

For more about placement, see sources and layers. To save an animation, a still image, or a sequence of frames, see exporting from Python.