Dev.to
5/12/2026

Hacking perfectly square AI videos with Veo 3.1 and NanoBanana 2
Short summary
A technical tutorial on generating perfectly square (1:1) AI videos from Google's Veo 3.1 Lite and NanoBanana 2, which natively support different aspect ratios. The workaround pads images to 9:16, uses them as Veo start/end frames for perfect looping, then crops with FFmpeg—all documented in runnable Python code. This avoids edge hallucinations and preserves audio quality.
- •Solves aspect ratio mismatches in AI video generation with a simple, reliable pipeline
- •Includes complete runnable Python examples using Google's Gemini API, Veo, and NanoBanana
- •Preserves video quality and audio integrity better than standard cropping approaches
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



