From TouchDesigner 088 Wiki

The Hap and Hap Q codec is supported in the Movie File In TOP, and the Movie File Out TOP encodes to the Hap Q codec.

Hap is a video codec that performs decompression using a computer's graphics hardware, substantially reducing the CPU usage necessary to play video. It allows for playback of higher resolution and/or frame rate videos than any other codec we know of. It also allows for playback many more streams of lower resolution video than other codecs, assuming you have the drive speed for it.

There are three different Hap codecs: Hap, Hap Alpha, and Hap Q.

  • Hap has the lowest data-rate and low image quality.
  • Hap Alpha has identical image quality to Hap, and supports an Alpha channel. The size of a Hap Alpha file will be twice the size of a Hap file.
  • Hap Q has much improved image quality, but no alpha channel. The size of a Hap Q file will be approximately twice the size of a Hap file. We recommend using Hap Q.

Hap Q image quality is very high and is a great choice for projects playing very high resolution video. Since the files have a high data rate the main bottleneck you will often hit is SSD read speed, which can be fixed by using a RAID0 setup of SSD drives. The typical compression rate for Hap Q is around 6:1 compared to completely uncompressed RGB video. When determining required SSD read speeds for a project, assume 1 byte per pixel as the required data throughput. E.g For 4096x2160@60hz video, the safe top-end read rate requirement would be 4096*2160*60=530,841,600 bytes/sec read speed.

TouchDesigner supports the decoding of all three forms of the codec, and encoding only Hap Q in output via the Movie File Out TOP.

The QuickTime plugin (not required for HAP support in TouchDesigner, but useful for external encoding or testing) can be found here.

Its specification and sample code can be found at the github location: Hap video codec

Working with High Resolution or High FPS Video

Hap Q is the best codec choice when ultra high resolution or FPS video is required. However the videos must be encoded properly to allow for multi-threaded CPU decoding. This is called 'Chunked' encoding in the Hap standard. The Movie File Out TOP always encodes using chunked encoding. Chunked encoding can also be done using the latest version of ffmpeg. Note: The QuickTime plugin does not currently encode using chunked encoding.