I’m trying to mix clips together by fading one into the other (though the same problem applies to all the other transition effects as well), and when I have a black background it works fine. However when I put a coloured background behind it (background on V1, image slides on V2) and mix the slides into one another, the background bleeds through during the animation. Is there any way to stop this?
We can’t see what filters you have on the Slide 1 clip. But something is adding transparency to it.
For example, if you have applied the Size, Position & Rotate filter to Slide 1, change the background color so that it is not transparent:
As far as I can tell I haven’t applied any filters. I’m uploading the project file.
output-bg-bleed-poc.mlt (15.7 KB)
It’s actually not just a background video that shows through, it’s anything other than the default “black background” producer. If I put a black image slide behind, it darkens the slides in front. If I hide it, they’re no longer darkened.
I see your clips are png images. That must be where the alpha channel is coming from. If you change your clips to jpg, you won’t see the problem.
This looks remarkably similar to this older bug that is reported as being fixed:
There are some workarounds listed in that discussion that both worked for me. The easiest workaround is to add the Alpha Adjust filter to the track. I tried it and it worked for me.
@shotcut is this a regression for that old bug? Or maybe a new version of the bug?
It is a little different. The alpha channels must also be blended during the transition: for example, two text clips in transition.
The trouble with that is that it destroys partial transparency. Go below the threshold and the pixels are hidden, above and they’re 100% solid. I guess I can get away with that here because my slides use very little partial transparency but it isn’t great.
But how come the alpha channel is dipping in the middle? If two images have alpha 255 for a certain pixel, going from A to B should mean staying at 255 the whole way through, no?
Also, how come the phenomenon doesn’t happen for the default black background producer? It looks like it should provide black pixels everywhere just like an image producer with a solid black image should, yet it doesn’t cause the problem:
<producer id="black" in="00:00:00.000" out="00:00:12.983">
<property name="length">00:00:13.000</property>
<property name="eof">pause</property>
<property name="resource">0</property>
<property name="aspect_ratio">1</property>
<property name="mlt_service">color</property>
<property name="mlt_image_format">rgba</property>
<property name="set.test_audio">0</property>
</producer>
Thinking about it, I suppose the reason that alpha drops below 255 in the middle is that the two images are being masked together, with both having 50% alpha at the middle of the transition, resulting in maybe 80% opacity when combined? Maybe the transition should handle the alpha channel differently from the colour channels, adding the alpha values together instead of masking them. That way you’d add together the two alpha channels at 50% and come back to 100% again. It should result in a good alpha channel transition from A->B.
I’ve run into the same thing. In many of my videos, V1 has video footage, and there are places where V2 has something like a map or a photo that overlays part of the screen. If I want to do a transition (for instance, the same map, but with the “you are here” marker moving from one spot to another) and I just do it as a transition on V2, the background starts to show through the map in the middle of the transition, when what I really want is the map, which in both cases is 100% opaque, remaining entirely opaque with the markers fading in and out. For an example, have a look at the maps and their transitions starting at around 6:30 in this video (and hey, might as well watch the whole video while you’re at it ).
I understand that behind the scenes this is likely because the transition is done by changing the alpha on the clips/images that are transitioning, and as Jez suggests, that results in less than 100% opacity in the middle. But it’s a somewhat surprising result that a transition from a thing that’s 100% opaque to a thing that’s 100% opaque results in a transition that isn’t 100% opaque.
Anyway, it’s easy enough to work around in many cases - I put the new overlay on V3, overlapping with the end of the overlay on V2, and put a video fade in filter on the one on V3. And if that one needs to fade to something else, the something else can go on V2, with a video fade out filter on V3.
Problem with that workaround is, don’t you lose a lot of the nice mix transition effects? When you do the standard mix you can go to properties and get things like matrix waterfall, matrix snake, barn door, etc.
It comes from this line, which is based on the Porter-Duff “over” algorithm:
From that page
After you distribute the multiplication:
alpha_out = alpha_a + alpha_b - alpha_b * alpha_a
Same as the code above.
If you put actual values in:
>>> mix_a = 0.5
>>> mix_b = 0.5
>>> mix2 = mix_b + mix_a - mix_b * mix_a
>>> mix2
0.75
how come the phenomenon doesn’t happen for the default black background producer?
Shotcut does not blend with the hidden black background.
Problem with that workaround is, don’t you lose a lot of the nice mix transition effects?
The Mask: From File video filter lets you use all of the available wipes in a multitrack transition; however, you do need to keyframe the Threshold between 0 and 100%.
You can also add it to the transition to be more precise and not adversely affect other things on the track.
Correct, but here is what a dissolve between two text clips looks like BTW, which is not too bad? The eye has to process more about the shapes and not noticing the translucent intersections. Here A appears to naturally fade out while B fades in. Also, often a real world transition is faster than this and even less noticeable.
I’m not doing text clips though, I’m doing large cards where the background is much more noticeable. Is there a reason why you can’t add an option to the filter so it just adds the alphas together instead? 255 * 0.5 + 255 * 0.5, capped between 0 and 255, where 0.5 represents how far through the transition you are from 0 through 1 and the 255’s represent the alpha values of the A and B pixels.
I tested it and agree to make that change. I think the Porter-Duff over alpha handling is more appropriate for general composite than a dissolve. The change also makes it consistent with GPU Effects.
Cool, will it be in the next version?
yes, version 24.11 is expected soon (no beta, low risk fixes only release) but you can get tomorrow’s daily build on our GitHub Actions page.
Great, I’ll check the new filter with my project once it’s out.
I have the latest build from this morning and whilst it fixes the problem for the Dissolve effect it’s still there for all the others (Matrix snake, etc.). Maybe that’s what your comment was meant to indicate, but I’d really like this fix to be for all effects. If you don’t think it’s appropriate to use this alpha handling mechanism for the other effects by default, how about adding a checkbox that lets me turn it on?
I extended the change to include wipes.
Very nice, I look forward to trying out tomorrow morning’s build.