Skip to content

Commit 21e2dd7

Browse files
authored
Add files via upload
1 parent 0f577b2 commit 21e2dd7

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

blog29-MoviePy/test02.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from moviepy.editor import *
2+
3+
#加载视频5-10片段
4+
clip = VideoFileClip("cat02.mp4").subclip(5,10)
5+
print(type(clip))
6+
7+
#降低音量x0.8
8+
clip = clip.volumex(0.8)
9+
10+
#生成文本 自定义颜色字体
11+
text = "CSDN Eastmount 2020"
12+
txt_clip = TextClip(text, fontsize=70, font='Simhei', color='blue')
13+
14+
#屏幕中央显示5秒
15+
txt_clip = txt_clip.set_position('center').set_duration(5)
16+
17+
#Overlay text on video
18+
result = CompositeVideoClip([clip, txt_clip])
19+
20+
#写入文件
21+
result.write_videofile("cat02_edited.mp4")

0 commit comments

Comments
 (0)