Original AI Prompt
Generate & Play Hailuo AI video:import os try: from moviepy.editor import * from gtts import gTTS except ModuleNotFoundError as e: print("Error: Make sure the 'moviepy' and 'gtts' libraries are installed.") print("Install them with: pip install moviepy gtts") exit() # Text of the narration txt = "Did you know that robots can solve a Rubik's cube in fractions of a second? The world record belongs to the robot Sub1 Reloaded, which solved the cube in just 0.637 seconds!" # Generate audio with gTTS audio_file = "narration.mp3" tts = gTTS(txt, lang='en') tts.save(audio_file) # Create audio clip audio = AudioFileClip(audio_file) tempo_audio = audio.duration # Duration of the audio # Create image clips try: img1 = ImageClip("robo1.jpg").set_duration(tempo_audio/2) img2 = ImageClip("robo2.jpg").set_duration(tempo_audio/2) except FileNotFoundError as e: print("Error: Make sure that the images 'robo1.jpg' and 'robo2.jpg' are in the directory.") exit() # Resize images img1 = img1.resize(height=720) img2 = img2.resize(height=720) # Create animated title txt_clip = TextClip("How Fast Can Robots Solve the Magic Cube?", fontsize=50, color='white') txt_clip = txt_clip.set_position('center').set_duration(3) # Create final video video = concatenate_videoclips([txt_clip, img1, img2]) video = video.set_audio(audio) # Export video video.write_videofile("video_final.mp4", fps=24) # Clean up temporary audio file os.remove(audio_file) print("Video generated successfully!")
AI-Powered Analysis
The video showcases the speed and precision of AI-generated robots solving a Rubik's cube.