Command line interface

svgsequencevideo exposes four subcommands: render and video for the two steps of the generation, plus inspect and init as helpers. There is no single command running both render and video: a render is expensive and done once, while video is cheap and tuned repeatedly, so combining them would not match the actual workflow (see Overview).

Every option can also be set in a TOML configuration file passed with --config; any option given on the command line overrides the value from that file.

(venv) $ svgsequencevideo --help

render

Reads an SVG file and exports one PNG frame per revealed element into --output-dir, together with a metadata.json describing the drawing (used by video and inspect). This is the long-running step.

# Render at the SVG own size
(venv) $ svgsequencevideo render drawing.svg

# Render at a specific width, height inferred to keep the aspect ratio
(venv) $ svgsequencevideo render drawing.svg --width 1920 --output-dir build/

# Resume a render that was interrupted, only missing frames are regenerated
(venv) $ svgsequencevideo render drawing.svg --resume

svgsequencevideo render

 svgsequencevideo render Usage: svgsequencevideo render [OPTIONS] {input} Generate image frames and metadata from an SVG file. ╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────╮ *input<path>Input SVG file[required] ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮ --config<path>TOML config file. --verbose-vEnable debug logging --output-dir<path>Output folder for the generated metadata and frames. [default: output]                                    --width<int>Width of the generated frames. By default the page width or     infered from height.                                            --height<int>Height of the generated frames. By default the page height or   infered from width.                                             --inkscape-path<path>Inkscape executable filepath. By default inkscape in PATH or    one of the usual filepaths.                                     --forceOverwrite any existing output (metadata, frames, temporary SVG) already present in the output folder.                           --resumeResume a previously interrupted render, regenerating only the   missing frames. Cannot be used with --force.                    --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

video

Builds the .mp4 reveal video from the frames and metadata produced by a previous render. This is the step you will run again and again while adjusting timing and reveal order, it does not touch the frames.

The reveal order/duration of each element is controlled by --heuristic (equal, area or complex, see svgsequencevideo.Heuristic for writing a custom one) and can be fine-tuned per element with --weight, repeated as many times as needed. A weight applies to a named Inkscape layer/object label, or to a raw SVG id when prefixed with id:.

# Default heuristic and timings
(venv) $ svgsequencevideo video

# Slower reveal, a layer revealed twice as fast, an id revealed 3x as fast
(venv) $ svgsequencevideo video --revealduration 30 --weight "Foreground=2" --weight "id:path1234=3"

svgsequencevideo video

 svgsequencevideo video Usage: svgsequencevideo video [OPTIONS] Build a reveal video from rendered frames and metadata. ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮ --config<path>TOML config file. --verbose-vEnable debug logging --cache-dir<path>Output folder of the render containing     generated frames and metadata. By default  the same as the render config.             --output-file<path>Output video filepath. [default: output.mp4]  --heuristic<equal|area|complex>Built-in heuristic used to compute reveal  times.                                     [default: complex]                         --weight<str>Adjust reveal weight of a named            layer/object or SVG id. Prefix ids with    'id:'. Examples: 'Foreground=2', 'Left     Eye=0.5', 'id:path1234=3'.                 --reveal-duration<float>Duration in seconds of the reveal of the   objects.                                   [default: 20.0]                            --final-frame-duration<float>Duration in seconds of the final frame. [default: 5.0]                          --background-color<str>Background color of the video. [default: #d5d5d5]             --ffmpeg-path<path>Inkscape executable filepath. By default   ffmpeg in PATH or one of the usual         filepaths.                                 --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

Heuristics

The three built-in heuristics decide, for every element, how big a share of the reveal duration it gets. Same drawing, same options, only the heuristic changes:

Equal

Every element gets the same reveal time, regardless of its size or how many shapes it groups. Best when every shape carries roughly the same visual weight.

Area

Reveal time is proportional to the visible area of the element: large shapes stay longer before the next element appears, small details flash by quickly.

Complex

The default. Balances object count and area on a logarithmic scale, so neither a handful of huge shapes nor a swarm of tiny ones dominates the timing. Gives the most natural-looking reveal in most cases.

Note

When used in the heuristic to compute the reveal time of each element, the computation of the area of an element does not take into account clipping.

inspect

Prints the element count, size and computed reveal order/timing, either for an SVG file passed directly, or, if no file is given, for the metadata of a previous render found in --cache-dir/--output-dir. Nothing is ever written to disk, so it is the safe way to preview how --heuristic and --weight will behave before running render or video.

# Preview an SVG directly, without rendering it, only showing elements with an Inkscape label
(venv) $ svgsequencevideo inspect drawing.svg --labels-only

# Preview the reveal order that `video` would currently produce
(venv) $ svgsequencevideo inspect --heuristic area

svgsequencevideo inspect

 svgsequencevideo inspect Usage: svgsequencevideo inspect [OPTIONS] [input] Show element count, size, and reveal order for an SVG file or a previous render. Read-only:  nothing is written to disk. ╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────╮ input<path>Input SVG file to analyze directly. If omitted, reads metadata from a       previous render instead (see --cacheDir/--outputDir).                       ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮ --config<path>TOML config file. --labels-onlyOnly show elements with a label. --verbose-vEnable debug logging --output-dir<path>Output folder for the generated metadata and        frames.                                             [default: output]                                   --width<int>Width of the generated frames. By default the page  width or infered from height.                       --height<int>Height of the generated frames. By default the page height or infered from width.                       --cache-dir<path>Output folder of the render containing generated    frames and metadata. By default the same as the     render config.                                      --heuristic<equal|area|complex>Built-in heuristic used to compute reveal times. [default: complex]                               --weight<str>Adjust reveal weight of a named layer/object or SVG id. Prefix ids with 'id:'. Examples:                'Foreground=2', 'Left Eye=0.5', 'id:path1234=3'.    --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

init

Writes a default TOML configuration file, documenting every render and video option, to fill in and pass to --config.

(venv) $ svgsequencevideo init --config svgsequencevideo.toml

svgsequencevideo init

 svgsequencevideo init Usage: svgsequencevideo init [OPTIONS] Generate a default TOML configuration. ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮ --config<path>Configuration file to generate.[default: svgsequencevideo.toml] --forceOverwrite the config file. --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯