Announcing Hap Video Engine

Rob Ramirez's icon

Hey folks, I’m happy to officially announce the new hap video engine package available with Max 7.3.1 via the Package Manager. Those of you with experience using the jit.gl.hap external already know the significant performance gains achievable when playing back HD and UHD files encoded with Vidvox’s excellent Hap codec.

The hap video engine brings optimized Hap playback functionality to both Mac and Windows 32 and 64 bit platforms. The deprecated Quicktime library is no longer required. And since the hap package is installed as a video engine, seamless integration with jit.movie is now possible. After installing the hap package from the Package Manager, you simply create a jit.movie @engine hap @output_texture 1 and you’re off.

There are some caveats and limitations:
- jit.playlist not supported
- output_texture 1 only, no matrix output
- Mac: requires 10.10+
- Windows: no reverse playback

Windows users must also convert their Hap files to AVI file format, the MOV file format is not supported on Windows. In order to encode Hap AVI files, you must install the DirectShow codec found here: http://renderheads.com/product/hap-for-directshow/. After that you can use something like Adobe Media Encoder to create your Hap AVI files.

Mac users can convert using the AVF Batch Converter app found here: https://github.com/Vidvox/hap-in-avfoundation/releases/latest

Francois Weber's icon

hi Rob,

Thanks for this hap engine !
just 2 questions :
1 - it work fine with jit.movie, what about jit.movie~ (audio in MSP) ?
2 - is it better to use local @engine hap or to change it in the Max preferences ?

thanks again
fxw

Rob Ramirez's icon

hi francois

1 - jit.movie~ is backed by the viddll engine, so it supports Hap playback, but through ffmpeg rather than through the native OS libraries of this hap engine. there are some improvements to Hap playback in viddll in a forthcoming update, however the hap engine is the most optimized way to play Hap files on either OS.

2 - there is absolutely no functional difference. whatever's most convenient for you.

Francois Weber's icon

Thanks Rob, It is very clear.

Joseph Hyde's icon

This sounds great, but I'm still on 10.9, and probably not updating that until I get a new machine. I don't suppose there's any chance this could (ever) be backwards compatible, is there? I know, it's probably an annoying question..

Rob Ramirez's icon

nope, sorry. requires OS features only available in 10.10+

there will be some improvements to hap playback in viddll in a forthcoming update, but not as impressive as the native library versions in the hap engine.

jit.gl.hap on 32 bit is still the best solution for

Joseph Hyde's icon

Thanks for the reply Rob, and for the guidance as to the best solution until such time as I update..

Jonas Magnussen's icon

Amazing! Can't wait to test this, will make for a fantastic improvement to my jitter patches.

Bart's icon

Woow... this is great !!! ^^ I assume it's only for playing HAP videos but we never know; is this engine can be used to record HAP videos ?

Rob Ramirez's icon

you can record Hap files on the Mac with [ jit.record @engine viddll @codec hap ]

i wouldn't recommend it for realtime recording though.

Bart's icon

Hi Rob,

Thank you for your answer !

Your non recommendation of realtime recording on mac, is it for the codec hap or for the engine ?

Tiny Orbit's icon

Hi Rob,

Thanks for the update !

I am still on Max 6 but tested it in demo mode with Max 7. Noticed a few things that i would like to mention but all in all, seems like a great update !

1) Now that we are using .AVI files i have noticed that when openinga new file the loading times can be a bit on the high side. When using .MOV files (even for HapQ encoded files) with the Jit.gl.hap engine the load times felt almost instantaneous (sub 30ms) which was great for realtime video sampling. However with .AVI encoded files there is a larger load lag (varies on the file type and size but around 100-200ms). The same is also true for when using .AVI files with the Jit.gl.hap engine.

Is this something that can be improved or is this just inherent with the way .AVI files work ? I am guessing supporting .MOV is not so desirable these days but the loads speeds imo is a real game changer when it comes to real time video sampling.

2) Setting volume to 0 (or any value for that matter) doesnt seem to work yet.

i will keep on debugging and testing !

all the best and thanks for all your hard work rob !

Rob Ramirez's icon

i can look at supporting asyncread behavior for the windows hap engine in a future update, but load times are what they are.

windows hap doesn't currently support playback of audio tracks. are you saying you have a file that has an audio track that you're playing with jit.movie @engine hap and you're hearing the audio track play through the system?

Tiny Orbit's icon

hi,

"i can look at supporting asyncread behavior for the windows hap engine in a future update, but load times are what they are"

In regards to load times, are the longer load times of .AVI files over .MOV files just an inherent aspect of .AVI files or is this something that could be optimized within the engine ?

"windows hap doesn’t currently support playback of audio tracks. are you saying you have a file that has an audio track that you’re playing with jit.movie @engine hap and you’re hearing the audio track play through the system?"

Yes, I am on win10 and when i load up a hap video file the audio just plays without the possibility of being able to adjust the volume. As i am using my own frame counter to play through the video i can just press stop on load which usually shuts it up.

cheers rob !

Rob Ramirez's icon

no idea about load times. hap on windows uses the system direct show libraries, so there's little control i have over those things.

i'll take a look at the audio file playback on win 10.

Tiny Orbit's icon

Ok thanks for your help !

I will revert back to the jit.gl.hap object so i can take advantage of the higher loading speeds !

cheers :)

chrislos's icon

Hey Rob,
Thanks so much for the package.
My HD video playback is amazing smooth now!

On question; For a little generative patch I'd like to randomly jump to different framepositions of a playing jit.movie object.
Pretty straightforward I thought.
But unfortunately there's a noticeable "delay / gap" between each jump. (Not much, but it's still annoying).

Now I'd like to try to have two video instances simultaneously running at the same time and crossfade between both instances to create smooth but fast "jumps" through the video. I guess switching one videos from for- to background and vice versa could do the job.

Since it doesn't dump out a matrix I can't use the jit.xfade object.
Do you have any idea how I could achieve this?

Thanks again.
Best,
C.

chrislos's icon

EDIT: Found a solution. "jit.gl.pix @gen xfade" is doing the job!

best,
c.

chrislos's icon

Hi Rob,

thanks again for this neat hap implementation. Did a good job.

I've got one question Right now I'm switching between 4 full hd simultaniously. (All of them run at the same time).
It works fine on my Macbook Pro Mid 2012 on a NVIDIA GeForce GT 650M 512 MB.

Now I'd like to migrate my installation patch on my older Macbook Pro late 2008 NVIDIA GeFore 9600M GT 256 MB.
It seems that this guy is only capable of playing one "jit.movie @enginge hap" instance at the same time.
Do you have an idea from what issue this limitation is caused?

Thanks and best,
Christian

chrislos's icon

EDIT:
I assume playing two 1080p instances simultaneously wouldn't work with the internal graphic card on a mac mini, as well. Am I right? Otherwise I would've bought a used mid-2012 mac mini machine..

best,
c.

Rob Ramirez's icon

hi chrislos, i can't really answer any of these questions for you. you just have to try it and see. if you have a patch that you'd like some help with possible optimizations suggestions, feel free to post.

it's possible the problem is with disk r/w speed rather than GPU, but that's just a guess.

Rob Ramirez's icon

hey guys, I just pushed hap version 1.0.3 to the Package Manager which fixes the vol attribute on windows. windows hap avi files should now play files with audio tracks and behave appropriately when the vol attribute is adjusted.

Zeger's icon

Sorry if this is a newb question, as i'm just exploring openGL and hap. I have a patch that mixes 4 videos using jit.gl.slab.
I want to add basic effects like jit.brcosa for each video separately. But I can't connect it anywhere in the chain, probably because jit.brcosa is not openGL. Any thoughts?

Rob Ramirez's icon

type [ jit.gl.pix @gen brcosa ] into an object box.

this tells the jit.gl.pix object to load the brcosa gen patcher, which is a factory gen patcher that performs brcosa operations and exposes corresponding attributes for adjustments.

read through the Video and Graphics tutorials for more info.
https://cycling74.com/articles/new-video-and-graphics-tutorials-in-max-7/

haugbui's icon

Hi,

Do anybody know any other software than Adobe Media Encoder to create Hap AVI files on Windows?

Thanks

Florence Glanfield's icon

Hi Rob,

Last semester I created a really successful audio driven visual patch which I used in live performance. I encoded all my videos to hap_alpha which really helped the performance. I'm doing something similar this semester but am not working with videos with audio. I have noticed that when I compress to hap using VVBatchExporter the audio suffers even when I change the settings to no compression for audio. I really want to use the hap engine but not if audio isn't supported.

Julien Bayle's icon

Hi Rob, guys,
any chance for jit.playlist at some point?
I can basically also continue to use some jit.movie with an abstraction layer loading things dynamically, but that would be nice to have that support in jit.playlist.

Rob Ramirez's icon

[edit - remembered this isn't working ]

there's no way to generate the thumbnail images needed for jit.playlist interface, so this probably won't be supported anytime soon.

Julien Bayle's icon

Thanks Rob.
Actually, I "just" need to figure out how to build a small jit.movie based system for doing exactly the same things.
Was just thinking about jit.playlist at the beginning.

ygreq's icon

Doesn't seem to work if you put it in a subpatcher.

Rob Ramirez's icon

should work fine in a subpatcher. possibly just needs a patch restart, possibly needs you to explicitly set @drawto to your gl context name.

Julien Bayle's icon

Any batch converter for windows ?

Rob Ramirez's icon

i believe adobe media encoder will batch process

Anton Kuznetsov's icon

Hey guys,

sorry for the stupid question - how do I get the current frame dump out information in a number box instead of just a print popup? Or do I have to get a metro object counting the frames for me on the side? Thanks.

Rob Ramirez's icon

for historical reasons, "frame" is a message rather than an attribute. to get the current frame simply use getposition and multiply that with the framecount:

Max Patch
Copy patch and select New From Clipboard in Max.

Anton Kuznetsov's icon

Thanks! I found also the way by "route framereport" which worked out well.

Greg Finger's icon

Getting this error: jit.movie: hap video engine not supported - using default viddll video engine

the hap engine can't even be found in the preferences.

Max 7.3.4 x64, Hap 1.0.4, Windows 10

adrjork's icon

Sorry guys, just a silly question: HAP on MAC optimizes the performance on both AMD and Nvidia cards? (I'd like to know that because my Macbook has AMD, while my hackintosh has Nvidia.)
Thanks

Rob Ramirez's icon

HAP performs fine on either GPU

adrjork's icon

Thanks Rob!

Tiny Orbit's icon

I was curious to know the proper way to use the frame $1 message to playback a movie with a counter. With the native Hap external, i was able to use my own custom counters for reading back a movie , however with this implementation i am not having so much luck, such method seems to grind Max to a halt when i approach a reasonable frame rate, meaning i need restart.

Here is an example of what would work with the Hap object :

Max Patch
Copy patch and select New From Clipboard in Max.

Rob Ramirez's icon

get rid of the pwindow and replace it with a vizzie viewer module if on Max 8, or a preview shared context if on Max 7.