Incorrect behavior of Opacity filter with dissolve transition

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:

  1. Create 2 video tracks. The bug is not about the number of tracks but the second track makes it easily visible.
  2. Add one clip on the top video track and any not blank image on the bottom track.
  3. Cut the top track into 3 clips and apply the opacity filter of 50% to the middle clip.
  4. Produce cross fade dissolve transitions between middle and left and right and middle clips.
  5. 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.
  6. 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).

Problem scope:
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.

I reproduced this issue. It is a bug. Used color clips for the video because it’s easier to see the problem.

https://streamable.com/vqf5v

image

I posted on this problem a few days ago. I too can reproduce a problem. Occurs with fades and dissolves.

-=Ken=-

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.

Was going to file a new Topic, but I’m guessing this is the same issue.

  • Shotcut Version number: 18.06.02

  • Shotcut Settings:

    • GPU Effects (Experimental) enabled: No
    • Video Mode: Automatic
    • Display Method: OpenGL
  • Operating System: Windows 8.1

  • Computer Specifications:

    • Processor: Intel® Core™ i7-4702MQ CPU @ 2.20GHz, 2201 MHz, 4 Core(s), 8 Logical Processor(s)
    • Installed Physical Memory (RAM): 16.0 GB
    • Available Physical Memory (RAM): 5.10 GB
  • Screenshot of Shotcut:

  • Source File(s) Specifications:

    • Codec/Extension types: PNG 32bpp
    • Resolution: 1280x640
    • Frame rate: n/a
    • Bit rate: n/a
  • Export File Specifications: n/a

  • MLT file: transition_error.zip (40.8 KB)

  • Did you watch all of the Tutorials?: Yes

  • Did you read the FAQ? (Frequently Answered Questions): Yes

  • Did you search the forum for your issue?: Yes

  • Post Type: Bug

  • Provide steps that anyone could follow to recreate the problem:
    Given two images with alpha:

    1. Add image A to the timeline
    2. Add image B to the timeline next to image A
    3. Drag the clip for image B partially over the clip for image A to generate a transition
  • Observed behavior: Clip B fades in, but clip A does not fade out.

  • Expected behavior: Clip B fades in while clip A fades out.
    4. Change transition type to e.g. “Bar Horizontal”

  • Observed behavior: Clip A remains on screen with clip B effectively being masked off by clip A. The transparent parts of clip B are no longer transparent.

  • Expected behavior: A transition between clips A and B that do not alter transparency of the original clips.

  • Workarounds:

    • For the ‘Dissolve’ transition: place both clips overlapping on separate tracks, and use the Opacity filter with Keyframes to animate each clip’s opacity.
    • For several other basic transitions: place both clips overlapping on separate tracks, and use the Mask filter with keyframes to animate a shape masking the clip.
    • For complex transitions: TBD

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 reproduced this bug and found the source of it. I am working on the fix, but there may be reduced performance as a result.

1 Like

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.

alpha-dissolve.mlt (12.1 KB)

(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?