Documentation Index Fetch the complete documentation index at: https://docs.magichour.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Animation transforms static images into dynamic animated videos with smooth motion and camera effects. The API creates engaging stop-motion style animations, adding movement, depth, and visual effects. You can optionally provide an image as a starting point and add audio for synchronized effects.
Product Page Learn more about Animation
How It Works
Provide a prompt - Describe the animation you want to create
Optionally add an image - Use a starting image for the animation
Optionally add audio - Include audio for synchronized effects
API generates the animation - AI creates smooth animated video
Download the result - Retrieve your animation video
Use Cases
Music videos - Create visually engaging content for songs
Social media content - Eye-catching animated posts and stories
B-roll footage - Generate supplementary video content
Creative projects - Artistic animations and motion graphics
Animated avatars - Moving profile pictures and characters
Best Practices
Using Source Images
When providing a starting image:
Match the style - The prompt should complement your image
High quality - Better images produce better animations
Clear subjects - Well-defined subjects animate more smoothly
Audio Synchronization
When adding audio:
Match the mood - Audio should complement the visual style
Consider timing - Longer audio = longer video
Supported formats - MP3, WAV, AAC, FLAC
Code Examples
Basic Animation from Prompt
from magic_hour import Client
import os
client = Client( token = os.getenv( "MAGIC_HOUR_API_KEY" ))
result = client.v1.animation.generate(
assets = {
"audio_source" : "none"
},
end_seconds = 1.5 ,
fps = 8 ,
height = 256 ,
width = 512 ,
style = {
"art_style" : "Studio Ghibli Film Still" ,
"camera_effect" : "Dramatic Zoom In" ,
"prompt" : "A majestic tiger walking through a misty jungle at sunset, magical atmosphere" ,
"prompt_type" : "custom" ,
"transition_speed" : 5
},
name = "Tiger Animation" ,
wait_for_completion = True ,
download_outputs = True ,
download_directory = "."
)
if result.status == "complete" :
print ( f "✅ Animation complete!" )
print ( f "Downloaded to: { result.downloaded_paths } " )
print ( f "Credits charged: { result.credits_charged } " )
else :
print ( f "❌ Job failed with status: { result.status } " )
if hasattr (result, 'error_message' ):
print ( f "Error: { result.error_message } " )
Animation from Image
result = client.v1.animation.generate(
assets = {
"audio_source" : "none" ,
"image_file_path" : "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/tomcruise.png"
},
end_seconds = 1.5 ,
fps = 8.0 ,
height = 256 ,
width = 512 ,
style = {
"art_style" : "Van Gogh" ,
"camera_effect" : "Spin Bounce" ,
"prompt" : "Tom Cruise in an action pose, dramatic lighting, cinematic intensity" ,
"prompt_type" : "custom" ,
"transition_speed" : 5
},
name = "Tom Cruise Animation" ,
wait_for_completion = True ,
download_outputs = True ,
download_directory = "."
)
if result.status == "complete" :
print ( f "✅ Animation complete!" )
print ( f "Downloaded to: { result.downloaded_paths } " )
print ( f "Credits charged: { result.credits_charged } " )
else :
print ( f "❌ Job failed with status: { result.status } " )
if hasattr (result, 'error_message' ):
print ( f "Error: { result.error_message } " )
Animation with Audio
result = client.v1.animation.generate(
end_seconds = 2.0 ,
fps = 8.0 ,
height = 256 ,
width = 512 ,
assets = {
"audio_file_path" : "https://raw.githubusercontent.com/runshouse/Sample_Assets/main/you-are-just-a-line-of-code.mp3" ,
"audio_source" : "file"
},
style = {
"art_style" : "Cyberpunk" ,
"camera_effect" : "Pulse - Audio Sync" ,
"prompt" : "Digital code streams and neon circuits pulsing to the rhythm, futuristic tech aesthetic" ,
"prompt_type" : "custom" ,
"transition_speed" : 5
},
name = "Code Audio Animation" ,
wait_for_completion = True ,
download_outputs = True ,
download_directory = "."
)
if result.status == "complete" :
print ( f "✅ Animation complete!" )
print ( f "Downloaded to: { result.downloaded_paths } " )
print ( f "Credits charged: { result.credits_charged } " )
else :
print ( f "❌ Job failed with status: { result.status } " )
if hasattr (result, 'error_message' ):
print ( f "Error: { result.error_message } " )
Pricing
Animation uses credits based on video duration:
Duration Approximate Credits 5 seconds ~150 credits 10 seconds ~300 credits
Resolution Limits
Animation has a maximum resolution of 1472px (either width or height).
API Reference
Animation API Reference View full API specification
Image to Video Convert static images to dynamic videos
Text to Video Generate videos from text descriptions