Skip to main content

Kvazaar

Kvazaar is an open-source H.265 / HEVC software encoder Written in C, developed by Ultra Video Group and licensed under BSD 3-clause.

uvg266 (Developed by the same group) uses Kvazaar as a base for encoding to the VVC codec.

x265 is generally regarded as having better performance while producing better quality video streams.

FFmpeg​

Kvazaar is available in FFmpeg via libkvazaar, to check if you have it, run ffmpeg -h encoder=libkvazaar. You can input non-FFmpeg standard Kvazaar parameters via -kvazaar-params.

You may need to download "Full" builds. As most of the time, this encoder is not included.

Supported Color Space​

Kvazaar supports the following color spaces:

FormatChroma SubsamplingSupported Bit Depth(s)
YUV420P4:2:08-bit
YUV420P10LE4:2:010-bit*

*10-bit support requires a flag to be set during compilation with CMake.

Installation​

For Arch Linux, Kvazaar is available as kvazaar. It is also available in the Arch User Repository (AUR) as kvazaar-git.

Ultra Video Group does not ship any pre-built binaries of their encoders except for their AppVeyor CI, but AppVeyor deletes build artifacts after a month, so most of the time you'll have to compile Kvazaar yourself. Here are the instructions to do so:

Autotools​

  1. Compilation requires GNU Automake, Autoconf, Libtool, and M4. Install them via your package manager.

  2. Clone the repository and its submodules:

git clone --recursive https://github.com/ultravideo/kvazaar.git
cd kvazaar
./autogen.sh
./configure
make -j$(nproc)
  1. Binaries will be available in src, or you can run make install on Linux to install (May need elevated permissions).

CMake (10-bit support)​

You will need to use CMake to specify a flag to be able to encode 10-bit with the encoder; by default Kvazaar ships with only 8-bit.

git clone --recursive https://github.com/ultravideo/kvazaar.git
cd kvazaar/build
cmake .. -DCMAKE_C_FLAGS="-DKVZ_BIT_DEPTH=10" # optional 10-bit flag
make -j$(nproc)

Be aware that encoding 10-bit HEVC with Kvazaar is significantly slower, as the developers only prioritized SIMD optimizations for 8-bit encoding. Be aware that this implementation can be buggy in general.

Usage​

Here are some examples of how to use Kvazaar on its own:

Simple Y4M input with QP 20 and raw 265 bitstream output
kvazaar -i input.y4m --input-file-format y4m --qp 20 -o output.265
Preset slow, CRF 20, Y4M input
kvazaar -i input.y4m --input-file-format y4m --qp 20 --preset slow -o output.265

The command below still uses the kvazaar binary, but reads from a YUV4MPEG pipe instead of a file. This is useful for piping FFmpeg output to Kvazaar.

FFmpeg piping
ffmpeg -v error -i input.mkv -f yuv4mpegpipe -strict -1 - | kvazaar -i - --input-file-format y4m --qp 20 --preset slow -o output.265