Communitygithub.com

Generador de Videos con IA — Pipeline de Contenido Corto

Genera videos cortos con IA: guion, narración por texto a voz, selección de metraje de archivo, subtítulos y ensamblaje. Útil para crear contenido para TikTok/YouTube Shorts/Reels, automatizar la producción de videos y construir pipelines de contenido.

¿Qué es Generador de Videos con IA — Pipeline de Contenido Corto?

Esta habilidad automatiza la creación de videos cortos (TikTok, YouTube Shorts, Instagram Reels) utilizando inteligencia artificial en cada paso: investigación de temas, escritura de guiones, narración por texto a voz, selección de metraje de archivo libre de derechos, generación de subtítulos a nivel de palabra y ensamblaje final del video. Está inspirada en MoneyPrinterTurbo (más de 53k estrellas en GitHub) y combina múltiples APIs de IA como Anthropic u OpenAI para los guiones, ElevenLabs u OpenAI TTS para la voz, y Pexels para el metraje de archivo. La habilidad proporciona código Python completo para construir un pipeline modular, incluyendo funciones para generar guiones optimizados para el formato de video corto (gancho inicial, cuerpo y llamado a la acción), crear narraciones realistas, buscar clips verticales en Pexels, generar subtítulos sincronizados con WhisperX y ensamblar el video final con FFmpeg. Es compatible con cualquier entorno que tenga Python y FFmpeg, y está diseñada para desarrolladores y creadores de contenido que desean automatizar la producción en volumen de videos cortos, manteniendo un control granular sobre cada etapa del proceso.

Compatible con✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/ai-video-generator

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

¿Qué hace Generador de Videos con IA — Pipeline de Contenido Corto?

Visión General

Automatiza la creación de videos cortos (TikTok, YouTube Shorts, Instagram Reels) usando IA en cada paso: investigación de temas, escritura de guiones, narración por texto a voz, selección de metraje de archivo, generación de subtítulos y ensamblaje final. Inspirado en MoneyPrinterTurbo (más de 53k estrellas).

Instrucciones

Paso 1: Configurar el Entorno

pip install anthropic openai requests moviepy pydub whisperx srt
sudo apt install ffmpeg  # Linux — o: brew install ffmpeg (macOS)

Claves de API necesarias: Anthropic o OpenAI (guiones), ElevenLabs o OpenAI TTS (voz), Pexels (metraje de archivo gratuito).

Paso 2: Escritura de Guiones con IA

import anthropic

def generate_script(topic, duration_seconds=45):
    """Genera un guion de video optimizado para contenido corto."""
    client = anthropic.Anthropic()
    prompt = f"""Escribe un guion de video de {duration_seconds} segundos sobre: {topic}
    Formato:
    GANCHO (primeros 3 segundos): Una afirmación impactante o pregunta que detenga el desplazamiento
    CUERPO (contenido principal): 3-5 datos o puntos contundentes, cada uno de 1-2 oraciones
    CTA (últimos 5 segundos): Llamado a la acción — sigue, da like, comenta
    Reglas:
    - Conversacional, sin oraciones complejas
    - Cada oración en su propia línea
    - ~{duration_seconds * 2.5:.0f} palabras ({duration_seconds}s a 150ppm)
    - Usa palabras poderosas: secreto, impactante, nadie te dice, en realidad
    - Sin emojis ni hashtags — esto es un guion de voz en off
    """
    response = client.messages.create(
        model="claude-sonnet-4-20250514", max_tokens=500,
        messages=[{"role": "user", "content": prompt}]
    )
    return response.content[0].text

Paso 3: Narración por Texto a Voz

import requests, os

def generate_voice_elevenlabs(text, output_path='narration.mp3'):
    """Genera voz en off usando ElevenLabs."""
    url = "https://api.elevenlabs.io/v1/text-to-speech/21m00Tcm4TlvDq8ikWAM"
    headers = {"xi-api-key": os.environ["ELEVENLABS_API_KEY"], "Content-Type": "application/json"}
    data = {"text": text, "model_id": "eleven_turbo_v2_5",
            "voice_settings": {"stability": 0.5, "similarity_boost": 0.75}}
    response = requests.post(url, json=data, headers=headers)
    with open(output_path, 'wb') as f:
        f.write(response.content)
    return output_path

def generate_voice_openai(text, output_path='narration.mp3'):
    """Genera voz en off usando OpenAI TTS (alternativa más económica)."""
    from openai import OpenAI
    client = OpenAI()
    response = client.audio.speech.create(model="tts-1-hd", voice="onyx", input=text)
    response.stream_to_file(output_path)
    return output_path

Paso 4: Selección de Metraje de Archivo

def search_pexels_videos(query, count=5):
    """Busca en Pexels clips de video en orientación vertical."""
    url = "https://api.pexels.com/videos/search"
    headers = {"Authorization": os.environ["PEXELS_API_KEY"]}
    params = {"query": query, "per_page": count, "orientation": "portrait", "size": "medium"}
    response = requests.get(url, headers=headers, params=params)
    videos = response.json().get('videos', [])
    results = []
    for v in videos:
        files = sorted(v['video_files'], key=lambda x: x.get('height', 0), reverse=True)
        hd = next((f for f in files if f.get('height', 0) >= 720), files[0])
        results.append({'id': v['id'], 'url': hd['link'], 'duration': v['duration']})
    return results

Paso 5: Generación de Subtítulos

def generate_subtitles(audio_path, output_srt='subtitles.srt'):
    """Genera subtítulos a nivel de palabra usando WhisperX."""
    import whisperx, srt
    from datetime import timedelta
    model = whisperx.load_model("base", device="cpu")
    audio = whisperx.load_audio(audio_path)
    result = model.transcribe(audio)
    align_model, metadata = whisperx.load_align_model(language_code="en")
    aligned = whisperx.align(result["segments"], align_model, metadata, audio)
    subs = []
    words = [w for seg in aligned["segments"] for w in seg.get("words", [])]
    for i in range(0, len(words), 4):
        group = words[i:i + 4]
        if not group: continue
        start = timedelta(seconds=group[0].get('start', 0))
        end = timedelta(seconds=group[-1].get('end', 0))
        text = ' '.join(w['word'] for w in group)
        subs.append(srt.Subtitle(index=len(subs)+1, start=start, end=end, content=text))
    with open(output_srt, 'w') as f:
        f.write(srt.compose(subs))
    return output_srt

Paso 6: Ensamblaje de Video con FFmpeg

import subprocess

def assemble_video(clips, narration, subtitles, output='final.mp4'):
    """Ensambla el video final: concatena clips, agrega narración y subtítulos."""
    concat_list = 'concat_list.txt'
    with open(concat_list, 'w') as f:
        for clip in clips:
            f.write(f"file '{clip}'\n")
    subprocess.run([
        'ffmpeg', '-y', '-f', 'concat', '-safe', '0', '-i', concat_list,
        '-vf', 'scale=1080:1920:force_original_aspect_ratio=increase,crop=1080:1920',
        '-c:v', 'libx264', '-preset', 'fast', '-an', 'temp_video.mp4'
    ], check=True)
    subtitle_filter = (f"subtitles={subtitles}:force_style='"
        "FontName=Arial,FontSize=18,PrimaryColour=&H00FFFFFF,"
        "OutlineColour=&H00000000,Outline=2,Bold=1,Alignment=2'")
    subprocess.run([
        'ffmpeg', '-y', '-i', 'temp_video.mp4', '-i', narration,
        '-vf', subtitle_filter, '-c:v', 'libx264', '-c:a', 'aac',
        '-shortest', output
    ], check=True)
    return output

Paso 7: Pipeline Completo

def generate_video(topic, output_dir='./output'):
    """Pipeline completo: tema -> video terminado."""
    import os
    os.makedirs(output_dir, exist_ok=True)
    script = generate_script(topic)
    narration = generate_voice_elevenlabs(script, f'{output_dir}/narration.mp3')
    keywords = topic.split()[:3]
    videos = search_pexels_videos(' '.join(keywords), count=3)
    clips = []
    for i, v in enumerate(videos):
        path = f'{output_dir}/clip_{i}.mp4'
        requests.get(v['url'], stream=True)  # descargar clip
        clips.append(path)
    subs = generate_subtitles(narration, f'{output_dir}/subs.srt')
    return assemble_video(clips, narration, subs, f'{output_dir}/final.mp4')

Ejemplos

Ejemplo 1: Generar un Lote de Videos de Datos Tecnológicos

Un creador produce 5 videos cortos con temática tecnológica para TikTok en una sola ejecución:

topics = [
    "Herramientas de IA de las que nadie habla",
    "Apps que se sienten ilegales de usar gratis",
    "Sitios web que te volarán la mente",
    "Herramientas de IA gratuitas que todo estudiante necesita",
    "Gadgets tecnológicos por menos de $50 que cambiaron mi vida"
]
for topic in topics:
    output = generate_video(topic, output_dir=f'./output/{topic[:30]}')
    print(f"Video listo: {output}")
# Cada video: ~45 segundos, vertical 1080x1920, con subtítulos y narración
# Costo total: ~$0.25 (5 x $0.05 por video) usando ElevenLabs + Claude Sonnet

Ejemplo 2: Shorts Financieros Diarios para YouTube

Un canal de finanzas automatiza la subida diaria de Shorts con temas de dinero de tendencia:

import schedule

def daily_finance_video():
    topic = "3 ideas de ingresos pasivos que realmente funcionan en 2025"
    script = generate_script(topic, duration_seconds=55)
    # Salida del guion:
    # GANCHO: "Estás perdiendo dinero cada día que no conoces estos."
    # CUERPO: 1. Tiendas print-on-demand ($500-2k/mes)
    #       2. Licencias de contenido generado por IA ($300-1k/mes)
    #       3. Acumulación de ETFs de dividendos ($200-800/mes pasivos)
    # CTA: "Sigue para más consejos de dinero que nadie te cuenta."
    narration = generate_voice_openai(script, './daily/narration.mp3')
    videos = search_pexels_videos("dinero finanzas inversión", count=4)
    # Descarga 4 clips verticales de metraje de dinero/gráficos/estilo de vida
    # Ensambla con subtítulos blancos en negrita, genera un Short de 55 segundos
    final = assemble_video(['./daily/clip_0.mp4', './daily/clip_1.mp4'],
                           narration, './daily/subs.srt', './daily/final.mp4')

schedule.every().day.at("08:00").do(daily_finance_video)

Directrices

  • Respeta los derechos de autor — usa solo metraje de archivo libre de regalías (Pexels, Pixabay) o tu propio contenido
  • Revela el uso de IA — YouTube y TikTok requieren la divulgación de contenido generado por IA
  • Revisa antes de publicar — siempre mira el video final; los guiones de IA pueden contener inexactitudes
  • Optimiza los primeros 3 segundos — el gancho determina si los espectadores se quedan o se desplazan
  • Prueba múltiples voces — ElevenLabs ofrece docenas de voces; encuentra una que se adapte a tu nicho
  • Monitorea el rendimiento — rastrea vistas, retención y tasa de clics para iterar el estilo del contenido

Referencias

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

TerminalSkills/skills

>- Lovable (formerly GPT Engineer) is a browser-based AI app builder that turns a natural-language description into a working full-stack web app with a built-in backend, authentication, database and one-click publishing. Use when the user wants to prototype or ship a web app with Lovable, write effective Lovable prompts, connect Supabase or GitHub, review generated security rules, or move a Lovable project into their own editor.

Skills relacionados