Lagarith Lossless Codec











Lagarith Lossless Video Codec

Lagarith is a lossless video codec intended for editing and archiving. Lagarith offers better compression than codecs like Huffyuv, Alparysoft, and CorePNG. There are a few lossless codecs that can compress better than Lagarith, such as MSU and FFV1; however Lagarith tends to be faster than these codecs. Lagarith is able to operate in several colorspaces - RGB24, RGB32, RGBA, YUY2, and YV12. For DVD video, the compression is typically only 10-30% better than Huffyuv. However, for high static scenes or highly compressible scenes, Lagarith significantly outperforms Huffyuv. Lagarith is able to outperform Huffyuv due to the fact that it uses a much better compression method. Pixel values are first predicted using median prediction (the same method used when "Predict Median" is selected in Huffyuv). This results in a much more compressible data stream. In Huffyuv, this byte stream would then be compress using Huffman compression. In Lagarith, the byte stream may be subjected to a modified Run Length Encoding if it will result in better compression. The resulting byte stream from that is then compressed using Arithmetic compression, which, unlike Huffman compression, can average fractional bits per symbol. This allows the compressed size to be very close to the entropy of the data, and is why Lagarith can compress simple frames much better than Huffyuv, and avoid expanding high static video. Additionally, Lagarith has support for null frames; if the previous frame is mathematically identical to the current, the current frame is discarded and the decoder will simply use the previous frame again.

This codec was build using the Huffyuv source as a template, and uses some Huffyuv code, most notably the routine to upsample YUY2 video to RGB and to perform pixel prediction on YUY2 video. Other colorspace conversion routines were taken from AviSynth. Lagarith is released under the GPL.

If you find any errors with this codec, please let me know - Sir_Lagsalot at hotmail.com.

Lagarith was last updated on December 8, 2011.

Thanks to AbsoluteDestiny and Zarxrax for helping with testing the codec, Andrew Dunstan for providing optimized colorspace conversion routines for the X64 build, Ben Rudiak-Gould for developing Huffyuv and AviSynth, and to Avery Lee for helping speed up the decoder as well as having developed VirtualDub.

Version 1.3.20 introduced a new option to prevent upsampling when decoding. Checking this option and having the mode set to RGB or RGBA will prevent Lagarith from performing any colorspace conversions when encoding or decoding video.

Lagarith Installer (v1.3.27) An installer for 32 and 64 bit versions of windows (other than Windows 2000, see below). Thanks to Zarxrax for creating and testing the installer script.

Lagarith Codec (v1.3.27) A manual installation version.

Lagarith 1.3.27 Source Code

Change Log

Windows 2000 users: the multi-threading changes introduced in 1.3.24 are not supported in Windows 2000. Please use version 1.3.23 instead.