xxxxxxxxxx
# Import everything needed to edit video clips
from moviepy.editor import *
# loading video dsa gfg intro video
clip = VideoFileClip("dsa_geek.mp4")
# clipping of the video
# getting video for only starting 10 seconds
clip = clip.subclip(0, 10)
# Reduce the audio volume (volume x 0.8)
clip = clip.volumex(0.8)
# Generate a text clip
txt_clip = TextClip("GeeksforGeeks", fontsize = 75, color = 'black')
# setting position of text in the center and duration will be 10 seconds
txt_clip = txt_clip.set_pos('center').set_duration(10)
# Overlay the text clip on the first video clip
video = CompositeVideoClip([clip, txt_clip])
# showing video
video.ipython_display(width = 280)
xxxxxxxxxx
# Import everything needed to edit video clips
from moviepy.editor import *
# loading video file clip
clip = VideoFileClip("geeks.mp4")
# clipping of the video
# getting video for only starting 10 seconds
clip = clip.subclip(0, 5)
# Reduce the audio volume (volume x 0.5)
clip = clip.volumex(0.5)
# Generate a text clip
txt_clip = TextClip("GfG-MoviePy", fontsize = 75, color = 'green')
# setting position of text in the center and duration will be 5 seconds
txt_clip = txt_clip.set_pos('bottom').set_duration(5)
# Overlay the text clip on the first video clip
video = CompositeVideoClip([clip, txt_clip])
# showing video
video.ipython_display(width = 280)
xxxxxxxxxx
#if you're having some trouble with ImageMagick
from moviepy.config import change_settings
IMAGEMAGICK_PATH = r"C:\Program Files\ImageMagick-7.1.1-Q16-HDRI\magick.exe"
change_settings({"IMAGEMAGICK_BINARY": IMAGEMAGICK_PATH})
#insert this code snippet to your current script
#this article explains it further https://dev.to/amr2018/create-video-from-text-clips-using-python-and-moviepy-5867