Alpha chanel in "sub" mlt file

I am doing a series of videos. In all of them, at some point in the beginning, I use the same “vignette” with the series title (the name of the course discipline). So, I created a vignette.mlt file.

The file contains some tracks and “png” files with transparency.

When I include vignette.mlt as a clip in lecture_1.mlt, it looses its transparency.

The odd part is that if I open vignette.mlt and go to “output filters” (click on “output” and add a “global” filter to it) and add a “chroma key for the black color”, then transparency of vignette.mlt in lecture_1.mlt works!!! Well… kind of… the “png” transparency is lost. It becomes “black” and the “black” is chromakeyed out. But the result is of very bad quality.

It looks to me that the xml producer is cutting off the png transparency, but it is not cutting off the final result transparency!?

Any ideas on how to do it properly?

Does this help (please note the restrictions described):

I wrote this tutorial last year.

This seems to require that I apply a black chroma key. I am doing it right now. But the result is ugly, because the transparency is not 0 or 1.

[…] it must have defined a non-opaque alpha channel […]

How do I “define a non-opaque alpha channel”?

When I setup the filter Alpha Channel: View, I can see that every clip in track (png files) have transparency (black). But when I put the filter on the whole “Output”, it is all white. So, I guess I do not have this non-opaque alpha channel setting.

Pour créer votre clip transparent:
Mettez un clip de n’importe quelle couleur sur V1
Créez votre clip avec transparence sur V2 et sur les pistes supérieures si nécessaire.
Juste avant de l’enregistrer, rendez la piste V1 invisible (Symbole de l’œil)

Lorsque vous importez le mlt dans un autre projet il conserve alors sa transparence (il doit bien sur être au dessus d’une autre piste)

To create your transparent clip:
Put a clip of any color on V1
Create your clip with transparency on V2 and on the upper tracks if necessary.
Just before save it, make the V1 track invisible (eye symbol)

When you import the mlt into another project it will keep its transparency (it must of course be on top of another track)

Thank you very much! The problem is that the alpha channel is lost whenever I have more than one visible track (eye symbol).

I used the word “vignette” because I didn’t know how to properly call the thing in English. The word in Portuguese is “vinheta”. I do not really speak French. :sweat_smile: :blush:

But thank you a lot for being so kind. :slight_smile:

Thanks a lot! Unfortunately, it seems that whenever you have more than one visible track, the transparency is lost. :frowning:

Is it a bug in MLT? As far as I understood, this has nothing to do with “nesting”. What seems to be happening here, is that MLT is throwing away the transparency when it merges two tracks. I do not want to look at MLT’s code… :woozy_face: but I guess I will have to… :frowning:

It would help us to understand if you could post a screenshot of the whole Shotcut window with just the “vignette” MLT open. If it consists of a single track with a transparent PNG + filters applied to it then it should work as you are trying to use it. If it is multiple tracks it won’t (as per the description in the thread I posted).

One other possibility instead of using the MLT as a clip is to export it in a transparent (alpha channel) format (e.g. Quicktime Animation) and then use that as a clip instead.

A question for the (MLT) gurus… @shotcut, @brian, etc… :slight_smile:

In shotcut, when I click on the “eye symbol” to disable a track (say, track 2), the only thing that happens is that hide="video" is added to the <track> xml tag. In the end of the XML file, there is a <transition> tag “cairo blending” the hidden track 2 and track 1.

So, my question is:

In this case, is the frei0r.cairoblend service actually called, or is it bypassed because of this hide="video" in track 2?

I think I understood it.

Tracks are mixed using frei0r.cairoblend. The cairoblend does the job using the alpha channel information. However, it seems that when it “paints” on the canvas (track number 1), it erases the alpha information. Blending works while doing transitions from tracks with alpha information to track 1. But the resulting final image, in track 1, has no alpha information. :frowning:

It seems that when calling frei0r_cairo_premultiply, alpha should be set to -1. Also, when calling `frei0r_cairo_premultiply2.

But, the f0r_update2 method calls it with 0xff.

@shotcut and @brian, is it considered a “bug” in the frei0r cairoblend code?

It works!!!
The vignette video has four tracks. Every track has transparency.

I have submitted a pull request to frei0r.

To me, it looks like the xml producer is also messing a little with the alpha channel. Partial transparency is just becoming a darker color. Needs investigation…

This topic was automatically closed after 90 days. New replies are no longer allowed.