MoviePy加水印

电脑技术 电脑技术 1404 人阅读 | 0 人回复 | 2022-04-09

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
https://shenli.dev/2015/10/18/ho ... eo-with-python.html
from moviepy.editor import *

my_clip = VideoFileClip("../../videos/moi_ukulele.MOV", audio=True)  #  The video file with audio enabled

w,h = my_clip.size  # size of the clip

# A CLIP WITH A TEXT AND A BLACK SEMI-OPAQUE BACKGROUND

txt = TextClip("THE WATERMARK TEXT", font='Amiri-regular',
                       color='white',fontsize=24)

txt_col = txt.on_color(size=(my_clip.w + txt.w,txt.h-10),
                  color=(0,0,0), pos=(6,'center'), col_opacity=0.6)

# This example demonstrates a moving text effect where the position is a function of time(t, in seconds).
# You can fix the position of the text manually, of course. Remember, you can use strings,
# like 'top', 'left' to specify the position
txt_mov = txt_col.set_pos( lambda t: (max(w/30,int(w-0.5*w*t)),
                                  max(5*h/6,int(100*t))) )

# Write the file to disk
final = CompositeVideoClip([my_clip,txt_mov])
final.duration = my_clip.duration
final.write_videofile("OUT.mp4",fps=24,codec='libx264')
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

热门推荐