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:
| Format | Chroma Subsampling | Supported Bit Depth(s) |
|---|---|---|
| YUV420P | 4:2:0 | 8-bit |
| YUV420P10LE | 4:2:0 | 10-bit* |
*10-bit support requires a flag to be set during compilation with CMake.
Installationâ
- Linux & macOS
- Windows
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â
-
Compilation requires GNU Automake, Autoconf, Libtool, and M4. Install them via your package manager.
-
Clone the repository and its submodules:
git clone --recursive https://github.com/ultravideo/kvazaar.git
cd kvazaar
./autogen.sh
./configure
make -j$(nproc)
- Binaries will be available in
src, or you can runmake installon 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.
Windows users are recommended to compile via MinGW-W64 which comes with MSYS2. Please be advised the usage of Clang for compiling in this situation is heavily recommended
due to disabled AVX2 optimizations because of a known GCC issue from 2012 (MinGW environments-exclusive). To do this, run CC=clang ./configure during autoconf.
MSYS2â
-
Make sure you have downloaded & installed MSYS2 from the MSYS2 website before beginning the build process.
-
Start the UCRT64 console & install the required dependencies with the
pacmanpackage manager -
Resume the build process as you would on a Unix-like system. See the "Linux & macOS" tab for more information.
Usageâ
Here are some examples of how to use Kvazaar on its own:
kvazaar -i input.y4m --input-file-format y4m --qp 20 -o output.265
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 -v error -i input.mkv -f yuv4mpegpipe -strict -1 - | kvazaar -i - --input-file-format y4m --qp 20 --preset slow -o output.265
Parameters worth knowingâ
--preset [ultrafast..placebo]
Eleven x264-style presets from ultrafast to placebo; medium is the default.
-q, --qp [0-51]
Fixed QP (22 by default), or --bitrate N for single-pass bitrate-targeting rate control (algorithm selectable via --rc-algorithm).
-p, --period [N]
Intra period in frames: 0 puts an intra frame only at the start, 1 is all-intra, N every Nth frame (64 by default). There is no scene change detection. --gop selects the GOP structure (8/16 B-pyramids or low-delay lp-g8d4t2-style strings; RA 16 is the default).
--threads N/--owf N/--wpp
Kvazaar parallelizes out of the box: WPP is enabled by default & thread count is auto-selected. --owf adds frame-level parallelism.
--lossless
Enables lossless coding.
--vaq N
Variance adaptive quantization (strength 1-20, 5 recommended), off by default.
When encoding 10-bit (see the build instructions above), pass --input-bitdepth 10 explicitly: Kvazaar does not pick the bit depth up from a Y4M header & fails with Failed to read a frame otherwise.