-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue 2269 - And a lot of other things #2307
Conversation
… need to fix reading i think
…ec on video reading with alpha channel for vp8 and vp9
…ncy support, all transparency was actually buggy, both during rendering and reading. Also complete refactor of CompositeVideoClip compositing to properly support tranparency with CompositeVideoClip including one or more CompositeVideoClip, and transparency in general who was completly buggy
I will give it a few days for other to look at the PR and flag anything they think is wrong, then if not protest will proceed with merging ! |
@@ -67,6 +67,8 @@ def __init__( | |||
if bg_color is None: | |||
bg_color = 0.0 if is_mask else (0, 0, 0) | |||
|
|||
print(clips) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Print here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will fix this and include the changes in your PR in this one, as well as adding a unit test
I'll publish with a new tag 2.1.2 tomorrow |
@OsaAjani It seems that the release takes a little longer. Can you share a new (rough) ETA? |
Sorry, last days where more about home fixing than coding ^^. Definitely in the week. |
No problem, thanks for the update! Was just checking frequently the past days to see whether it already got released. 😄 |
Done. |
Thanks! Looks as if the publish to PyPI failed, though? The logs indicate that the file already existed, or something like that. |
I fixed it |
Awesome! Just updated with pip and can confirm that the transparency problems in #2269 are fixed now, for me! |
@claell actually after a few tests I think this PR mostly solved the aliasing problem with text, at least judging by this example: from moviepy import *
import numpy as np
vclip = VideoFileClip('../resources/bbb.mp4').subclipped(10, 11)
tClip = TextClip(duration=3, font="../resources/font/example.ttf", text="Some string", color="red", font_size=250, bg_color="black")
tClip.show(1)
tClip2 = TextClip(duration=3, font="../resources/font/example.ttf", text="Some string", color="red", font_size=250)
bg = ColorClip(tClip2.size, color=(255, 255, 255))
print(np.unique(tClip2.mask.get_frame(1)))
cClip = CompositeVideoClip([vclip, tClip2, tClip2.with_position(("center", "center"))], use_bgclip=True)
cClip.show(1) |
TL;DR: Transparency was broken all around, I fixed it.
What started as a "quick fix" for issue #2269 rapidly escalated into (re)discovery (see #2012 (comment)) of multiple bugs in regards to transparency handling in moviepy. To summarize, transparency was plain and simple broken :
Basically the only part that was working as intended was composite clip with basic clips inside, and a fully opaque background.
I also added codec extraction to FFMPEGParser when possible, as this info was required for proper transparency handling on ffmpeg.
I think this should fix not only #2269, but also #2109, #2082, #2008, #1978, #1935, #1881, #1821, #1759, #1301, #896, #400, and probably others I just dont know about...
tests/