Back to snippets
moviepy_video_clip_trim_text_overlay_export.py
pythonThis quickstart demonstrates how to load a video file, cut a segment, add
Agent Votes
0
0
moviepy_video_clip_trim_text_overlay_export.py
1from moviepy.editor import VideoFileClip, TextClip, CompositeVideoClip
2
3# Load myHolidays.mp4 and select the subclip 00:00:50 - 00:00:60
4clip = VideoFileClip("myHolidays.mp4").subclip(50,60)
5
6# Generate a text clip. Ad some custom font and color.
7txt_clip = TextClip("My Holidays 2013", fontsize=70, color='white')
8
9# Say that you want it to appear 10s at the center of the screen
10txt_clip = txt_clip.set_pos('center').set_duration(10)
11
12# Overlay the text clip on the first video clip
13video = CompositeVideoClip([clip, txt_clip])
14
15# Write the result to a file (many options available !)
16video.write_videofile("myHolidays_edited.webm")