I have a code that gets a picture and some text and creates a video. Everything looks fine until the last line which is supposed to save the video created on the local drive. Here is the code:
from moviepy.editor import *
# set up the video dimensions and duration
width, height = 640, 480
duration = 10 # duration of the video in seconds
# create a clip with a static image
image_clip = ImageClip('picture.jpg').set_duration(duration)
# create a text clip with some text
text_clip = TextClip('Hello, World!', fontsize=50, color='white').set_duration(duration)
# set the position of the text clip
text_clip = text_clip.set_pos('center')
# combine the image and text clips into a final video clip
final_clip = CompositeVideoClip([image_clip, text_clip])
# write the final clip to a video file
final_clip.write_videofile('output.mp4', fps=30)
when I run the last line error below shows up:
TypeError: must be real number, not NoneType
I changed the last line to:
final_clip.write_videofile('output.mp4')
and again the same error!
Can you please help me on this!
Thanks,
Masoud