A vidmake project is a JSON file, so you can always edit it directly. For small changes, the edit commands are often quicker and safer, especially for agents: you address a value by layer id instead of by line number, and every edit is compiled before it's saved, so a typo can't break a project that worked.
vidmake get project.json title.fontSize # read a valuevidmake set project.json title.fontSize 96 # write a valuevidmake unset project.json title.enter # delete a field (or a whole layer)vidmake add project.json '{"id": "logo", "type": "image", "src": "logo.svg"}'vidmake rm project.json logo # delete a layer by idThe transcripts on this page come from a copy of the inspecting demo (composition card
with layers panel, title, ring and label).
#Paths
get, set and unset take a path in one of three forms:
| form | example | resolves to |
|---|---|---|
<layerId>.<field>[.<sub>...] | title.fontSize, ring.endAngle.to | a field of the layer with that id, at any depth (inside groups too) |
<compId>.<field>[...] | card.duration, card.props.title | a field of the composition with that id |
| JSON pointer | /compositions/0/fps, /fonts/0/path | exactly that location (RFC 6901) |
- The first segment is looked up as a layer id first, then as a composition id. Layer search is depth-first in file
order, through
childrenof groups, across all compositions. - After the id, each
.segmentis an object key or an array index:title.text.0.fillis thefillof the first span of a rich text layer,bar.repeat.countthe count of a repeat. - A path that starts with
/is a JSON pointer and is used as is. Use it for anything without an id: fonts, layers without anid, or keys containing a dot. The commands print the pointer they resolved, so you can reuse it. - The bare layer id (no field) addresses the whole layer:
get project.json titleprints it,unset project.json titledeletes it.
Warning
Ids are not required to be unique. If two layers share an id, paths and
rmalways pick the first one in the file. Give every layer a distinctid; the copies made byrepeat(bar.0,bar.1) exist only at render time and can't be addressed: edit the original layer.
#get
get prints the value at a path as pretty JSON.
vidmake get project.json title.fontSizevidmake get project.json ring.endAnglevidmake get project.json /compositions/0/fps72{ "from": 0, "to": 360, "duration": "2s", "ease": "easeInOutCubic"}30It reads the file as written, before props and defaults are applied: a field you didn't set is reported as
missing, not as its default (error: `title.shadow` (/compositions/0/layers/1/shadow) not found). For resolved
values at a given time, use inspect.
get works on the source file, so it's safe in scripts and in this documentation:
$ vidmake get inspect-scene.json title
{
"id": "title",
"type": "text",
"text": [
"Every frame, ",
{
"text": "checkable",
"italic": true,
"fontWeight": 400
}
],
"font": "Schibsted Grotesk",
"fontWeight": 860,
"fontSize": 64,
"letterSpacing": -2.8,
"fill": "#161412",
"y": "40%",
"start": "0.6s",
"enter": "pop",
"exit": "fade"
}#set
set <project> <path> <value> writes one value. The value is parsed as JSON when it is valid JSON, and otherwise
taken as a plain string, so quotes are optional for most strings:
vidmake set project.json title.text "Checked before render" # not valid JSON -> the stringvidmake set project.json title.fontSize 64 # a numbervidmake set project.json card.duration 5s # a stringvidmake set project.json title.enter '{"type": "fadeUp", "duration": "0.6s"}'vidmake set project.json /compositions/0/background '"#f4f1ea"'vidmake set project.json panel.shadow.blur 30 # creates "shadow": {"blur": 30}set /compositions/0/layers/1/textset /compositions/0/layers/1/fontSizeset /compositions/0/layers/1/enterset /compositions/0/durationset /compositions/0/backgroundset /compositions/0/layers/0/shadow/blur- Missing objects along the path are created (
panel.shadow.blurabove). - An array index one past the end, or
-in a JSON pointer, appends:set project.json /compositions/0/layers/- '{...}'. - Strings that look like JSON are parsed as JSON.
set title.text 42writes the number 42, which a text layer rejects; write'"42"'(shell quotes around JSON quotes) to get the string. The same goes fortrue,false,nulland anything starting with[or{. - The whole file is rewritten as pretty-printed JSON with 2-space indentation. Key order is kept, but compact
one-line layers are expanded. A file holding a single bare composition is saved in the full
{"compositions": [...]}form.
#Compiled before saving
Before writing, set (and add) compile every composition in the file with its default props, exactly as
validate would. If anything fails, nothing is written and the command exits with status 1:
vidmake set project.json title.fontsize 64error: edit not saved, the project would be invalid: composition `card`: unknown field `fontsize` — did you mean `fontSize`?(use --force to save anyway)vidmake set project.json ring.endAngle '{"from": 0, "to": 360, "duraton": "2s"}'error: edit not saved, the project would be invalid: layer `ring` (card > layers[2]): `endAngle`: tween needs `end` or `duration` (or `spring`): {"from":0,"to":360,"duraton":"2s"}(use --force to save anyway)--force saves anyway and prints the problems as warnings on stderr. Use it when you are mid-way through a
change that takes several edits; validate will keep reporting the error until it is fixed.
warning: layer `ring` (card > layers[2]): `endAngle`: tween needs `end` or `duration` (or `spring`): {"from":0,"to":360,"duraton":"2s"}set /compositions/0/layers/2/endAngleImportant
The check covers the whole project, not just your edit. If the file is already invalid, every
setandaddis refused (the error lists the existing problem) until you fix it, or pass--force. Lint warnings (offCanvasand the like) never block an edit; runvidmake validateto see them.
#unset
unset <project> <path> deletes a field, an array item, or a whole layer (when the path is a bare layer id).
vidmake unset project.json panel.shadowvidmake unset project.json title.exitremoved /compositions/0/layers/0/shadowremoved /compositions/0/layers/1/exitDeleting can make a project invalid (removing a required field, or a layer another layer attaches to). Unlike
set, unset always saves and prints what is now wrong as a warning, so follow it with validate:
warning: layer `title` (card > layers[2]): text layer needs `text`removed /compositions/0/layers/2/text#add
add <project> <layer> inserts one layer (a JSON object) or several (a JSON array). By default it appends them to
the first composition's layers, which puts them on top of everything else.
vidmake add project.json '{"id": "badge", "type": "text", "text": "NEW", "font": "sans-serif", "fontSize": 20, "fill": "#c92a26", "y": "75%", "start": "1.5s", "enter": "fadeUp"}'vidmake add project.json '{"id": "bg", "type": "rect", "fill": "#f4f1ea"}' --index 0added 1 layer(s) at /compositions/0/layers/4added 1 layer(s) at /compositions/0/layers/0| option | effect |
|---|---|
--index <n> | insert at position n (0 = bottom-most); default is the end (top-most). Larger values append |
--parent <groupId> | insert into that group's children (created if missing) instead of the composition |
-c, --comp <id> | insert into that composition's layers (ignored with --parent) |
--force | save even if the result doesn't compile |
The layer argument can also be @file.json (a file path relative to the current directory, not the project) or
- to read from stdin, which avoids shell quoting for longer layers:
[ { "id": "dot-a", "type": "ellipse", "width": 12, "x": "20%", "fill": "#1f5fb0" }, { "id": "dot-b", "type": "ellipse", "width": 12, "x": "80%", "fill": "#c92a26" }]vidmake add project.json @dots.jsonecho '{"id": "stamp", "type": "star", "width": 40, "fill": "#4a4640"}' | vidmake add project.json -vidmake add project.json '{"id": "group", "type": "group", "children": []}'vidmake add project.json '{"id": "inner", "type": "rect", "width": 10, "height": 10}' --parent groupadded 2 layer(s) at /compositions/0/layers/6added 1 layer(s) at /compositions/0/layers/8added 1 layer(s) at /compositions/0/layers/9added 1 layer(s) at /compositions/0/layers/9/children/0Like set, add compiles the result first. The errors you will meet:
error: edit not saved, the project would be invalid: composition `card`: unknown field `widht` — did you mean `width`?(use --force to save anyway)error: no composition `nope`error: no group `nope`--parent accepts any layer id; adding children to a layer that isn't a group is caught by the compile check
(field(s) children do not apply to `rect` layers).
#rm
rm <project> <layerId> deletes the first layer with that id, wherever it is, including its children.
vidmake rm project.json stampremoved layer stamp (/compositions/0/layers/8)A missing id fails with error: no layer `stamp` . Like unset, rm always saves and reports any resulting
problem (for example a sibling that attached to the removed layer) as a warning.
#Exit codes
| result | exit status |
|---|---|
| saved | 0 (warnings, if any, on stderr) |
| refused by the compile check, unknown id or path, invalid JSON argument | 1 |
All messages go to stderr, the success line (set ..., added ..., removed ...) to stdout. See the
CLI page for the other commands.
#Workflow
For agents
For a small change,
setis cheaper and safer than rewriting the file: one command, a precise path, and a compile check. Then look at the result (vidmake still project.json -t <time>or a storyboard) before moving on. For larger restructuring (new scenes, reordering many layers) edit the JSON directly and runvidmake validate.
A typical session:
vidmake inspect project.json -t 2s -l title # title is 40px too lowvidmake set project.json title.y '"38%"'vidmake still project.json -t 2s -o check.png # look at itvidmake set project.json title.enter popvidmake trace project.json -l title --every 2 --to 1.5sRelated: validate and lint, inspecting, the JSON Schema for editor completion.