I am able to do many of the vfx without problem, but some of them give me trouble, like Blink.
I put in:
clip = clip.fx(vfx.blink, d_on=1, d_off=1)
and I get the error:
NameError: global name 'copy' is not defined
@evanthemann , I've just pushed a fix for this error to the repo. Can you pull from it, and try again?
I just tried again.
clip = TextClip('hello world', size=(1280,720), color='white')
clip2 = clip.fx(vfx.blink, d_on=1, d_off=1)
clip2.set_duration(5)
clip2.write_videofile('testclip.mp4', codec='libx264', fps=24)
did not give me any errors, but the video didn't blink at all.
Tried with a VideoFileClip:
video = VideoFileClip('testclip.mp4')
videofx = video.fx(vfx.blink, d_on=1, d_off=1)
and I got this error:
AttributeError: VideoFileClip instance has no attribute 'with_mask'
VideoClip.py used to have a with_mask function, which is defined below. Should we put this back in or should we modify blink and on_color so they do not use this function anymore?
def with_mask(self, constant_size=True):
"""
Returns a copy of the clip with a completely opaque mask
(made of ones). This makes computations slow compared to having
a None mask but can be useful in many cases. Choose
:param constant_size: `False` for clips with moving image size.
"""
if constant_size:
return self.set_mask(ColorClip(self.size, 1.0, ismask=True))
else:
mask = VideoClip(ismask=True).set_get_frame(
lambda t: np.ones(self.get_frame(t).shape))
return self.set_mask(mask)
@Zulko, I've modified blink and replaced the with_mask function with add_mask, but the video produced still does not blink. Is there an issue with the following line:
newclip.mask = newclip.mask.fl( lambda gf,t: gf(t)*((t % D) < d_on))
I'm getting AttributeError: 'VideoFileClip' object has no attribute 'with_mask'
this is the code
from moviepy.editor import VideoFileClip, CompositeVideoClip, vfx
clipa = VideoFileClip("video//1.mp4")
clipb = VideoFileClip("video//2.mp4")
clipa = clipa.fx(vfx.blink(clipa, d_on=0.10, d_off=0.10))
fcut = CompositeVideoClip([clipb, clipa])
fcut.write_videofile("outbb.mp4")
Just do clipa = clipa.blink(clipa, d_on=0.10, d_off=0.10)
AttributeError: 'VideoFileClip' object has no attribute 'blink'
Most helpful comment
@Zulko, I've modified blink and replaced the with_mask function with add_mask, but the video produced still does not blink. Is there an issue with the following line: