Hello, I believe this behavior should be classified as a bug unless it’s by design which needs to be confirmed, of course.
How to reproduce:
Create 2 video tracks. The bug is not about the number of tracks but the second track makes it easily visible.
Add one clip on the top video track and any not blank image on the bottom track.
Cut the top track into 3 clips and apply the opacity filter of 50% to the middle clip.
Produce cross fade dissolve transitions between middle and left and right and middle clips.
Move the image on the bottom track underneath the middle clip with the opacity effect and resize it so its duration is the same as the middle track plus both transitions.
Play the video starting anywhere before the left (first) transition.
Observed behavior reproduced consistently:
The video will not smoothly transition on the left side of the middle clip but will smoothly transition on the right side of the middle clip.
Expected behavior: smooth transition on both sides of the middle clip with reversed effect: smooth fade in of the background image on the left and smooth fade out on the right.
This effect does not happen with other filters, for example, the blur filter and/or text filter will work smoothly (fade-in on the left and fade-out on the right).
I haven’t tried with all existing filters, but the opacity filter definitely has a problem. I guess something in the transition algorithm incorrectly calculates the pixels when the opacity on the right side of the transition is less than 100%.
Is this urgent? I guess not, because it can be worked around by creating two tracks with the same content and applying fade-in/fade-out filters manually, which is doable but really time-wasteful and error-prone.
So, because some other filters work (which is really nice especially when adding a text filter) I suppose the approach is correct but something was not tested with the opacity filter. Just wanted to let you know.
In case this saves anyone some time if/when they go to work on this bug: I don’t think this is a bug related specifically to the filter part of the Opacity filter, because I can recreate the examples using color clips that have less-than-FF alpha values. Going from a lower alpha value to FF seems to work fine (or maybe I just can’t tell), but going from totally opaque or partially opaque to partially opaque seems to end up with the wrong alpha value/blend/something at the end of the transition.
I’m having this same issue with the most current version, 19.01.27 (as of 2/13/19). However, in my case, the only transition that works when the first clip is transparent or opaque is “dissolve”. None of the other transition type function properly.
I was working on a project where I had a crossfade between two clips with transparency, and the track underneath was bleeding through everywhere, not just in the spots that had alpha. Here’s a minimal example of the behavior:
Take red with a tiny bit of transparency, color = #FEFF0000, and make a crossfade dissolve to itself. It should remain the same color and alpha throughout, but instead alpha drops to 75% at the halfway point.
Take red with a tiny bit of transparency, and make a crossfade dissolve to green. In addition to the alpha behavior as in the last example, it should also be 1/2 red and 1/2 green at the halfway point, but instead it’s 1/3 red and 2/3 green.
(I’ve attached an mlt file, you can turn on the “video histogram” scope to see the color values, and you can turn on the second track’s “alpha channel: view” filter to better see what’s going on with alpha rather than inferring from the blue bleeding through. The first half shows the two transitions with alpha 254 and the second half shows them with alpha 255.)
I can’t imagine this is the expected behavior, but I looked through the source code, and I think I see in transition_luma.c where the 75% and 1/3-2/3 come out of the “mix2” section. So I guess my questions are (1) is this a bug or the expected behavior, and (2) is there a way to change the “mix2” section to fix the two examples?