Jump to content

HAP codec with After Effects


Recommended Posts

I am rendering to QuickTime from Adobe After Effects using the HAP codec but there are no options for bit rate or chunk size regardless of which flavor I use (HAP, HAP Q, HAP alpha...).  The only option presented at render time is a slider for "Quality" which seems to have little, if any effect on the file quality or size.  Is there a way to set chunk size in After Effects, or must another encoder be used.  If so, which one?  I tried without success to use ffmpeg.

Link to comment
Share on other sites

  • Member

In Quicktime, After Effects and Adobe Encoder there are few options available.  The best option for coding in chunks is FFmpeg and I find the interface challenging, to say the least.  The good news is if your hardware is high end and you have fast SSD's then the HAP and HAPQ files work well without chunking them.   As with every solution in our industry the more you can test in a real situation the better your outcome will be when your live and in my humble opinion I seem to always have something to learn about video codecs for playback.

Link to comment
Share on other sites

As I have mentioned in previous posts, given a certain resolution and Hap flavour (Hap, HapQ or HapAlpha) there is no way to control the bitrate. The compression methods are fixed and leave no room for any adjustments. If the bitrate is too high, you will have to render to a lower resolution, or, if playing HapQ, switch to Hap. 

It the video plays fine without using chunks, don't bother to use chunks. Each chunk will add a slight overhead, both in the form of a slightly higher decoding time and slightly larger files, but the difference is usually (close to) negligible. 

If you want to use ffmpeg, there are windows binaries to download here: http://ffmpeg.zeranoe.com/builds/

Assuming you are running windows: Just put ffmpeg.exe and the file you wish to convert in a folder, open a windows command prompt and navigate to that folder and issue the following command: 

ffmpeg -i Movie.mov -vcodec hap -format hap_q -chunks 4 MovieHap.mov


This will convert Movie.mov to a HapQ movie using 4 chunks and store the result in MovieHap.mov. Here hap_q can be changed to hap or hap_alpha if you wish to use these flavours instead of HapQ. Chunks can be any number between 1 and 64. There is no point in using more chunks that there are CPU cores in the computer. It is also a good idea to keep the number as small as possible, since each chunks adds a slight overhead. 


ffmpeg's user interface is not the easiest to master, but once you get the hang of it you really appreciate the flexibility. You can do just about anything, and the number of codecs supported is very long. Over time, the most popular codecs (h264 for example) has evolved to a very high performing codec both in the terms of quality and encoding speed. 



Link to comment
Share on other sites

Thanks.  Using Erik's command line formula, I managed to encode with ffmpeg.  HapQ results in file sizes roughly double the size of Hap...  When encoding a QuickTime that was originally rendered from After Effects with Photo-Jpeg at Quality=7, ffmpeg issues a warning : "depricated pixel format used..." but it encoded to HAP nevertheless.


Using a Quicktime as the source footage is a bit inconvenient.  Can ffmpeg parse sequentially numbered image files as input?


I should point out that I had previously experienced very promising results in Watchout by rendering to HAP-encoded QuickTime directly from After Effects (despite not being able to specify chunk size).  The anomalous behavior (described below) has prompted me to explore chunk size options.  Is there any way to know if After Effects assigns chunk size automatically or if it simply defaults to 1?


Playback in Watchout is remarkably smooth with AfterEffects-generated HAP files, *most* of the time.   The location along the timeline where playback gets jittery is not repeatable.  For example, stopping/resuming playback solves the jitters and the clip plays smooth again from that point.  Watchout also issues a warning during playback that "at least one HAP frame was not decoded properly".


Typical clips for our application are quite long (~35+ minutes) and rather large (3200 x 3200px).  The display computer is high end and has very fast SSDs.  I was advised to consider updating from Watchout 6.1.2 to version 6.1.6 such that it allegedly has greater support for the Hap codec.  I have yet to do so but plan to soon.

Link to comment
Share on other sites

  • Member

I had the same inconsistent stuttering with HAPQ files on a recent show using 4K resolution (3840x2160), I re-encoded the same files to mp4's and the stuttering went away.  The possible issue might be that the HAPQ files in my case, had too high of a data rate for the single SSD I was using on each machine.   Which meant the SSD couldn't keep up with the demand of playing back the HAPQ file.


I have added two new 256 Gb SSD's and placed them in RAID 0 doubling their read speed and also their memory capacity.  I kept the original hard drive for the OS only and the WO program and all show files are all placed on the RAID 0 drives.   Since the computers travel so much it's hard for me to test the performance of the new SSD's, so in theory, the HAPQ files should work better.   I have a battery of tests to run in the next two weeks and will let you know if theory becomes fact. 

Link to comment
Share on other sites

Yes, it is possible to use an image sequence as input to ffmpeg. The syntax is far from obvious:

If the files are names Img000001.tiff, Img000002.tiff, Img000003.tiff ...., you can use the following command line: 

ffmpeg -i Img%06d.tiff -vcodec hap -format hap_q -chunks 4 MovieHap.mov


The character after the %-sign is a zero, not a capital o. The "%06d" means "an integer with 6 digits, padded with zeroes to the left if shorter than 6 digits". This means that if the files are named Img0001.tiff, Img0002.tiff... You would use "Img%04d.tiff" instead. 


The "at least one HAP frame was not decoded properly" means exactly what it says, that Watchout failed to decode a part of the file, which in its turn means that there is an error in the file, or possibly a bug in Watchout. 



A HapQ at 3200x3200 in 60 fps will require about 400 megabytes per second, which is pushing the limits for many single SSD:s. If you have several disks in a RAID-0 configuration you will of course get higher speeds. I would advise you to actually measure the disk performance and compare to the data rate of the movie(s) you are trying to play. AS SSD Benchmark can be downloaded for free and provides a reasonable estimate of the disk speed. 



Link to comment
Share on other sites

Thank you.  We have gotten good results (as far as good quality and smooth playback) using the command line above using sequentially numbered JPG's and PNG's as source files.


However, it appears that ffmpeg defaults to a frame rate of 25fps such that the Hap-encoded QuickTime movie plays back slow in Watchout and does not sync with the audio track.  In After Effects this Hap-encoded file imports at 25fps.


Using "Interpret Footage", I can instruct AE to "conform to 30 fps" and then it syncs ok.  How can I do this in Watchout, or better yet instruct ffmpeg to render to 30fps?

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

This is an old thread, but I just now got around to running the AS SSD benchmark utility on my display computer.  I am unsure how to interpret the scores:


TEST:          READ,  WRITE

Seq  :          2377,    1624

4K    :          41,        262

4K-64Thrd: 1541,    1448

Acc. Time:   0.074,   0.016


SCore 1821, 1847



I am still experiencing periodic drop-outs on certain videos, usually at the same point on the timeline, but not always.  Usually it is output #6 of my AMD FirePro W9100, but sometimes other outputs also.


How can I determine the data rate of the movie file I am using?...It was created using ffmpeg as described above.  Pixel dimensions:3200 x 3200, 30fps.  I tried encoding with both 4 and 8 chunks.  Both versions behave the same

Link to comment
Share on other sites

  • 3 weeks later...

Using HAP on After Effect, the quality slider has NO effect.

There is NO way to use chunks in After Effect or Adobe Media Encoder.


What kind of problems do you face using ffmpeg?


I tested the quality slider in Adobe Media Encoder and there is a huge difference in encoding time when you adjust the slider.  I've had consistent results with this and the 0 quality file always has a lower bitrate.


- Video: 1920x1080 (1.0), 29.97 fps, Progressive, Quality 100, Hap, 00;00;20;00

 - Encoding Time: 00:01:44

- (using Media Info) - overall bitrate - 217


 - Video: 1920x1080 (1.0), 29.97 fps, Progressive, Quality 0, Hap, 00;00;20;00

 - Encoding Time: 00:00:23

0verall bitrate - 210



I haven't tested the playback of these files in Watchout yet.

Link to comment
Share on other sites

  • 2 weeks later...

I just started trying the HAP codec and the new Modul8. But when I use a HAP encoded file, non of the color controls seem to work, neither Auto Color nor the normal controls. I loaded the original H.264 file and with that the colors work perfectly. Any ideas?


edit: tried some more. normal HAP works HAP Q is the problem. Also tried with an official Apple GPU insteas of my GTX570, as that causes some issues with some apps. But this time that didnt change anything.

Link to comment
Share on other sites

  • 7 months later...
10 hours ago, Brecht said:

Unfortunately Adobe has dropped Quicktime support, including HAP en DXV. Anyone has an alternative to render videos to HAP?

Technically it was Apple that dropped QuickTime support.

For now, the best alternative to render directly to Hap from After Effects is probably AfterCodecs:

Personally, I generally render to an intermediate and then encode to Hap separately. You can keep an older version of Adobe Media Encoder for this.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...