Skip to main content

Short video auto generator — AI配音+字幕+画面一键生成短视频

Project description

clipgen — 短视频自动生成器

AI 配音 + 字幕 + 画面,一键生成短视频。一行命令,从文案到成品。

clipgen demo

pip install clipgen
clipgen build my_video.yaml

它能做什么

写一个 YAML 配置文件,描述你的视频脚本和画面,clipgen 自动完成一切:

  1. 生成画面 — 内置 6 套 Douyin 风格模板(对比 / 终端演示 / 标题 / 代码对比 / 投票 / 关注引导)
  2. AI 配音 — Edge-TTS 驱动,支持中文语音,语速可调,完全免费
  3. 自动字幕 — 文案自动切分时间轴,生成 SRT 字幕
  4. 合成视频 — FFmpeg 渲染,逐段合成,输出 9:16 竖屏 MP4

快速开始

# 安装
pip install clipgen

# 查看可用模板
clipgen templates

# 从配置生成视频
clipgen build examples/hello.yaml        # 极简入门
clipgen build examples/cursor_vs.yaml    # 完整案例

示例配置

output: "my_video.mp4"
voice: "zh-CN-XiaoxiaoNeural"
rate: "+30%"

scenes:
  - script: "文案内容,AI 会读出这段文字"
    template: title
    data:
      title: "你的标题"
      subtitle: "副标题"
      accent: "#00d2ff"
      tags: ["🏷️ 标签1", "🏷️ 标签2"]

  - script: "第二段文案"
    template: terminal
    data:
      title: "终端标题"
      accent: "#00d2ff"
      lines:
        - text: "$ 命令"
          color: green
        - text: "   Done"
          color: green

  - script: "关注我"
    template: cta
    data:
      text: "关注我"
      subtitle: "每天一个技巧"

内置模板

模板 说明
title 标题卡,网格背景 + 标签
comparison 分屏对比(VS 风格)
terminal 终端窗口,命令输出演示
code_diff Before/After 代码对比
question A/B 投票选择,引导评论
cta 关注引导 + 按钮

定制模板

模板是一个 (draw: ImageDraw, scene: dict) 函数:

from clipgen.utils import *
from clipgen.engine import register_template

def render(draw, scene):
    gradient_bg(draw)
    draw.text((100, 500), scene.get("text"), fill=hex_rgb("#fff"), font=F(36))

register_template("my_template", render)

注册后即可在 YAML 中直接使用 template: my_template

依赖

  • Python ≥ 3.10
  • Pillow, PyYAML, edge-tts, imageio-ffmpeg
  • 不需要任何 API Key,不消耗 token,完全免费运行

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clipgen-0.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clipgen-0.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file clipgen-0.1.0.tar.gz.

File metadata

  • Download URL: clipgen-0.1.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for clipgen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bdc6b9242061e08f66c99e7f56e9296a3ba5167372afda611cbb8a823fa4570b
MD5 6bc30c0ad5bde0708f303fd2dfcf9923
BLAKE2b-256 bb4efd8f7cc950e72700fe1d89a1fbab230d0ea48ee304d183fa3d3efac0e362

See more details on using hashes here.

File details

Details for the file clipgen-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: clipgen-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for clipgen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b54fe9edd41c1f6a44489d508ab33c46a45dd063f0a88a79243821f6a6e3b91
MD5 860a46910e1e4bebedb8befe956478dd
BLAKE2b-256 b67fcdec20a3357cf481d78d202c1f5302e92a2dce5f5be4fd33cdf7de6820cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page