An open-source HEVC encoder
An open-source HEVC encoder licensed under 3-clause BSD
Join channel #ultravideo in Libera.Chat IRC network to contact us or come to our Discord
Kvazaar is still under development. Speed and RD-quality will continue to improve.
http://ultravideo.fi/#encoder for more information.
kvazaar --input BQMall_832x480_60.yuv --output out.hevcThe mandatory parameters are input and output. If the resolution of the input file is not in the filename, or when pipe is used, the input resolution must also be given: --input-res=1920x1080.
The default input format is 8-bit yuv420p for 8-bit and yuv420p10le for 10-bit. Input format and bitdepth can be selected with --input-format and --input-bitdepth.
Speed and compression quality can be selected with --preset, or by setting the options manually.
…The LP-GOP syntax is "lp-g(num)d(num)t(num)", where
QP
+4 o o o o
+3 o o o o o o
+2 o o o o ooooooo
+1 o o o o o o ooooooooo
g8d4t1 g8d3t1 g8d2t1 g8d1t1The names of the presets are the same as with x264: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow and placebo. The effects of the presets are listed in the following table, where the names have been abbreviated to fit the layout in GitHub.
| 0-uf | 1-sf | 2-vf | 3-fr | 4-f | 5-m | 6-s | 7-sr | 8-vs | 9-p | |
|---|---|---|---|---|---|---|---|---|---|---|
| rd | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 3 | 3 |
| pu-depth-intra | 2-3 | 2-3 | 2-3 | 2-3 | 1-3 | 1-4 | 1-4 | 1-4 | 1-4 | 1-4 |
| pu-depth-inter | 1-2 | 1-2 | 1-3 | 1-3 | 1-3 | 0-3 | 0-3 | 0-3 | 0-3 | 0-3 |
| me | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | hexbs | tz | tz |
| gop | 8 | 8 | 8 | 8 | 8 | 16 | 16 | 16 | 16 | 16 |
| ref | 1 | 1 | 1 | 1 | 2 | 4 | 4 | 4 | 4 | 4 |
| bipred | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| deblock | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| signhide | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
| subme | 0 | 2 | 2 | 4 | 4 | 4 | 4 | 4 | 4 | 4 |
| sao | off | full | full | full | full | full | full | full | full | full |
| rdoq | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 |
| rdoq-skip | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| transform-skip | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| mv-rdo | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| full-intra-search | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| smp | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| amp | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| cu-split-termination | zero | zero | zero | zero | zero | zero | zero | zero | zero | off |
| me-early-termination | sens. | sens. | sens. | sens. | sens. | on | on | off | off | off |
| intra-rdo-et | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| early-skip | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
| fast-residual-cost | 28 | 28 | 28 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| max-merge | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 |
See kvazaar.h for the library API and its documentation.
When using the static Kvazaar library on Windows, macro KVZ_STATIC_LIB
must be defined. On other platforms it's not strictly required.
The needed linker and compiler flags can be obtained with pkg-config.
If you have trouble regarding compiling the source code, please make an issue about in Github. Others might encounter the same problem and there is probably much to improve in the build process. We want to make this as simple as possible.
Add -DKVZ_RANGE_EXTENSION to CFLAGS for 4:2:2 and 4:4:4 support, there is some speed penalty to 4:2:0 just by enabling it so it's disabled by default.
With CMake -DUSE_RANGE_EXTENSION=ON can be used.
Depending on the platform, some additional tools are required for compiling Kvazaar with autotools.
For Ubuntu, the required packages are automake autoconf libtool m4 build-essential.
Run the following commands to compile and install Kvazaar.
./autogen.sh
./configure
make
sudo make install
sudo ldconfigSee ./configure --help for more options.
When building shared library with visual studio the tests will fail to link, the main binary will still work
It is recommended to use Clang instead of GCC in MinGW environments. GCC also works, but AVX2 optimizations will be disabled because of a known GCC issue from 2012, so performance will suffer badly. Instead of ./configure, run
CC=clang ./configureto build Kvazaar using Clang.
Depending on the platform, some additional tools are required for compiling Kvazaar with CMake.
For Ubuntu, the required packages are build-essential cmake.
brew install automake libtool yasmThis project includes a Dockerfile, which enables building for Docker. Kvazaar is also available in the Docker Hub ultravideo/kvazaar
Build using Docker: docker build -t kvazaar .
Example usage: docker run -i -a STDIN -a STDOUT kvazaar -i - --input-res=320x240 -o - out.265
For other examples, see Dockerfile
Compiling kvazaar_cli project in the visualizer branch results in a Kvazaar executable with visualization enabled.
Additional Requirements: SDL2, SDL2-ttf.
Directory visualizer_extras has to be added into the same directory level as the kvazaar project directory. Inside should be directories include and lib found from the development library zip packages.
SDL2.dll, SDL2_ttf.dll, libfreetype-6.dll, and zlib1.dll should be placed in the working directory (i.e. the folder the kvazaar.exe is in after compiling the kvazaar_cli project/solution) when running the visualizer. The required .dll can be found in the aforementioned lib-folder (lib\x64).
Note: The solution should be compiled on the x64 platform in visual studio.
Optional font file arial.ttf is to be placed in the working directory, if block info tool is used.
Please cite this paper for Kvazaar:
M. Viitanen, A. Koivula, A. Lemmetti, A. Ylä-Outinen, J. Vanne, and T. D. Hämäläinen, “Kvazaar: open-source HEVC/H.265 encoder,” in Proc. ACM Int. Conf. Multimedia, Amsterdam, The Netherlands, Oct. 2016.
Or in BibTex:
@inproceedings{Kvazaar2016,
author = {Viitanen, Marko and Koivula, Ari and Lemmetti, Ari and Yl\"{a}-Outinen, Arttu and Vanne, Jarno and H\"{a}m\"{a}l\"{a}inen, Timo D.},
title = {Kvazaar: Open-Source HEVC/H.265 Encoder},
booktitle = {Proceedings of the 24th ACM International Conference on Multimedia},
year = {2016},
isbn = {978-1-4503-3603-1},
location = {Amsterdam, The Netherlands},
url = {http://doi.acm.org/10.1145/2964284.2973796},
}We are happy to look at pull requests in Github. There is still lots of work to be done.
You can generate Doxygen documentation pages by running the command "doxygen docs.doxy". Here is a rough sketch of the module structure:
There are some unit tests located in the tests directory. We would like to have more.
The Visual Studio project links the unit tests against the actual .lib file used by the encoder. There is no Makefile as of yet.
The unit tests use "greatest" unit testing framework. It is included as a submodule, but getting it requires the following commands to be run in the root directory of kvazaar:
git submodule init
git submodule update
On Linux, configure kvazaar with ./configure --enable-static,
run make check.
We try to follow the following conventions:
No open issues yet, or sync has not completed.