Vector video vs codecs
Vector video vs codecs
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 (v0.1.1) is the tool
that repeats the measurement with pinned versions.
What was 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. This size study ran on a loaded machine (load about 97) and took no timings; the timings are in a second, separate run on a quiet host, described in Timings.
| 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
- 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
vectorbench run --work <dir> # writes results.json
vectorbench report results.jsonvectorbench 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.
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.
Timings
Published run: vectorbench v0.1.1, nine clips (the six above plus the screen recordings
Debugging and MissionControlClip3 and the 1080p50 camera clip crowd_run), 24 frames each,
on host fractal (Linux amd64), the process pinned to one core (taskset -c 9),
one-minute load 1.77 at the start and 2.05 at the end (limit 8). Encoders: Ubuntu ffmpeg
6.1.1 (x264, x265, SVT-AV1 1.7.0, libvpx-vp9); PSNR and VMAF: a static ffmpeg 7.0.2 with
libvmaf. VTracer 0.6.5 and resvg 0.50.0. The tool hashes and the raw results are in
results/fractal-core9.json
and the full tables in
results/fractal-core9.md.
Encode time is the wall time of the encoder for the 24 frames, in seconds, at the mid-quality setting of each codec. VTracer is the default preset, in seconds per frame (multiply by 24 to compare). All measured, one run each.
| Clip | x264 crf 23 | x265 crf 23 | SVT-AV1 crf 45 | VP9 crf 50 | VTracer, s per frame |
|---|---|---|---|---|---|
| GlassHalf, cartoon 1080p | 1.2 | 0.9 | 14.2 | 6.2 | 0.85 |
| SolLevanteFace, anime 1080p | 3.7 | 1.4 | 38.2 | 9.6 | 2.40 |
| Wikipedia, screen 1080p | 0.6 | 0.6 | 16.6 | 3.4 | 0.82 |
| Slides1, screen 1080p | 0.9 | 0.8 | 13.4 | 4.9 | 0.83 |
| Debugging, screen 1080p | 0.6 | 0.6 | 17.7 | 4.2 | 0.69 |
| MissionControlClip3, screen 1080p | 1.0 | 0.8 | 29.0 | 4.4 | 1.87 |
| KristenAndSara, camera 720p | 0.5 | 0.5 | 7.0 | 1.6 | 0.54 |
| in_to_tree, camera 720p | 0.9 | 0.6 | 11.8 | 1.9 | 2.64 |
| crowd_run, camera 1080p | 3.2 | 1.6 | 67.8 | 11.5 | 11.76 |
Tracing 24 frames takes 13 to 282 seconds, against 0.5 to 4 seconds for x264 and x265 and 7 to 68 seconds for SVT-AV1 at this preset. Vectorising is therefore slower than the fast codecs by one to two orders of magnitude and comparable to the slowest AV1 setting, for a result that is larger and further from the source.
The same run gives the size comparison at matched VMAF. The ratio is the size of the trace divided by the size of the best codec at the same VMAF (plain SVG; the codec size is estimated by interpolation, or a bound where marked in the full tables), over every clip and VTracer setting of the class:
| Class | Comparisons | Smallest | Median | Largest |
|---|---|---|---|---|
| anime | 4 | 18x | 625x | 1061x |
| cartoon | 4 | 141x | 612x | 952x |
| natural | 12 | 114x | 2164x | 6478x |
| screen | 16 | 37x | 534x | 3429x |
Even the coarsest trace is at least 18 times larger than a codec at its quality; the conclusion above stands on nine clips.