DEV Community

Om Prakash
Om Prakash

Posted on Originally published at pixelapi.dev

Why AI video models fail on event invitations (and how we built a 16s compositor for Indic scripts)

If you've tried using text-to-video models like Wan 2.1, Runway, or Sora to create video invitations, you've almost certainly hit the same wall: unconstrained diffusion models cannot handle typographic precision.

Text gets mangled into alien hieroglyphics. Familiar faces warp across frames. And waiting 5 to 10 minutes on an A100 GPU cluster just to produce a 5-second video that misspells the bride's name isn't viable for production apps.

At PixelAPI, we needed a reliable way to generate broadcast-grade, vertical (1080×1920, 9:16) motion video invitations for weddings, housewarmings, and birthdays in under 20 seconds. Here is the technical breakdown of how we architected the pipeline and solved the Indic typography problem.


The Architecture: 4-Card Multi-Layer Compositing

Instead of asking a diffusion model to dream up pixels from scratch, we decoupled visual design, typographic rendering, and dynamic motion into a specialized 4-stage pipeline:

  1. Card 1 — Sacred Invocations & Announcement: Renders traditional Sanskrit or vernacular blessings (e.g. ॥ श्री गणेशाय नमः ॥) with gold filigree radial borders.
  2. Card 2 — Monogram & Portrait Frame: Incorporates celebrant photos with high-contrast oval/rectangular frames and royal crests.
  3. Card 3 — Ceremonies Itinerary: Clean timeline display for multi-day events (Mehendi, Sangeet, Muhurtham, Reception).
  4. Card 4 — Venue & RSVP Coordinates: High-readability venue location, map hints, and family contact details.

Each card is composited with procedural background lighting, radial vignettes, and subtle sacred watermarks (mandala, arabesque, or geometric star patterns depending on the cultural theme).


The Hardest Part: Complex Indic Script Shaping

The biggest technical bottleneck in automated Indian event invitations is font rendering.

Standard PIL/Pillow renderers break down on Indic scripts (Devanagari, Telugu, Tamil, Kannada) because vowel matras and conjunct consonants require dynamic reordering and contextual substitution:

  • Without complex text shaping, an invocation like ॥ श्री गणेशाय नमः ॥ renders with detached vowel markers or blank tofu boxes ([][][][]).
  • In Telugu, sub-base conjuncts (vattulu) get separated from their host consonants.

To fix this once and for all, we integrated libraqm backed by FreeType and HarfBuzz, binding directly to native OpenType tables in Google's NotoSerifDevanagari and NotoSerifTelugu fonts. Every conjunct, virama, and reph is shaped accurately before pixel rasterization.


2.5D Motion Without Generative Hallucination

To give the invitation cinematic life without morphing text, we apply parameterized 2.5D Ken Burns motion:

zoompan=z='min(zoom+0.0003,1.035)':d=120:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':s=1080x1920:fps=30
Enter fullscreen mode Exit fullscreen mode

This subtle camera drift provides rich visual depth, keeps typography pin-sharp, and preserves portrait details across all 18 seconds of the reel. The final stream is muxed with AAC stereo celebration music at 48kHz.


End-to-End Latency Benchmark

Because the entire compositing stack runs on our bare-metal RTX 4090 fleet rather than relying on external API hops, the turnaround is remarkably fast:

Pipeline Stage Processing Time
Dynamic card rendering & script shaping 0.84s
2.5D motion generation (1080×1920 @ 30 FPS) 4.57s
Audio muxing & AAC stereo mastering 1.12s
Final H.264 composition & CDN distribution 4.84s
Total Wall-Clock Latency ~11.4 to 16.5 seconds

How to Use the API (Python Example)

Generating an invitation video requires a single POST request:

import time
import requests

API_KEY = "pxapi_your_key_here"
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

payload = {
    "event_type": "wedding",
    "theme_name": "royal_indigo",
    "theme_prompt": "Royal Indigo silk aesthetic with subtle gold filigree and glowing lanterns",
    "bg_style": "minimalist",
    "title_english": "CELEBRATING THE WEDDING OF",
    "primary_name_english": "Aarav Sharma",
    "secondary_name_english": "Diya Patel",
    "event_date": "Sunday, November 15, 2026",
    "muhurtham": "7:00 PM Onwards",
    "venue_name": "The Grand Palace Hall",
    "venue_address": "MG Road, Bengaluru, Karnataka",
    "rsvp_contacts": "RSVP: +91 98765 43210"
}

# 1. Trigger generation (40 credits / $0.040 USD)
res = requests.post("https://api.pixelapi.dev/v1/invitation-video/generate", json=payload, headers=HEADERS).json()
poll_url = res["poll_url"]
print("Queued generation:", res["generation_id"])

# 2. Poll status (~15 seconds)
while True:
    st = requests.get(poll_url, headers=HEADERS).json()
    if st.get("status") == "done":
        print("Done! Video URL:", st.get("output_url"))
        print("Direct download:", st.get("download_url"))
        break
    time.sleep(2)
Enter fullscreen mode Exit fullscreen mode

The output is an optimized 1080×1920 MP4 ready for immediate delivery via WhatsApp, Instagram, or wedding planner portals.


Economics: The "2x Cheaper" Rule

Commercial video rendering APIs (Creatomate, Shotstack) charge anywhere from $0.08 to $0.50 per render.

By owning our compute hardware, PixelAPI prices Motion Video Invitations at 40 credits ($0.040 USD / ~₹3.30 INR) per video—exactly half of the competitor floor.

I'd love to hear feedback from other developers working on automated video workflows!

Top comments (0)