Ten years ago, back in my uni, I was part of the video organization. While I loved filing and editing (my favorite credentials: award-winning director for a short movie), I remember the dread of opening After Effects, knowing I was about to spend hours (more likely days), just to create the starting credits for a video. As the technical lead, I had to do this too often. The process was tedious, complex, and required a deep understanding of keyframes, effects, and rendering pipelines.
Fast forward to today, it can be done in seconds.
The Magic of a Simple Prompt
With a simple text prompt, you can direct an AI to create a stunning animation. Here’s the code to generate a logo animation with Veo 3. It’s surprisingly straightforward. (You can also use the UI interface - but it’s so easy with vibe coding) If you prefer not to use a paid service, there are some great open-source models available on Hugging Face.
Here is how you can run it:
- Get your API key from Google AI.
- Install the necessary Python packages:
uv add Pillow google-genai. - Create a file named
logo_animation.pyand copy the code below into it. - Replace
'YOUR_API_KEY_HERE'with your actual API key. - Edit the
promptandimage_namevariables to match your needs. - Run the script from your terminal:
uv run ./logo_animation.py.
After about a minute, you’ll find the generated video in the same folder. You’ll likely need a few tries to fine-tune the prompt to get the perfect result.
import time
from google import genai
from google.genai import types
from PIL import Image
import io
# IMPORTANT: Replace with your own API key
client = genai.Client(api_key = 'YOUR_API_KEY_HERE')
VEO_MODEL_ID = "veo-3.0-generate-preview"
prompt = "A minimalist logo reveal. PCB traces gets drawn on the edges and finish by converging towards the one of the logo. on a clean, matte black background. The final logo is pristine and slightly emissive. Macro shot, professional studio lighting, 4K. "
image_name = "logo.png"
# Optional parameters
negative_prompt = "ugly, low quality"
aspect_ratio = "16:9" # 16:9 is the only supported value for Veo 3
number_of_videos = 1 # 1 is the only supported value for Veo 3
# Loading the image
try:
im = Image.open(image_name)
except FileNotFoundError:
print(f"Error: Image file not found at {image_name}")
exit()
# converting the image to bytes
image_bytes_io = io.BytesIO()
im.save(image_bytes_io, format=im.format)
image_bytes = image_bytes_io.getvalue()
operation = client.models.generate_videos(
model=VEO_MODEL_ID,
prompt=prompt,
image=types.Image(image_bytes=image_bytes, mime_type=im.format),
config=types.GenerateVideosConfig(
# At the moment the config must not be empty
aspect_ratio = aspect_ratio,
number_of_videos = number_of_videos,
negative_prompt = negative_prompt,
),
)
# Waiting for the video(s) to be generated
while not operation.done:
time.sleep(20)
operation = client.operations.get(operation)
generated_video = operation.result.generated_videos[0]
client.files.download(file=generated_video.video)
timestamp = time.strftime("%Y%m%d-%H%M%S")
output_filename = f"veo3_video_{timestamp}.mp4"
generated_video.video.save(output_filename)
print(f"Video saved as {output_filename}")