Getting started

From nothing to a rendered video, on macOS or Linux (Windows through WSL). nippo's renderer is native code: releases carry it prebuilt for macOS (Apple silicon and Intel) and Linux (x86_64 and arm64), and hd fetch downloads the one for your machine. On any other machine you build it once from nippo's source.

1. Prerequisites

Tool Why Install
hd 0.0.10 or later compiles and runs the project; downloads the renderer curl -fsSL https://raw.githubusercontent.com/HerringtonDarkholme/hd-lang/main/install.sh | sh, then add the folder it prints to your PATH
ffmpeg and ffprobe encode the movie; read footage brew install ffmpeg, or apt install ffmpeg
git hd fetches dependencies with it xcode-select --install, or your package manager
Rust, only off those platforms builds the renderer where no release carries one curl https://sh.rustup.rs -sSf | sh; on Linux also apt install libfontconfig1-dev pkg-config
a GPU wgpu supports the renderer draws with Metal, Vulkan or DX12 on Linux, your GPU's Vulkan driver

On those four platforms you don't need Rust: each release attaches its renderers as downloads, one per target, with a SHA256SUMS file, and hd fetch downloads the one for your machine. (To build hd itself from source instead: cargo install --locked --git https://github.com/HerringtonDarkholme/hd-lang hd-lang.)

2. Create a project

On macOS and Linux (arm64 and x86_64):

hd new -t HerringtonDarkholme/nippo-starter my-video
cd my-video
hd fetch      # nippo, and its renderer for this machine
hd test

hd new -t copies nippo-starter into my-video. hd fetch downloads nippo and the renderer built for this machine from nippo's release, and checks it against the hash the starter's hd.sum holds for it: a renderer that doesn't match is refused, even if the release changes. Commit hd.sum. A cached renderer needs no network.

On another platform

No release carries a renderer for it, so build one from nippo's source, and make the project depend on that copy of nippo. You need Rust, and on Linux apt install libfontconfig1-dev pkg-config. TRIPLE is this machine's target, from rustc -vV; the library is libhd_motion.so on Linux and other Unix systems, and hd_motion.dll on Windows.

hd new -t HerringtonDarkholme/nippo-starter my-video
git clone --depth 1 --branch v0.2.0 https://github.com/HerringtonDarkholme/nippo
cd nippo
hd build                              # writes the header the renderer compiles against
(cd native/provider && cargo build --release)
mkdir -p native/TRIPLE && cp native/provider/target/release/libhd_motion.so native/TRIPLE/
cd ../my-video
hd remove nippo
hd add ../nippo                       # depend on the copy that has the renderer
hd test

hd loads the renderer from nippo/native/TRIPLE/, and a path dependency never downloads. One copy of nippo can serve several projects.

3. Render

hd run --release -- render hello --out hello.mp4

The first run compiles nippo, which takes a few seconds; later runs reuse it. The output is a 5-second, 1080p, 30 fps H.264 file. Other commands:

hd run --release -- list                                   # the projects in this package
hd run --release -- check hello                            # layout and shader checks; silent when all pass
hd run --release -- still hello --at 2500 --out frame.png  # one frame, at 2.5 s
hd run --release -- sheet hello --out sheet.png            # a contact sheet, a frame a second
hd run --release -- deliver hello --out hello.mp4          # render, then check the file
hd run --release -- render hello --codec prores            # also hevc, h264-hw, hevc-hw, vp9

4. What is in the starter

my-video/
  hd.toml          the package: its grants and its nippo dependency
  hd.sum           the recorded hashes of nippo and its renderer; commit it
  src/main.hd      the command line: nippo's commands over this package's projects
  src/hello.hd     the video, its project and its tests
  fonts/           Figtree, the font the video's text names, and its license
  AGENTS.md        how an AI agent should work here
  .github/         CI: hd check and hd test on every push

Your own images, sound, footage and drawings

Like fonts, they are files of your package, read once while the video is prepared, by paths relative to the folder you run hd in. Prepare them in the project's build, then use them in the scene:

fn build!() -> Result[List[Video], PrepareError] $ Preparing:
    logo := prepare_image!("assets/logo.png")?      # PNG or JPEG
    music := audio_file!("assets/music.mp3")?       # anything ffmpeg reads: MP3, WAV, M4A, FLAC, Ogg
    clip := prepare_footage!("assets/clip.mp4")?    # a video file, with its sound
    shape := prepare_svg!("assets/shape.svg")?      # an SVG drawing
    video := Video::new(Target::landscape_1080p(), Rate::new(30, 1), sec(3), hex("#0b1020"), fonts())
        .scene(fn():
            logo.draw(width=480.0)
            clip.play(width=480.0).translate(560.0, 0.0)
            shape.draw(fn(id: string, n: Node) -> Node: n).translate(0.0, 320.0)
        )
        .images([logo])                              # every image the scene draws
        .audio(music)
        .audio(clip.sound().gain_db(-6.0))           # each .audio(...) adds a track to the mix
    .Ok([video])

AudioClip.at(ms(1000)) starts a sound later, and .from(...), .gain_db(...) and .fade_out(...) trim and shape it. Fonts may be .ttf, .otf or .ttc collections. Images other than PNG and JPEG are refused when the video is prepared, naming the file.

Everything a project names comes from dep.nippo, one flat list: use dep.nippo.{Video, text, ...}. src/lib.hd lists it. The examples show the rest of the API: clips and transitions, looks, particles, charts, code, math, footage and sound.

5. When something goes wrong

You see It means Do
native-provider-missing: package nippo has no C provider hd_motion for target TRIPLE the nippo you depend on has no renderer for this machine on macOS and Linux, run hd fetch; elsewhere, build it as in step 2
missing-capability: main requires dep.nippo.native.Gpu ... hd.toml lacks a grant copy the [capabilities] table from the starter
the C provider hd_motion ... was built for another version the renderer and the hd code disagree, usually a checkout rebuilt halfway rebuild the renderer, or use a release
preparing hello: ... fonts/... a font path doesn't exist from where you ran hd run from the project folder, or fix the path in fonts()
ffmpeg not found while rendering the encoder isn't on PATH brew install ffmpeg, or apt install ffmpeg
text drawn in the wrong font text names a family the project didn't load load the font in fonts() and name it with font=

FontSet::bundled() (Inter and JetBrains Mono) and number(...), which always uses Inter, read fonts/ from the current folder. They work inside the nippo repository; in your own package, give your fonts by path as the starter does.

Working from a nippo checkout

To use an unreleased nippo, or to change nippo itself, depend on a checkout: clone nippo without --depth or --branch, build its renderer, and hd add it, as in step 2. After pulling changes under native/, run hd build and the cargo build again, and copy the library over the old one.

This page’s source on GitHub