Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions content/en/vector-video.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: "Vector video vs codecs"
weight: 17
---

# Vector video vs codecs {#vector-video}

Can a video be turned into vector paths and beat a codec? For one kind of content
perhaps; for camera video, no. This page gives the measured figures from the study, and
[`go-avkit/vectorbench`](https://github.com/go-avkit/vectorbench) (v0.1.0) is the tool
that repeats the measurement with pinned versions.

## What was measured {#measured}

Six lossless Xiph.org clips, the first 24 frames of each at native resolution. Raster
side: x264 and x265 (`-preset slow`), SVT-AV1 (`-preset 4`), libvpx-vp9. Vector side:
VTracer 0.6.5 run frame by frame, the SVGs rendered back by resvg. Quality is PSNR and
VMAF against the source. Size is the video file, or the sum of the SVGs.

Every figure below is **measured** unless marked otherwise. The study run took **no
timings**: the machine was at a load of about 97. Encode and vectorise times are the job
of `vectorbench run` on a quiet host and are not in this table.

| Clip | Best trace (PSNR / VMAF) | SVG bytes per frame | Codec of higher PSNR | Bytes per frame | SVG / codec |
|---|---|---:|---|---:|---:|
| GlassHalf, 3D cartoon 1080p24 | 31.5 dB / 55.6 | 1 669 226 | AV1 crf 60, 38.7 dB / 87.9 | 2 916 | about 570 |
| SolLevanteFace, anime 1080p24 | 35.1 dB / 47.0 | 3 886 018 | AV1 crf 45, 36.6 dB / 58.1 | 9 445 | about 410 |
| Wikipedia, web page 1080p30 | 24.5 dB / 30.1 | 1 419 519 | AV1 crf 60, 44.3 dB / 95.1 | 2 412 | about 590 |
| Slides1, slides 1080p30 | 27.4 dB / 57.8 | 1 353 515 | AV1 crf 60, 38.1 dB / 93.3 | 4 948 | about 270 |
| KristenAndSara, fixed camera 720p60 | 32.2 dB / 59.4 | 2 578 533 | x265 crf 40, 34.8 dB / 66.6 | 621 | about 4 150 |
| in_to_tree, texture and pan 720p50 | 32.5 dB / 54.8 | 3 618 069 | AV1 crf 60, 35.4 dB / 84.7 | 1 372 | about 2 640 |

## Conclusions {#conclusions}

- Frame-by-frame tracing is larger than the lossless PNG of the same frame on all six
clips, while sitting 24 to 35 dB from the source. After gzip it is still 60 to 1 400
times the size of a better raster encode.
- Coarser tracing does not close the gap: on SolLevanteFace the coarse setting is about
20 times larger than x264 crf 51 and worse.
- Screen content is not the favourable case. Text that is already rasterised and
anti-aliased is partly erased by the tracer's speckle filter. Vectors win on screen
content only when you start from the source (HTML, PDF), not from the video.
- The one published vector win, about half the size of DivX 6 on flat 2D cartoons, was
measured against a 2009 codec. Against HEVC or AV1 it is probably near 1
(**estimated**; nobody has republished it).
- For resolution independence on camera video, use a raster codec with super-resolution
at playback.

## Run it yourself {#run}

```sh
vectorbench run --work <dir> # writes results.json
vectorbench report results.json
```

`vectorbench run` refuses VTracer or resvg versions other than the pinned ones, fetches
the clips by URL and checks their SHA-256, and records tool versions, the machine and the
load in `results.json`. The report labels each number measured, estimated (interpolated
between the two measured settings that bracket the target quality), a bound, or n/a. It
also gives a flicker proxy: how many paths change between consecutive frames.

Timings on the reference host are not published yet. The tool refuses to time anything
when the one-minute load is above its limit, unless a waiver reason is given, and the
waiver is written into the results.
Loading