use ai_walking_video_generator::{
generate_walking_video, WalkingAnimationConfig, VideoGenerationError,
BackgroundOptions, CharacterOptions,
};
fn main() -> Result<(), VideoGenerationError> {
println!("Example 1: Generating a basic walking video...");
let config1 = WalkingAnimationConfig {
character: CharacterOptions {
model_url: "https://example.com/character1.glb".to_string(),
scale: 1.0,
},
background: BackgroundOptions {
image_url: "https://example.com/background1.jpg".to_string(),
motion_type: "static".to_string(),
},
animation_duration: 5.0,
output_path: "output1.mp4".to_string(),
};
match generate_walking_video(config1) {
Ok(_) => println!("Example 1: Video generated successfully!"),
Err(e) => println!("Example 1: Error generating video: {:?}", e),
}
println!("Example 2: Generating a walking video with a dynamic background...");
let config2 = WalkingAnimationConfig {
character: CharacterOptions {
model_url: "https://example.com/character2.glb".to_string(),
scale: 0.8,
},
background: BackgroundOptions {
image_url: "https://example.com/background2.mp4".to_string(),
motion_type: "pan_left".to_string(),
},
animation_duration: 10.0,
output_path: "output2.mp4".to_string(),
};
match generate_walking_video(config2) {
Ok(_) => println!("Example 2: Video generated successfully!"),
Err(e) => println!("Example 2: Error generating video: {:?}", e),
}
println!("Example 3: Generating a walking video with a different character scale...");
let config3 = WalkingAnimationConfig {
character: CharacterOptions {
model_url: "https://example.com/character3.glb".to_string(),
scale: 1.2,
},
background: BackgroundOptions {
image_url: "https://example.com/background3.jpg".to_string(),
motion_type: "static".to_string(),
},
animation_duration: 7.5,
output_path: "output3.mp4".to_string(),
};
match generate_walking_video(config3) {
Ok(_) => println!("Example 3: Video generated successfully!"),
Err(e) => println!("Example 3: Error generating video: {:?}", e),
}
println!("Example 4: Attempting to generate a video with an invalid URL...");
let config4 = WalkingAnimationConfig {
character: CharacterOptions {
model_url: "invalid_url".to_string(),
scale: 1.0,
},
background: BackgroundOptions {
image_url: "https://example.com/background1.jpg".to_string(),
motion_type: "static".to_string(),
},
animation_duration: 5.0,
output_path: "output4.mp4".to_string(),
};
match generate_walking_video(config4) {
Ok(_) => println!("Example 4: Video generated successfully (unexpected)!"),
Err(e) => println!("Example 4: Error generating video (expected): {:?}", e),
}
println!("\nFor more advanced features and options, visit https://supermaker.ai/blog/ai-walking-video-generator-create-realistic-walking-videos-free/");
Ok(())
}