|
|
|
@ -35,14 +35,13 @@ class Video:
|
|
|
|
|
return ImageClip(path)
|
|
|
|
|
|
|
|
|
|
def add_watermark(self, text, opacity=0.5, duration: int | float = 5, position: Tuple = (0.7, 0.9), fontsize=15):
|
|
|
|
|
print(len(text))
|
|
|
|
|
compensation = round((position[0] / ((len(text) * (fontsize / 5) / 1.5) / 100 + position[0] * position[0])), ndigits=2)
|
|
|
|
|
position = (compensation, position[1])
|
|
|
|
|
print(f'{compensation=}')
|
|
|
|
|
print(f'{position=}')
|
|
|
|
|
#print(f'{compensation=}')
|
|
|
|
|
#print(f'{position=}')
|
|
|
|
|
img_clip = self._create_watermark(text, opacity=opacity, fontsize=fontsize)
|
|
|
|
|
img_clip = img_clip.set_opacity(opacity).set_duration(duration)
|
|
|
|
|
img_clip = img_clip.set_position(position, relative=True) # set position doesn't work for some reason # fixme
|
|
|
|
|
img_clip = img_clip.set_position(position, relative=True) # todo get dara from utils/CONSTANTS.py and adapt position accordingly
|
|
|
|
|
|
|
|
|
|
# Overlay the img clip on the first video clip
|
|
|
|
|
self.video = CompositeVideoClip([self.video, img_clip])
|
|
|
|
|