# DSV2

Canonical URL: https://encode.wiki/codecs/video/dsv2/
Content version: ca42e61ede0a24f789d7287a0001244ad22f4abf
Status: current
License: CC BY-SA 4.0
Checksum (SHA-256): 296e290cd4b9996e30eef09b1626fd3552b943ef54eafc4cfe4ef7be945df1f1

DSV2 (Digital Subband Video 2) is a lossy and lossless hobby codec by EMMIR (Envel Graphics) that combines a wavelet transform with block-based motion compensation. The author targets CIF to Full HD at medium-low to medium-high bitrates and describes the efficiency as comparable to MPEG-4 Part 2 and P-frame-only [AVC](/codecs/video/avc/). That is the author's own comparison. It succeeds [DSV](/codecs/video/dsv/), and the v2.8 bitstream has been frozen since 29 August 2026 per the README.

It is a codec to study or play with, not a delivery format. The only encoder and decoder is the author's C reference code; FFmpeg, browsers and players do not support it.

## Features

- Wavelet subband transform instead of a DCT, with in-loop filtering and adaptive quantisation.
- Intra and inter frames with variable-length closed GOPs; up to quarter-pixel motion compensation; no B-frames.
- 8-bit 4:1:0, 4:1:1, 4:2:0, 4:2:2 and 4:4:4. No interlaced support.
- A mathematically lossless mode (`-qp=100`).
- CRF (the default), single-pass ABR and constant-QP rate control.
- The reference code is C89, integer-only, single-threaded and has no SIMD, so it is slow. Frame dimensions must be even.

## Build and use

```sh
git clone https://github.com/LMP88959/Digital-Subband-Video-2 && cd Digital-Subband-Video-2
cc -O3 -o dsv2 src/*.c
```

The README's `cc -O3 -o dsv2 *.c` is out of date because the sources now live in `src/`. A Zig build file is also provided.

```sh
./dsv2 e -inp=video.y4m -out=compressed.dsv -y4m=1 -qp=60 -gop=48 -nfr=240
./dsv2 d -inp=compressed.dsv -out=decoded.y4m -y4m=1
```

- `-y4m=1` is required for Y4M files; the extension is not checked. Raw YUV additionally needs `-w`, `-h`, `-fps_num` and `-fps_den`.
- `-qp` is a quality percentage, so higher is better, the opposite of x264/x265. The README puts visually lossless at around 70 and above; `-qp=100` is mathematically lossless. Without `-qp`, CRF mode uses 85.
- `-gop=0` is intra-only. A GOP of 0.5 to 10 seconds is suggested.
- `-rc_mode=1 -kbps=1500` selects ABR. `./dsv2 e vhelp` lists every option and default.
- Set `-nfr` to the number of input frames. Without it the encoder reads to end of file and exits with status 254 even though the output is complete, which breaks scripts that check the exit code.
- `-out420p=1` on decode converts to 4:2:0; leave it off to keep full chroma.

The README warns that the PDFs in the repository describe the codec as first uploaded, so trust the source and `./dsv2 e vhelp` over them. v2.8 unfroze and refroze the bitstream (see `CHANGELOG`), so keep the matching build for files made by older versions.
