from moviepy.editor import VideoFileClip, TextClip from moviepy.video.fx import resize # Load a video clip (you can replace 'input_video.mp4' with your video file) video = VideoFileClip('input_video.mp4') # Create a text message (proposal message) proposal_message = TextClip("Will You Marry Me?", fontsize=70, color='white') proposal_message = proposal_message.set_duration(10) # Adjust the duration # Position the text in the center proposal_message = proposal_message.set_position('center').set_opacity(0.5) # Resize the video to match the text clip (if needed) video = resize(video, height=proposal_message.h) # Overlay the proposal message on the video final_video = video.set_audio(None).blit_on(proposal_message) # Write the final video to an output file (e.g., 'proposal_video.mp4') final_video.write_videofile('proposal_video.mp4', codec='libx264')