---
name: explainer-video-from-reference
description: Use when a user wants to recreate the style and structure of a reference video (an ad, explainer, or social video URL) as an original branded explainer for their own brand, to explain any concept, with voiceover, music, burned-in captions, and optional social posting.
---

# Branded Explainer Video From a Reference Video

Take a video URL the user likes, learn its structure, and produce a brand-new explainer that explains ANY concept in the user's brand: their logo, colors, voice, and script. Proven on a 2-minute vertical (9:16) explainer, including multiple voice auditions, background music selection, and caption sync.

## When to use
- "Make a video like this one but for my brand."
- "Explain [concept] the way this video does."
- White-label customers who want a branded explainer for their own product or service.

## Legal and quality rules (non-negotiable)
- The reference is INSPIRATION for structure and pacing only. Never reuse its footage, wording, logos, brand names, or music. Rewrite everything in original words.
- Every fact or claim in the script must be true for the user's product. Verify before shipping (pricing, "no fees", "no app needed", etc.). If unsure, soften or ask.
- Never leave placeholders in the video: no lorem ipsum, no blank logo boxes, no fake QR codes. Use real assets or generate believable ones (see Visuals).

## Inputs to collect (ask ONCE, in a single message, only what is missing)
1. Reference video URL (also check list_reference_images for a saved one).
2. Brand name, logo, colors, website or CTA. First search the Reference Library (list_reference_images with search = brand name; also list_folders). Use the real logo. Do not invent one.
3. The concept to explain, plus the audience.
4. Voice preference (male/female/accent) or "audition 3 for me".
5. Music vibe (e.g. futuristic trap, cinematic, upbeat).
6. Target length (default about 2 minutes, 14 scenes) and aspect ratio (default 9:16).
7. A demo business or customer to show in the examples (real or fictional).

If the user is in "act autonomously" mode, pick sensible defaults for anything missing, state them in one line, and keep going.

## Workflow

### Step 1: Deconstruct the reference
- analyze_media (mode gemini) on the reference URL with a prompt like: "Give a scene-by-scene breakdown with timestamps: spoken script, on-screen text, visuals and animation style, transitions, music, hook in the first 3 seconds, CTA. Describe the color palette and typography."
- analyze_media (mode whisper) on the same URL for the exact transcript and timing.
- Produce a BEAT SHEET table: scene number, seconds, purpose (hook, curiosity, insight, mechanism, demo, benefit, differentiation, brand tie-in, CTA), visual.

### Step 2: Write the original script
- Keep the ARC, not the sentences: Hook > Curiosity gap > Familiar example > "Here is what almost nobody noticed" > Mechanism > Demo > Benefits > Why existing options fail > Brand tie-in > CTA.
- 12 to 16 scenes, each 1 to 3 short spoken sentences (4 to 12 seconds).
- Spoken style: conversational, rhythmic fragments, concrete examples.
- Name the brand early in the mechanism scene and again in the tie-in and CTA.
- Write captions as chunks of 2 to 5 words per scene, marking emphasis words.
- Show the script to the user before spending voice credits if they are non-technical or this is client-facing. In autonomous mode, proceed and show the script with the delivery.

### Step 3: Choose the voice
- list_voices. Audition 2 to 3 candidates with the SAME two-sentence line using generate_audio (type speech). Share the URLs.
- Use model eleven_v4 for style and accent control. It follows bracket tags, e.g. [strong German accent][curious, scientific tone]. Put the tags at the start of every call, identical across scenes, for consistency.
- VERIFY accent and tone with analyze_media (mode gemini). Do not trust your assumption. Short lines can lose the accent.
- To use the user's own cloned voice: generate the full read in a stock voice first, then speech-to-speech with sourceAudioUrl and model eleven_english_sts_v2. This preserves timing, so captions timed for the first read stay in sync.

### Step 4: Generate voiceover, one clip per scene
- One generate_audio call per scene, in parallel. Same voiceId, model, tags.
- Run analyze_media (mode whisper) on each clip to get its exact duration and word timestamps. These drive scene lengths and caption timing.
- Check pronunciation of the brand name and URL. Whisper may mis-transcribe an unusual name even when the audio is right, so confirm with a Gemini listen. If it is truly wrong, respell phonetically in the text (e.g. "Baggotts Bots", "dot com").
- If a SHORT line loses the accent or tone, generate it together with the preceding lines in one call and split at the pause using the word timestamps.
- Timeline: scene N starts at 0.3s + sum of previous clip durations + 0.4s gap each. The video ends about 2.4s after the last clip.

### Step 5: Music
- generate_audio type music, instrumental true, with the vibe described. Offer 2 to 3 options if the user is picky.
- Keep it UNDER the voice: roughly 14% of voice level, fade in 1s, fade out 2.5s. With merge_media use backgroundAudioUrl, backgroundAudioVolume about 0.15, audioDucking true.

### Step 6: Visuals (pick a path)
Design rules for both paths:
- Brand palette and the REAL logo on the hook-to-brand-reveal scenes and the end card.
- One idea per scene, big type, lots of space, phone mockups for anything app-like.
- Real assets only. Use the real app icons the concept involves (save them in the library). Any QR code must be a real, scannable code pointing to the brand URL (generate with the Python qrcode library or an image tool, and embed the logo if wanted). Fictional businesses get a generated logo or avatar, never a gray box. If the user provides a real customer's logo, use it on a white rounded square so it stays readable on dark backgrounds.
- Leave the bottom 25% of a 9:16 frame for captions and platform UI.

PATH A (works with only the PayMeGPT tools, no code sandbox):
- For each scene, generate_image at 9:16 with the brand palette, logo passed via referenceImageUrl(s), and a consistent style paragraph reused in every prompt. Keep in-image text minimal (image models misspell); put words in captions.
- Assemble with merge_media: imageUrls (one per scene), slideDurations (clip duration + gap per scene), kenBurns true, transition fade, outputAspectRatio 9:16, voiceover via audioUrls objects {url, offset, volume} (offset = scene start time), backgroundAudioUrl for music with ducking, and captions as [{start,end,text}] (plain text, no emojis). Tune captionFontSize about 18 to 22 and captionPosition so captions sit above the bottom safe zone. Check the result frame by frame.
- merge_media returns a PUBLIC URL, which also solves hosting for posting.
- Optional upgrade: generate_video for the 2 or 3 hero scenes and use videoUrls concatenation.

PATH B (premium, animated UI; needs a code sandbox with Chrome or Playwright and ffmpeg):
- Build ONE self-contained HTML page (1080x1920) containing all scenes plus a caption overlay, driven by a pure function render(t) that sets every element's opacity/transform from time t. No CSS animations, so any frame can be drawn on demand.
- Scene lengths come from the voice clip durations: pass them in the URL hash; scale each scene's local time by K = actualDuration / baseDuration.
- Render with Playwright: set the viewport, call render(i/30) and screenshot as JPEG (quality 92) for every frame, piping frames into ffmpeg (libx264, crf 18, preset veryfast, yuv420p). Then mix audio (adelay each clip to its start, amix, add music at 0.14 with fades) and mux with -c copy.
- A 2-minute render takes about 6 to 7 minutes on 2 cores, so: preview 3 to 6 key frames at full size first, batch the user's changes, render once, and run renders for different voices in parallel.

### Step 7: Captions
- Burned in, 2 to 5 words per chunk, emphasis words highlighted in the brand gradient (Path B) or plain (Path A).
- Time each chunk to the first spoken word of that chunk using Whisper word timestamps. Verify at least three points per video by pulling frames and comparing to the audio.
- If the user wants a different spoken word than the caption (e.g. spoken "ja", caption "yeah"), change the caption text only.

### Step 8: Verify before delivering
- Pull 6 to 8 frames from the busiest moments. Check: nothing clipped, brand name spelled right, logo crisp, no placeholders, captions on the right words.
- Check names that wrap onto 2 lines break alignment of pointers; shrink the font and use nowrap.
- Check total duration and that the final music fade does not cut the last word.
- Fix with the smallest possible change, then render once.

### Step 9: Deliver and save
- Send the final video and the public URL.
- add_to_reference_library the final video, the voice clips and the music. Generated media expires, so do this immediately.
- Offer variants: other voices, other brands (a "same promo, new brand" swap only needs a logo swap, color swap, and re-recording the 3 to 4 brand-specific lines).

### Step 10: Optional social posting
- APPROVAL GATE: always show the user the video and the caption before posting anything.
- Write a UNIQUE caption and a first comment for each channel: Instagram (storytelling plus CTA, hashtags in first comment), Facebook (conversational, link in first comment), X (under 280 characters, first comment as self-reply).
- Platform limits: Facebook Reels max 90 seconds and video Stories 60 seconds, so a 2-minute video posts to Facebook as a normal feed video. Instagram Reels allow far longer.
- Use list_social_accounts to find the brand's channels. Do not assume every brand has every channel. post_to_social_media supports firstComment and scheduledTime.

## Iteration patterns that worked
- Show quick previews (frames, voice samples, music links) before the full render.
- Do the voice swap LAST, after visuals are approved, because the voice changes durations and caption timing.
- Change only what the user asked. Re-verify the rest did not move.
- Keep a master project file so every version is a re-render, not a rebuild.

## Worked example
Reference: https://paymegpt.com/objects/quick-uploads/2/3f7577e5ce3bd5b5.mp4 (a vertical ad about Wallet push notifications). From it we produced an original 2-minute branded explainer for a software brand, then re-skinned it for a marketing agency by swapping the logo, palette, and three brand-specific scenes. For the Wallet concept specifically, use the companion skill: wallet-pass-explainer-video.
