Export in Hap from third party softwares
Back to smode.fr
You are here: Reference > How To > Export in Hap from third party softwares

Export in Hap from third party softwares

Use D-Labs plugin for all your Hap export purposes (from after effects or other softwares) to have a good real time video with both quality and prestige!

First of all, download the D/labs Hap compression plug-in here:
HapQuickTimeSetup-D-Labs.msi


Here are some keys to understand what make a good compromise between Quality and Performances during the restitution:

Hap is an association between 2 compression algorithms:
- DXT 8bit image compression algorithm (destructive):
Make images natively displayable by the graphic card without having to decompress them. This allow to gain a non-negligible decompression time as well as a bandwidth gain on the graphic card. DXT1 divide the octet size of an image by 6, DXT5 by 4. As it is destructive, DXT compression will always be a little bit rough on color gradients (creating Banding effects).
- Snappy file compression Algorithm (non-destructive) :
Inside of the Hap, once Images are coded in DXT, then the images sequences uses Snappy compression algorithm to reduce the Hap file size in a non-destructive way. Snappy is very fast to be executed for the processor. If it is cut into chunks, then the decompression can be parallelized on many different cores of the processor.

Nowadays it exist 4 different quality modes for HAP format:

- Hap: (DXT1 one texture compressed in RGB)
- HapAlpha: (DXT5 one texture compressed RGBA) (Alpha channel support)
- HapQ: (DTX5 one texture compressed in RGBA with the alpha channel used to "increase" RGB quality, so no Alpha support in HapQ)
- HapQ Alpha: (2 textures compressed, Not supported into Smode )

Even if HapQ offer a better quality than Hap for high frequencies images (details and high contrasts), as it uses a non-RGB color space (YCoCg) it's quality on low frequencies (subtle colors gradients) is not as good as regular Hap. HapQ is also heavier than regular Hap

All encoding Hap softwares are not equivalent, for the restitution performances to be good, multiples chunks must be supported. Also DXT encoder must be of good quality to minimise the banding effects on gradients.

Here are some softwares we recommend (by order of preference):

The softwares supporting Quicktime plugins such as After Effects or Adobe Media Encoder .
The quicktime HAP plugins for windows offer a very good DXT compression quality. Go check the link on the top of this page to download the modified plug-in by D/labs to benefit from the 16 chunks.

The mac version of the Quicktime HAP plugin unfortunately does not support multi-chunks which is trouble to benefit of the multi-core CPU for high resolution video streaming. So for the time being we prefer the D-Labs plugin until the vidvox development team fixes this issue on Mac : https://github.com/Vidvox/hap-qt-codec/releases/tag/version-1247
It is also possible to directly export and transcode videos in HAP and Hap Alpha from Smode (HapQ and HapQ Alpha export is not supported yet). Go check at the bottom of the Medias directories part of the documentation for more intel. The Smode DXT encoder lean on Squish by default, which actually offer a better quality than the encoder provided by the Graphic cards drivers.

And last but not least : FFmpeg ( https://ffmpeg.org/download.html ). FFmpeg is a little bit austere but free, it support multiple chunks, it has a DXT encoder fast but of poor quality. Here are the command lines using different Hap formats :
ffmpeg.exe -i %sourceFile% -vcodec hap -format hap -chunks 16 %destination%
ffmpeg.exe -i %sourceFile% -vcodec hap -format hap_q -chunks 16 %destination%
ffmpeg.exe -i %sourceFile% -vcodec hap -format hap_alpha -chunks 16 %destination%
Note that for image sequence you need to add framerate parameter and use a %d expression to define where is the number in the input files names:
ffmpeg.exe -framerate 25 -i "C:\myFolder\image (%d).jpg" -vcodec hap -format hap_alpha -chunks 16 %destination%

Here is an example of converting an image sequence with ffmpeg.exe. First download it there : https://ffmpeg.zeranoe.com/builds/ and open the windows command prompt (type cmd inside the windows search engine and execute it).
Now type "cd (path of the ffmpeg.exe file)" inside the command prompt to have access to ffmpeg.exe. This executable is inside the *.bin folder of the zip you downloaded on the link above.
Here is an example in which my image sequence (which I want to convert) is inside the folder "C:\Sequences\Jungle". And the folder of my output file will be "C:\Sequences\Export\Jungle\Jungle01.mov".
Note that all the folders must be created before launching the ffmpeg converter and that your Image sequence resolution should be a multiple of 4.
If you want to encode a video instead of an image sequence, just type "fileName.mp4" instead of "ImageSequence%d.png" in the example below.

Once the video is exported, to check inside of Smode if everything is well, just select the files inside of the medias directories:

Go check the Medias Pre-visualisation part of the doc inside the chapter "files informations" to get more infos on that matter.