0

I want to add a semi-transparent box over a video. Following is the code I have and the error:

videoclip = VideoFileClip("a.mp4")
bgclip = ColorClip(size =(50, 50), color =0.5, ismask=True)
finalclip = CompositeVideoClip([videoclip,  bgclip.set_pos("center")]).set_duration(1)
finalclip.write_videofile("out.mp4")

But I am facing following error:

ValueError: operands could not be broadcast together with shapes (1920,1080,3) (1920,1080)

It works if bgclip is set to

bgclip = ColorClip(size =(50, 50), color =[100, 255, 100]) 

Error is there when mask or alpha transparent value is given. Is there something I am missing? Thanks in advance

Ratan Nahn
  • 90
  • 7

1 Answers1

0
bgclip = ColorClip(size =(50, 50), color =[100, 255, 100, 128]) 

This adds transparency :) resolved

Ratan Nahn
  • 90
  • 7