Tips for encoding movies into HAP

On the HAP website are instructions for transcoding media files using our free batch exporter, QuickTime, FFMPEG and other conversion utilities:
http://hap.video/using-hap.html

Here are some useful tips:

  • Video codecs are typically a trade off between quality, file size and playback efficiency. The HAP codecs are optimized for low CPU usage during playback, at the expense of quality and file size, to handle extreme situations that traditional codecs can not handle.
  • For the best playback results, make sure to use an SSD or other high speed drive.
  • Use HAP Alpha and HAP Q Alpha for media files that contain alpha channels / transparency.
  • When encoding media files in HAP Q / HAP Q Alpha, some software will offer an option to specify the number of chunks:
    • For SD and HD sized media, use the default setting of 1.
    • For ultra-hd content, eg 4k and larger, you can set this value up to the number of cores in the system that will be used for playback to further optimize playback performance. Usually a setting of 2 or 4 is appropriate.
1 Like

Thanks for the information !

On Adobe software you can use AfterCodecs to export HAP https://autokroma.com/AfterCodecs/ and decoding chunks can be specified even for regular Hap / Hap Alpha

Looks like the good folks over at Disguise are making an open source HAP encoder plugin for Adobe softwares!

Download the installers here:
https://github.com/disguise-one/hap-adobe-premiere-plugin/releases/

And user guide here:
https://github.com/disguise-one/hap-adobe-premiere-plugin/tree/master/doc/user_guide/

1 Like

I was recently asked over email if there is a good way to go from an image sequence to a HAP movie file directly – this can be done easily from the command line using FFmpeg.

First make sure to install FFmpeg with HAP using these instructions:
https://hap.video/using-hap.html#ffmpeg

The rest of this is based on the tips from,
http://hamelot.io/visualization/using-ffmpeg-to-convert-a-set-of-images-into-a-video/
(which describes encoding to mp4)
and here I’ve adapted the example ffmpeg command to instead export to HAP,

ffmpeg -r 30 -f image2 -s 1920x1080 -i test%02d.tif -vcodec hap -pix_fmt rgba test.mov

When using your own media, you can change these settings as needed:
“- i” is where you set the pattern for the image sequence naming (where the %02d means that zeros will be padded until the length of the string is 2 i.e 01…20…30… and so on. If no padding is needed use something similar to pic%d.png or %d.png)
“-r” is the framerate (fps)
“-s” is the resolution
and the file name is ‘test.mov’
(I left -f as image2 and changed the pix_fmt from the original post linked to)

I hope this is useful, please let me know if you have any issues with this technique!

Have a question about Hap Codec,

have some export from blender which use .mkv (800ko) per files
when encoding with hap codec, file size is 61mo

wish to use AVF batch converter but it does not support mkv files.
so I’m using : ffmpeg -i yourSourceFile.mov -c:v hap outputName.mov

Am I doing something wrong ?

best

I’m not sure I follow completely where you are having trouble, but you can find some useful notes on using ffmpeg to convert to HAP here,
https://hap.video/using-hap.html#ffmpeg

Beyond that, we currently have no plans to add mkv support to the AVF Batch Exporter – AVF stands for AVFoundation, and it only supports formats that it can handle.

For ffmpeg gui - I’ve been using http://www.ffworks.net 20euros but I think its been worth it - for converting things beyond hap. And is cheaper Than the questionably looking apps on the apple App Store.