AI Video Generation Skill
Generate complete videos from text descriptions using AI.
Capabilities
- 1. Image Generation - DALL-E 3, Stable Diffusion, Flux
- Video Generation - LumaAI, Runway, Replicate models
- Voice-over - OpenAI TTS, ElevenLabs
- Video Editing - FFmpeg assembly, transitions, overlays
Quick Start
CODEBLOCK0
Setup
Required API Keys
Add to your environment or .env file:
CODEBLOCK1
Install Dependencies
CODEBLOCK2
FFmpeg
Already installed via winget.
Usage Examples
1. Text to Video (Full Pipeline)
CODEBLOCK3
2. Multiple Scenes
CODEBLOCK4
3. Image Sequence to Video
CODEBLOCK5
Workflow Options
Budget Mode (FREE)
- - Image: Stable Diffusion (local or free API)
- Video: Open source models
- Voice: OpenAI TTS (cheap) or free TTS
- Edit: FFmpeg
Quality Mode (Paid)
- - Image: DALL-E 3 or Midjourney
- Video: Runway Gen-3 or LumaAI
- Voice: ElevenLabs
- Edit: FFmpeg + effects
Scripts Reference
- -
generate_video.py - Main end-to-end generator - INLINECODE2 - Convert image sequence to video
- INLINECODE3 - Add narration to existing video
- INLINECODE4 - Create multi-scene videos
- INLINECODE5 - Apply effects, transitions, overlays
API Cost Estimates
- - DALL-E 3: ~$0.04-0.08 per image
- Replicate: ~$0.01-0.10 per generation
- LumaAI: $0-0.50 per 5sec (free tier available)
- Runway: ~$0.05 per second
- OpenAI TTS: ~$0.015 per 1K characters
- ElevenLabs: ~$0.30 per 1K characters (better quality)
Examples
See examples/ folder for sample outputs and prompts.
AI 视频生成技能
使用AI从文本描述生成完整视频。
能力
- 1. 图像生成 - DALL-E 3、Stable Diffusion、Flux
- 视频生成 - LumaAI、Runway、Replicate模型
- 语音旁白 - OpenAI TTS、ElevenLabs
- 视频编辑 - FFmpeg合成、转场、叠加
快速开始
bash
生成完整视频
python skills/ai-video-gen/generate_video.py --prompt 山峦上的日落 --output sunset.mp4
仅将图像转为视频
python skills/ai-video-gen/images
tovideo.py --images img1.png img2.png --output result.mp4
添加语音旁白
python skills/ai-video-gen/add_voiceover.py --video input.mp4 --text 您的旁白 --output final.mp4
设置
所需API密钥
添加到您的环境变量或.env文件中:
bash
图像生成(任选其一)
OPENAI
APIKEY=sk-... # DALL-E 3
REPLICATE
APITOKEN=r8_... # Stable Diffusion、Flux
视频生成(任选其一)
LUMAAI
APIKEY=luma_... # LumaAI Dream Machine
RUNWAY
APIKEY=... # Runway ML
REPLICATE
APITOKEN=r8_... # 多种模型
语音(可选)
OPENAI
APIKEY=sk-... # OpenAI TTS
ELEVENLABS
APIKEY=... # ElevenLabs
或使用免费的本地选项(无需API)
安装依赖
bash
pip install openai requests pillow replicate python-dotenv
FFmpeg
已通过winget安装。
使用示例
1. 文本转视频(完整流程)
bash
python skills/ai-video-gen/generate_video.py \
--prompt 未来城市夜景,飞行汽车穿梭 \
--duration 5 \
--voiceover 欢迎来到未来 \
--output future_city.mp4
2. 多场景
bash
python skills/ai-video-gen/multi_scene.py \
--scenes 清晨日出 繁忙的城市街道 宁静的夜晚 \
--duration 3 \
--output dayinlife.mp4
3. 图像序列转视频
bash
python skills/ai-video-gen/imagestovideo.py \
--images frame1.png frame2.png frame3.png \
--fps 24 \
--output animation.mp4
工作流选项
经济模式(免费)
- - 图像:Stable Diffusion(本地或免费API)
- 视频:开源模型
- 语音:OpenAI TTS(廉价)或免费TTS
- 编辑:FFmpeg
高质量模式(付费)
- - 图像:DALL-E 3或Midjourney
- 视频:Runway Gen-3或LumaAI
- 语音:ElevenLabs
- 编辑:FFmpeg + 特效
脚本参考
- - generatevideo.py - 主端到端生成器
- imagestovideo.py - 将图像序列转换为视频
- addvoiceover.py - 为现有视频添加旁白
- multiscene.py - 创建多场景视频
- editvideo.py - 应用特效、转场、叠加
API成本估算
- - DALL-E 3:每张图像约$0.04-0.08
- Replicate:每次生成约$0.01-0.10
- LumaAI:每5秒$0-0.50(提供免费层级)
- Runway:每秒约$0.05
- OpenAI TTS:每1K字符约$0.015
- ElevenLabs:每1K字符约$0.30(更高质量)
示例
请参阅examples/文件夹获取示例输出和提示。