Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.09k stars 1.51k forks source link

with_opacity unexpected behavior #2058

Open Goyet-Christopher opened 8 months ago

Goyet-Christopher commented 8 months ago

I wanted to change the opacity of a clip, so I called again 'with_opacity' to change the value.

clip = clip.with_opacity(0.5)
clip = clip.with_opacity(0.75)

Expected Behavior

Setting the new value of the mask, for the final composition encoding.

Actual Behavior

But it increased the opacity even more. Because, this function applies 'transform_image' to the mask.

Steps to Reproduce the Problem

Try: some_clip.with_opacity(0.5).with_opacity(0.5)

Possible changes ?

One possible change could be to store the desired opacity in a variable and apply it only at the end to the final clip. This doesn't contradict the use of an specific alpha mask. I was expecting an approach that would resemble the use of layers in Gimp or Photoshop...

Specifications