Headline number: https://www.toutiao.com/c/user/4298580959/
If you have read my first two articles: "Video from the media people, also with what fast clip, love clip, a few lines of Python to do everything" and "video from the media:" A few lines of Python to do everything "installation method" will want to moviepy this goods still can do? It can be said that it supports a lot of functions, I will release the time behind. Although Moviepy supports features in some graphical software, it has the advantage of being simple to modify and batch-processed as a script. The first thing to say today is how to add your own logo to your video.
Get your logo ready first.
It's better to be transparent, so add it up and don't look abrupt. For example, the logo_sc.png is a transparent image.
Refer to the following code to handle
#!/usr/bin/python3
#-*-Coding:utf-8-*-
From moviepy.editor Import *
def convert (SRC, DST, T1=none, T2=none):
"' Src is the original video file name, DST is the video file name to output"
Print ("Start processing ...")
# t1,t2 is the clip start and end time to process the video
If not T1:T1 = 10
If not t2:t2 = 10
# Load Original video
Clip = Videofileclip (src)
# Clip Original Video
Clip = Clip.subclip (T1, CLIP.DURATION-T2)
# loading your own logo,logo_sc.png requires pre-preparation
Img_clip = Imageclip ("Logo_sc.png")
# put it in the upper left corner and show 20 seconds
Img_clip = Img_clip.set_pos (' Left ', ' top '). Set_duration (20)
# Overlay This logo on a clip-good video
Clip = Compositevideoclip ([clip, Img_clip])
# Output Video
Clip.to_videofile (DST, fps=24, Remove_temp=false)
Convert ("xxx video. mp4", "Output video. mp4", 10, 20)
View Effects
You can see my video "Tribute to the classic, Ford Mustang Bullitt Special Edition released, 500 6-speed manual V8 after drive."
How to add your own logo to a video with Python