mcpField
V
video-ad-generator

video-ad-generator

github.com/creatify-aiMarketing & growth6845 installsUpdated 34w ago
Repository

About video-ad-generator

Video Ad Generator is a framework for video ad creation and API automation, aimed at marketing and e-commerce teams planning creative and producing ads at scale. It covers scripts, ad structures, multi-platform formats, and testing, with examples for automating through the Creatify API.

Key features

  1. 01Provide creative briefs and hook templates
  2. 02Plan ad body structures and calls to action
  3. 03Choose video formats for multiple platforms
  4. 04Set up A/B tests for ad variations
  5. 05Automate asset generation through the Creatify API

Use cases

  1. 01Develop video ad concepts for a product
  2. 02Turn a product page into a video ad
  3. 03Adapt ad dimensions for multiple platforms
  4. 04Test alternative hooks or calls to action in batches

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/creatify-ai/video-ad-generator --skill video-ad-generator

After installing, type/video-ad-generatorin Claude Code to confirm it loaded.

Bundled filesREADME.mdLICENSE

Details

From the project README

Video Ad Generator

Complete framework for creating high-converting video ads — from creative strategy to production at scale.


Part 1: Video Ad Creation Framework (Standalone)

1.1 Creative Brief Template

Before creating any ad, fill out this brief. It forces strategic thinking before production.

CREATIVE BRIEF
==============

Product/Service: _______________
Product URL: _______________
Price Point: _______________

TARGET AUDIENCE
- Demographics: _______________
- Primary pain point: _______________
- Secondary pain points: _______________
- Current solution they use: _______________
- Objections to buying: _______________

PRODUCT POSITIONING
- Core benefit (1 sentence): _______________
- Supporting benefits (3 max): _______________
- Proof points (reviews, stats, awards): _______________
- Unique mechanism (what makes it work): _______________

AD SPECIFICATIONS
- Platform: [ ] Meta [ ] TikTok [ ] YouTube [ ] LinkedIn [ ] Other
- Format: [ ] 9:16 [ ] 16:9 [ ] 1:1 [ ] 4:5
- Length: [ ] 15s [ ] 30s [ ] 60s
- Tone: [ ] Professional [ ] Casual [ ] Urgent [ ] Humorous [ ] Educational
- CTA: _______________

CREATIVE DIRECTION
- Style: [ ] UGC [ ] Avatar [ ] Product Demo [ ] Testimonial [ ] Explainer
- Must include: _______________
- Must avoid: _______________
- Reference ads (URLs): _______________
1.2 Hook Formulas

The first 3 seconds determine whether someone watches your ad. Use these proven formulas:

Pattern Interrupt

Breaks the scroll pattern with something unexpected.

  • "Stop scrolling if you [audience identifier]"
  • "[Shocking visual] + Wait, what?"
  • Start mid-action (unboxing, applying product, dramatic reveal)

Best for: TikTok, Instagram Reels, broad audiences

Question Hook

Opens a curiosity loop the viewer needs to close.

  • "What if I told you [counterintuitive claim]?"
  • "Why are [demographic] switching to [product category]?"
  • "Did you know [surprising statistic about their problem]?"

Best for: Educational products, B2B, considered purchases

Bold Claim

Leads with the strongest benefit, stated confidently.

  • "[Product] replaced my [expensive alternative]"
  • "I saved [specific amount] by switching to [product]"
  • "The only [product category] that actually [bold promise]"

Best for: Competitive markets, DTC products, price-advantaged products

POV Hook

Places the viewer inside a relatable scenario.

  • "POV: You finally found a [product] that [solves problem]"
  • "POV: It's 6am and you're [using product in aspirational way]"
  • "Me when I discovered [product] exists:"

Best for: Lifestyle products, Gen Z/Millennial audiences, TikTok

Stat/Authority Hook

Uses data or credentials to establish instant credibility.

  • "[Number] people can't be wrong"
  • "Dermatologists say [claim] — here's why"
  • "After testing [number] [products], this one won"

Best for: Health/beauty, B2B, premium products, skeptical audiences

1.3 Body Structures

After the hook, the body delivers the message. Match the structure to your goal:

Problem-Agitate-Solve (PAS)
  1. Problem (2-3s): Name the pain point clearly
  2. Agitate (3-5s): Make it feel urgent — show consequences of not solving it
  3. Solve (5-8s): Introduce product as the natural solution

Best for: Pain-point-driven products, health/wellness, productivity tools

Feature Cascade
  1. Hero feature (3-4s): Lead with the most impressive capability
  2. Supporting feature 1 (2-3s): Add credibility or utility
  3. Supporting feature 2 (2-3s): Address a secondary concern
  4. Proof (2-3s): Quick social proof or demo result

Best for: Tech products, SaaS, feature-rich products

Social Proof Stack
  1. Testimonial/review quote (3-4s): Real customer words
  2. Visual proof (3-4s): Before/after, demo, or results screenshot
  3. Volume proof (2-3s): "Join [X] customers" or star ratings
  4. Urgency (2-3s): Limited offer or scarcity

Best for: E-commerce, subscription products, competitive markets

Before/After
  1. Before state (3-5s): Show the problem visually
  2. Transformation moment (2-3s): The product in action
  3. After state (3-5s): Show the improved outcome
  4. How to get it (2-3s): CTA

Best for: Beauty, fitness, home improvement, cleaning products

Day-in-the-Life
  1. Morning routine (3-4s): Product in context of daily life
  2. Key moment (3-4s): The "aha" moment or primary use case
  3. Result/feeling (3-4s): Emotional payoff
  4. Invite (2-3s): "Try it yourself" CTA

Best for: Lifestyle products, UGC-style ads, TikTok/Reels

1.4 CTA Patterns
CTA TypeExampleBest For
Direct"Shop now" / "Get yours today"E-commerce, clear intent
Curiosity"See why [X] people switched"Consideration stage
Urgency"Only [X] left at this price"Limited inventory, promos
Risk Reversal"Try it free for 30 days"SaaS, subscription, high-price
Social"Join [X] happy customers"Community-driven products
Benefit"Start [desired outcome] today"Transformation products
1.5 Multi-Format Ad Strategy
Platform Format Guide
PlatformPrimary FormatSecondaryMax LengthAutoplay?
TikTok9:16—60s (15-30s optimal)Yes, sound on
Instagram Reels9:16—90s (15-30s optimal)Yes, sound off default
Instagram Feed1:1 or 4:59:1660s (15s optimal)Yes, sound off
Facebook Feed1:1 or 4:516:9240s (15-30s optimal)Yes, sound off
YouTube Shorts9:16—60s (30-45s optimal)Yes, sound on
YouTube Pre-roll16:9—15s or 30s (non-skip: 6-15s)Yes, sound on
LinkedIn16:9 or 1:1—30s (15s optimal)Yes, sound off
Format Decision Matrix
Need maximum reach on mobile? → 9:16
Running YouTube pre-roll? → 16:9
Want to repurpose across Meta + LinkedIn? → 1:1
Instagram Feed placement priority? → 4:5
Creating one asset for everywhere? → 1:1 (safest universal)
Multi-Format Production Strategy

When creating a campaign across platforms:

  1. Hero asset: Create the 9:16 version first (vertical = most platforms)
  2. Adapt to 1:1: Crop or reframe for feed placements
  3. Adapt to 16:9: For YouTube/LinkedIn landscape needs
  4. Always create text-safe versions (captions baked in) for sound-off platforms
1.6 A/B Testing Framework
What to Test (Priority Order)
  1. Hook (highest impact): Test 3-5 different hooks with the same body
  2. CTA: Test 2-3 CTA variations
  3. Format/aspect ratio: 9:16 vs 1:1 on the same platform
  4. Length: 15s vs 30s with same content
  5. Avatar/presenter: Different demographics or styles
  6. Music/audio: Background music vs no music vs voiceover only
Testing Rules
  • Change one variable per test
  • Minimum $50-100 spend per variant before judging
  • Need at least 1,000 impressions per variant for directional data
  • Run for 3-7 days minimum to account for day-of-week variance
  • Primary metric: Hook rate (3-second views / impressions)
  • Secondary metric: Hold rate (video completions / 3-second views)
  • Outcome metric: CPA or ROAS (only meaningful at sufficient spend)
Batch Testing Workflow
1. Write 5 hook variants for same product
2. Pair each hook with identical body + CTA
3. Generate all 5 as video ads
4. Launch as separate ad sets with identical targeting
5. After 3 days: Kill bottom 2 performers
6. After 7 days: Scale winner, create new hooks inspired by winner
1.7 Batch Workflow Architecture

These async patterns work for any video generation API, not just Creatify.

Async Polling Pattern
import time
import requests

def poll_until_done(status_url, headers, max_wait=600, interval=10):
    """Universal async polling for video generation jobs."""
    elapsed = 0
    while elapsed < max_wait:
        resp = requests.get(status_url, headers=headers)
        data = resp.json()
        status = data.get("status", "")

        if status == "done":
            return data
        elif status in ("failed", "error"):
            raise Exception(f"Job failed: {data.get('failed_reason', 'Unknown')}")

        time.sleep(interval)
        elapsed += interval

    raise TimeoutError(f"Job did not complete within {max_wait}s")
Webhook Handler Pattern
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route("/webhook/video-complete", methods=["POST"])
def handle_video_webhook():
    """Receive webhook when video generation completes."""
    payload = request.json
    job_id = payload["id"]
    status = payload["status"]

    if status == "done":
        video_url = payload["video_output"]
        # Process completed video (download, notify, queue next step)
        process_completed_video(job_id, video_url)
    elif status == "failed":
        handle_failure(job_id, payload.get("failed_reason"))

    return jsonify({"received": True}), 200
Rate Limiting & Error Recovery
import time
from collections import deque

class RateLimiter:
    """Token bucket rate limiter for API calls."""

    def __init__(self, max_per_minute=30):
        self.max_per_minute = max_per_minute
        self.timestamps = deque()

    def wait_if_needed(self):
        now = time.time()
        # Remove timestamps older than 60 seconds
        while self.timestamps and self.timestamps[0] < now - 60:
            self.timestamps.popleft()

        if len(self.timestamps) >= self.max_per_minute:
            sleep_time = 60 - (now - self.timestamps[0])
            time.sleep(max(0, sleep_time))

        self.timestamps.append(time.time())

def batch_generate_with_retry(jobs, generate_fn, max_retries=3):
    """Process a batch of generation jobs with retry logic."""
    limiter = RateLimiter(max_per_minute=30)
    results = []

    for job in jobs:
        retries = 0
        while retries < max_retries:
            try:
                limiter.wait_if_needed()
                result = generate_fn(job)
                results.append({"job": job, "result": result, "status": "success"})
                break
            except Exception as e:
                retries += 1
                if retries == max_retries:
                    results.append({"job": job, "error": str(e), "status": "failed"})
                else:
                    time.sleep(2 ** retries)  # Exponential backoff

    return results

Part 2: API Automation

Automate everything from Part 1 at scale using the API.

2.1 Setup & Authentication
import requests

CREATIFY_API_ID = "your-api-id"
CREATIFY_API_KEY = "your-api-key"

HEADERS = {
    "Content-Type": "application/json",
    "X-API-ID": CREATIFY_API_ID,
    "X-API-KEY": CREATIFY_API_KEY,
}
BASE_URL = "https://api.creatify.ai/api"

Don't have an API key yet? No problem — grab one in under 2 minutes:

  1. Sign up free at creatify.ai
  2. Go to Settings → API
  3. Copy your API ID and API Key — that's it. New accounts get free credits to start.
2.2 URL to Video

Transform any product URL into a complete video ad. This is the most popular endpoint — ideal for e-commerce teams.

Flow: URL → Scrape → AI Script → Preview → Render

Cost: 5 credits per 30 seconds of video + 1 credit for link + 1 credit for script

Step 1: Create Link from URL
def create_link(url):
    """Scrape product data from a URL."""
    resp = requests.post(f"{BASE_URL}/links/", headers=HEADERS, json={"url": url})
    resp.raise_for_status()
    return resp.json()  # Returns id, title, description, images, etc.
Step 2: Generate AI Scripts
def generate_scripts(title, description, language="en", target_audience="general", video_length=30):
    """Generate AI marketing scripts for the product."""
    resp = requests.post(f"{BASE_URL}/ai_scripts/", headers=HEADERS, json={
        "title": title,
        "description": description,
        "language": language,
        "target_audience": target_audience,
        "video_length": video_length,
    })
    resp.raise_for_status()
    return resp.json()
Step 3: Create Video from Link
def create_video_from_link(link_id, script=None, aspect_ratio="9x16", webhook_url=None):
    """Generate a video ad from a scraped link."""
    payload = {
        "link_id": link_id,
        "aspect_ratio": aspect_ratio,
    }
    if script:
        payload["script"] = script
    if webhook_url:
        payload["webhook_url"] = webhook_url

    resp = requests.post(f"{BASE_URL}/link_to_videos/", headers=HEADERS, json=payload)
    resp.raise_for_status()
    return resp.json()
Step 4: Poll for Completion
def check_video_status(video_id):
    """Check status of a video generation job."""
    resp = requests.get(f"{BASE_URL}/link_to_videos/{video_id}/", headers=HEADERS)
    resp.raise_for_status()
    return resp.json()

# Use the poll_until_done helper from Part 1:
result = poll_until_done(
    f"{BASE_URL}/link_to_videos/{video_id}/",
    HEADERS,
    max_wait=600
)
video_url = result["video_output"]
Full URL-to-Video Pipeline
def url_to_video(product_url, aspect_ratio="9x16"):
    """Complete pipeline: product URL → finished video ad."""
    # 1. Scrape product page
    link = create_link(product_url)
    link_id = link["id"]

    # 2. Generate AI scripts
    scripts = generate_scripts(link["title"], link["description"])

    # 3. Create video
    video = create_video_from_link(link_id, aspect_ratio=aspect_ratio)

    # 4. Wait for completion
    result = poll_until_done(
        f"{BASE_URL}/link_to_videos/{video['id']}/",
        HEADERS,
        max_wait=600
    )

    return result["video_output"]
2.3 Ad Clone

Recreate a winning competitor ad using your own product. Provide a reference video + your product link.

Cost: 15 credits per clone

def clone_ad(link_id, video_url, aspect_ratio="9x16", webhook_url=None):
    """Clone a reference ad with your product assets."""
    payload = {
        "link": link_id,
        "video_url": video_url,
        "aspect_ratio": aspect_ratio,
    }
    if webhook_url:
        payload["webhook_url"] = webhook_url

    resp = requests.post(f"{BASE_URL}/ads_clone/", headers=HEADERS, json=payload)
    resp.raise_for_status()
    return resp.json()

def check_clone_status(clone_id):
    """Check status of an ad clone job."""
    resp = requests.get(f"{BASE_URL}/ads_clone/{clone_id}/", headers=HEADERS)
    resp.raise_for_status()
    return resp.json()
2.4 AI Script Generation

Generate marketing scripts from a URL or product details. Returns multiple script variants.

Cost: 1 credit per generation

def generate_scripts_from_url(url, language="en", target_audience="general", video_length=30):
    """Generate scripts from a product URL (scrapes automatically)."""
    link = create_link(url)
    return generate_scripts(
        title=link["title"],
        description=link["description"],
        language=language,
        target_audience=target_audience,
        video_length=video_length,
    )
2.5 Custom Templates

Use pre-built or custom templates for consistent branding.

def list_custom_templates():
    """List all available custom templates."""
    resp = requests.get(f"{BASE_URL}/custom_templates/", headers=HEADERS)
    resp.raise_for_status()
    return resp.json()

def create_custom_template_video(template_id, params, webhook_url=None):
    """Generate video from a custom template."""
    payload = {"template_id": template_id, **params}
    if webhook_url:
        payload["webhook_url"] = webhook_url

    resp = requests.post(f"{BASE_URL}/custom_template_jobs/", headers=HEADERS, json=payload)
    resp.raise_for_status()
    return resp.json()
2.6 Product to Video

Transform product images into showcase videos.

Cost: 1 credit for preview image + 3 credits for video generation

def create_product_video(product_image_url, webhook_url=None):
    """Create a product showcase video from an image."""
    payload = {"product_url": product_image_url}
    if webhook_url:
        payload["webhook_url"] = webhook_url

    # Step 1: Generate preview image
    resp = requests.post(
        f"{BASE_URL}/product_to_videos/gen_image/",
        headers=HEADERS,
        json=payload
    )
    resp.raise_for_status()
    record = resp.json()

    # Step 2: Poll until image is ready
    record_id = record["id"]
    result = poll_until_done(
        f"{BASE_URL}/product_to_videos/{record_id}/",
        HEADERS,
        max_wait=300
    )

    # Step 3: Generate video from preview
    video_resp = requests.post(
        f"{BASE_URL}/product_to_videos/{record_id}/gen_video/",
        headers=HEADERS,
        json={"video_prompt": "product showcase", "webhook_url": webhook_url}
    )
    video_resp.raise_for_status()
    return video_resp.json()
2.7 IAB Banner Images

Generate IAB-compliant ad banner images in multiple standard sizes from a single input image.

Cost: 2 credits per generation (produces multiple sizes)

def generate_iab_images(image_url, webhook_url=None):
    """Generate IAB-compliant banner images in all standard sizes."""
    payload = {"image": image_url}
    if webhook_url:
        payload["webhook_url"] = webhook_url

    resp = requests.post(f"{BASE_URL}/iab_images/", headers=HEADERS, json=payload)
    resp.raise_for_status()
    return resp.json()

def check_iab_status(iab_id):
    """Check IAB image generation status."""
    resp = requests.get(f"{BASE_URL}/iab_images/{iab_id}/", headers=HEADERS)
    resp.raise_for_status()
    data = resp.json()
    # When done, data["output"] contains list of {name, size, url, type}
    return data
2.8 Recipes
Recipe: Batch URL-to-Video

Generate video ads for an entire product catalog.

def batch_url_to_video(product_urls, aspect_ratio="9x16"):
    """Generate video ads for multiple product URLs."""
    limiter = RateLimiter(max_per_minute=20)
    jobs = []

    for url in product_urls:
        limiter.wait_if_needed()
        try:
            link = create_link(url)
            video = create_video_from_link(link["id"], aspect_ratio=aspect_ratio)
            jobs.append({"url": url, "video_id": video["id"], "status": "processing"})
        except Exception as e:
            jobs.append({"url": url, "error": str(e), "status": "failed"})

    # Poll all jobs
    results = []
    for job in jobs:
        if job["status"] == "failed":
            results.append(job)
            continue
        try:
            result = poll_until_done(
                f"{BASE_URL}/link_to_videos/{job['video_id']}/",
                HEADERS,
                max_wait=600
            )
            results.append({**job, "video_url": result["video_output"], "status": "done"})
        except Exception as e:
            results.append({**job, "error": str(e), "status": "failed"})

    return results
Recipe: Clone Ad Across Catalog

Take one winning ad and clone it for every product.

def clone_across_catalog(reference_video_url, product_urls, aspect_ratio="9x16"):
    """Clone a winning ad for multiple products."""
    results = []

    for url in product_urls:
        try:
            link = create_link(url)
            clone = clone_ad(link["id"], reference_video_url, aspect_ratio)
            result = poll_until_done(
                f"{BASE_URL}/ads_clone/{clone['id']}/",
                HEADERS,
                max_wait=600
            )
            results.append({"url": url, "video": result["video_output"], "status": "done"})
        except Exception as e:
            results.append({"url": url, "error": str(e), "status": "failed"})

    return results
Recipe: Multi-Format Ad Set

Create one ad in all formats for cross-platform campaigns.

def multi_format_ad_set(product_url):
    """Generate 9:16, 1:1, and 16:9 versions of an ad."""
    link = create_link(product_url)
    formats = ["9x16", "1x1", "16x9"]
    jobs = {}

    for fmt in formats:
        video = create_video_from_link(link["id"], aspect_ratio=fmt)
        jobs[fmt] = video["id"]

    results = {}
    for fmt, video_id in jobs.items():
        result = poll_until_done(
            f"{BASE_URL}/link_to_videos/{video_id}/",
            HEADERS,
            max_wait=600
        )
        results[fmt] = result["video_output"]

    return results
2.9 Credit Costs & Latency Reference
EndpointCreditsTypical Latency
Create Link (scrape URL)1< 60 seconds
AI Script Generation110-30 seconds
URL to Video5 per 30s of video~5 minutes
Ad Clone15~5 minutes
Custom Template Video5 per 30s~3 minutes
Product to Video (image)1~60 seconds
Product to Video (video)3~3 minutes
IAB Images2~60 seconds
2.10 Decision Matrix
I want to...Use this endpointCredits
Turn a product URL into a video adURL to Video~7
Recreate a competitor's ad styleAd Clone~16
Generate marketing scriptsAI Scripts1
Use my own video templateCustom Templates5/30s
Create a product showcaseProduct to Video4
Generate display banner adsIAB Images2
Create ads for entire catalogBatch URL to Video~7 each
Test 5 hook variantsURL to Video x5~35

See Also

Comments

Markdown supported