Reverse-engineer viral TikToks and generate branded alternatives using AI.
Viral Twin analyzes a TikTok video, extracts what makes it work (pacing, hooks, camera angles, motion), then generates a new video with your brand's look—preserving the viral psychology while creating something original.
Built with n8n, FAL AI, Scrapecreators and Google's Gemini.
- Analyzes a viral TikTok (visual breakdown, psychological hooks, pacing, segment-by-segment motion)
- Creates a Character Bible (consistent subject appearance, environment, lighting across all frames)
- Generates images for each 10-second segment using AI (nano-banana-pro)
- Animates each image into video clips with motion matching the original (Kling 2.6 Pro)
- Stitches clips into a final video (FAL FFmpeg)
- Uploads to Google Drive and logs everything to a spreadsheet
The output: A 10-60 second vertical video that captures the feel of the original without copying it.
┌─────────────────────────────────────────────────────────────────────────────┐
│ VIRAL TWIN 2.0 SYSTEM │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │
│ │ MANUAL │───▶│ ANALYZER │───▶│ SYNTHESIZER │───▶│ STITCHER │ │
│ │ INGEST │ │ │ │ │ │ │ │
│ │ (9 nodes) │ │ (16 nodes) │ │ (19 nodes) │ │ (22 nodes)│ │
│ └──────────────┘ └──────────────┘ └──────────────┘ └─────┬─────┘ │
│ │ │ │
│ │ ▼ │
│ │ ┌───────────┐ │
│ │ │ LOGGER │ │
│ │ │ (4 nodes) │ │
│ └────────────────────────────────────────────────────┴───────────┘ │
│ │
│ Total: 5 workflows, 70 nodes │
└─────────────────────────────────────────────────────────────────────────────┘
| Workflow | Purpose | Key Operations |
|---|---|---|
| MANUAL INGEST | Entry point via n8n Form | Accepts TikTok URL, archetype selection, brand color |
| ANALYZER | Deconstructs the viral video | Gemini 2.5 Flash vision analysis, segment extraction, character bible generation |
| SYNTHESIZER | Generates new content | Image generation (nano-banana-pro), video generation (Kling 2.6 Pro), sequential segment processing |
| STITCHER | Assembles final video | FFmpeg merge, Google Drive upload, shareable link generation |
| LOGGER | Records everything | Google Sheets logging with full metadata |
| Service | Purpose | Get It |
|---|---|---|
| FAL AI | Image gen (nano-banana-pro), Video gen (Kling), FFmpeg merge | fal.ai |
| OpenRouter | Gemini 2.5 Flash for prompt generation | openrouter.ai |
| ScrapeCreators | TikTok video/metadata extraction | scrapecreators.com |
| Google Drive | Final video storage | Google Cloud Console |
| Google Sheets | Logging | Google Cloud Console |
FAL API- HTTP Header Auth with your FAL keyOpenRouter API- HTTP Header Auth with your OpenRouter keyScrapeCreators API- HTTP Header AuthGoogle Drive OAuth2- OAuth2 credentialsGoogle Sheets OAuth2- OAuth2 credentials
# Workflow IDs (set after importing)
ANALYZER_WORKFLOW_ID=<workflow-id>
SYNTHESIZER_WORKFLOW_ID=<workflow-id>
STITCHER_WORKFLOW_ID=<workflow-id>
LOGGER_WORKFLOW_ID=<workflow-id>
# Google integrations
VIRAL_TWIN_SHEET_ID=<google-sheet-id>
VIRAL_TWIN_DRIVE_FOLDER_ID=<google-drive-folder-id>Import in this order (dependencies matter):
viral-twin-logger.jsonviral-twin-stitcher.jsonviral-twin-synthesizer.jsonviral-twin-analyzer.jsonviral-twin-manual-ingest.json
After importing, grab each workflow's ID from the URL and set the environment variables in n8n Settings → Variables.
Create a sheet named Viral_Twin_Log with these columns:
video_id | timestamp | original_url | author | description | virality_reason |
audio_energy | pacing | tone | status | final_video_url | drive_url |
drive_download_url | total_duration | clip_count | segment_1_url | segment_2_url |
segment_3_url | segment_4_url | segment_5_url | segment_6_url | archetype |
brand_color | character_bible_json | all_clips_json | stitched_at
Create a folder for outputs and grab the folder ID from the URL.
Map all credentials in each workflow to your n8n credential names.
- Activate MANUAL INGEST workflow
- Access the form:
https://your-n8n-instance/form/viral-twin - Submit a TikTok URL and wait
Access at: https://your-n8n-instance/form/viral-twin
Fields:
- TikTok URL - Full URL to the video you want to "twin"
- Archetype - Brand personality to apply:
operator- Calm competence, minimal flash (default)creator- Artistic, expressive energyeducator- Clear, authoritative presenceentertainer- High energy, dynamiccustom- Define your own
- Brand Color - Hex color for subtle brand integration (default:
#10B981)
| Video Length | Segments | Approximate Time |
|---|---|---|
| 10 seconds | 1 | 8-12 minutes |
| 20 seconds | 2 | 16-22 minutes |
| 30 seconds | 3 | 25-35 minutes |
| 60 seconds | 6 | 50-70 minutes |
Most time is spent waiting for Kling video generation (~6 minutes per segment).
Per 30-second video (3 segments):
| Service | Operation | Cost |
|---|---|---|
| Gemini 2.5 Flash | Video analysis | ~$0.01 |
| Gemini 2.5 Flash | 3× prompt generation | ~$0.01 |
| nano-banana-pro | 3× image generation | ~$0.15 |
| Kling 2.6 Pro | 3× 10s video generation | ~$2.10 |
| FAL FFmpeg | Video merge | ~$0.01 |
| Total | ~$2.28 |
At scale: ~$2.30 per 30-second video, ~$4.50 per 60-second video.
Gemini 2.5 Flash receives the video as base64 and outputs:
{
"vibe_check": {
"audio_energy": "upbeat, trending sound",
"pacing": "fast cuts, 2-second average shot length",
"viral_hooks": ["pattern interrupt at 0:03", "payoff at end"],
"tone": "comedic with surprise element"
},
"character_bible": {
"subject_type": "person",
"physical_description": "...",
"environment": {
"setting_type": "modern kitchen",
"key_elements": "marble counter, pendant lights",
"lighting": "warm natural from left"
},
"consistency_anchors": ["blue shirt", "wedding ring", "specific counter"]
},
"segments": [
{
"index": 0,
"time_range": "0:00 - 0:10",
"description": "Subject enters frame, picks up object",
"camera": "medium shot, slight low angle",
"motion_description": "walk-in from left, reach and grab motion",
"key_frame_description": "subject mid-reach toward counter"
}
]
}For each segment:
- Generate image prompt - Gemini creates detailed prompt using character bible + segment data
- Generate seed image - nano-banana-pro creates 9:16 starting frame
- Generate video - Kling 2.6 Pro animates the image using motion_description
- Poll for completion - Wait for async FAL jobs to finish
- Loop to next segment
Key architectural decision: Sequential processing via Loop Over Items. n8n's Wait nodes don't preserve multiple items in parallel, so segments process one at a time.
- Collect all segment video URLs
- Submit to FAL FFmpeg for concatenation
- Download merged video
- Upload to Google Drive
- Generate shareable link
- Log everything to Google Sheets
Edit the MANUAL INGEST workflow's archetype options:
{
name: "Provocateur",
description: "Challenges assumptions, creates productive tension",
visual_cues: "direct eye contact, confident posture, dramatic lighting",
energy: "intense but controlled"
}In SYNTHESIZER, modify the Kling submission:
{
duration: '10', // 5 or 10 seconds
cfg_scale: 0.5, // 0-1, lower = more creative
aspect_ratio: '9:16' // determined by input image
}Swap nano-banana-pro for another FAL model in Generate Seed Image node. Options:
fal-ai/flux-pro- Different aestheticfal-ai/flux-realism- More photorealistic- Keep aspect_ratio: '9:16' for vertical video
After Merge nodes, use $json or .first() instead of .item to reference data.
Check that motion_description from Analyzer is being passed to Synthesizer prompts. The motion should match the original video's energy.
The character_bible.environment must be copied exactly into each segment's image prompt. Check the consistency_anchors are being used.
n8n may run out of memory with 60-second videos. Increase Docker memory limits or process shorter videos.
Kling Pro takes ~6 minutes per 10-second clip. Initial wait is 120 seconds, retry wait is 90 seconds. Adjust if needed.
- Audio generated: Kling 2.6 creates original audio for the video, but it does not match the original TikTok audio.
- Character consistency: Relies on prompt engineering, not LoRAs. Same "person" may vary slightly between segments. A future update my use Nano Banana pro for better character consistency.
- Processing time: Sequential generation means ~8-12 minutes per 10-second segment.
- Max 60 seconds: Capped at 6 segments to control cost and time.
- API dependencies: Requires FAL, OpenRouter, and Google APIs to all be operational.
MIT License - Use it, modify it, build on it.
Built by Big Players - Stealing billion-dollar growth strategies so you don't have to. Follow on X
Stack:
- n8n - Workflow automation
- Scrapcreators - Workflow automation
- FAL AI - Image/video generation infrastructure
- Kling - Video generation model
- Google Gemini - Vision analysis and prompt generation
Questions? Issues?
- Open a GitHub issue
- Or reach out via the Big Players newsletter