Luma matte not working

Hi Shotstack community,

I am having trouble with luma mattes :confused:

in the above demo code, you have just two assets - the luma and the initial video

however, what would the code look like to have…

  1. INITIAL VIDEO - 0 seconds to 5 seconds
  2. LUMA TRANSITION - 3.6 to 5 seconds
  3. SECOND VIDEO - 3.6 to 5+ seconds

that’s the idea isn’t it, to have the luma transition between two assets?

however I can’t seem to get the layering right

and when I add a second video it hides the luma entirely

I presume there is some issue here with tracks, clips, timeline, ordering etc which I haven’t worked out…

please help

thanks in advance :grinning:

It should all work as described in the article. It is important to get the layering correct. The technique is actually called a track matte. The best way to visualise it is you have a track, in the track clip with a video or image asset. Then in the same track you need to add a clip that will be the mask using the luma asset type. The luma will punch a transparent hole through whatever clip (image or video) is in the same track. The order of the luma and image/video clip in the track doesn’t matter, just that they are in the same track.

Once the whole is punched through the clip in the track it will reveal whatever is in the track below it.

Also note that it is possible to do this visually via our Studio online video editor. For example you can copy and past the JSON from this example here in the video editor and see it working: Arrow luma matte transition video template — Shotstack

Keep trying, it is all possible.

If you want post a simplified version of your JSON here and we might be able to have a look.

1 Like

Thank you Lucas.

I will reflect on this, play with the Studio editor - and do some more tests.

Also, while this thread is active, I did want to ask something else that isn’t clear in my mind:

Does the luma/track matte technique work with both mp4 and mov file?

I had some luma transitions prepared by a video editor - and the editor was insistent that only .mov have transparency.

However, I notice that in your example (the link right at the start of my first post) you are using an MP4.

Does this luma technique work with both mp4 and mov - can both be transparent, provided it is encoded into the file luma mp4/mov file correctly?

Thanks again.

Luma masks will work with both mp4 and mov files. The luma clip actually creates the transparency as described in our article:

“Luma mattes are created from grey-scale images or animations where white is fully transparent, black is opaque, and everything in between is a varying degree of transparency. The video below is an example of a luma matte, it is an mp4 video file with a black and white animation.”

But your designer is correct that only QuickTime mov files can have transparency. We call these overlays and they work with our editor too. An overlay already has the transparency built in to it and it is useful for going over the top of other clips.

We have two articles on our website for designers that show you how to make a luma matte/mask and how to create an overlay using After Effects and use them with Shotstack:

that’s great, thanks Lucas.

I appreciate the in-depth help - and the links

Lucas, thanks for the helpful explanation. I’ve always believed that luma masks only work with specially-prepared .mov files. Based on your explanation, I’m going to attempt to get my transitions to work with .m4 files, which are much smaller in size and will render faster and are easier to use. Thanks again.

1 Like

@arudt using mp4s for the luma definitely means smaller files sizes and downloads. The actual rendering of lumas is a bit slower than regular videos though.

Also I recently discovered GoPro Cineform codec in Premiere and AfterEffects which supports alpha channel but the file size is much smaller than the Animation codec I have used in the past. Still big but you get a much smaller file.