GitRead 中文社区
首页趋势排行榜原创文章严选周刊
更多资源
新手训练营
精选专题热门话题GitHub 文档资源精选实战指南

forge-film

多模型DAG驱动的并行AI电影生成——并行加速可随场景独立性扩展;同时生成电影场景,而不是一个个地生成; "把影视生成的执行图从拓扑序变成关键路径最优调度" ;唯一把场景叙事依赖建模为 DAG、以 CPM 算法驱动并行调度的影视生成引擎

  • 语言Python
  • 默认分支main
  • 大小1011 KB
  • 更新3月26日
  • Issues1
在 GitHub 打开
avatarF-R-L

项目介绍

F-R-L/forge-film 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 540 个 Star、16 次 Fork。

仓库全名
F-R-L/forge-film

README 摘要

🎬 Forge One story, multiple AI models, zero manual stitching. 中文文档 | Quick Start Making a multi-scene AI film means logging into Kling, CogVideoX, Seedance separately — downloading frames, color-correcting between models, stitching manually. An 8-scene short can eat half a day. Forge automates the entire pipeline. You write a story. Forge compiles it into a scene graph, routes each scene to the right model, runs…

完整内容见 GitHub 原始 README 或本页 。

常见问题

forge-film 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 540 个 Star。

forge-film 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 forge-film 的源码?

可以直接克隆仓库:git clone https://github.com/F-R-L/forge-film.git,默认分支为 main;安装与运行步骤见仓库 README。

forge-film 最近还在维护吗?

仓库最近一次更新为 3月26日,当前有 1 个未关闭 Issue;Star 数为 540,可作为社区活跃度的参考。

本页面展示项目元数据与原始 README,GitRead 中文社区 编辑团队负责选题收录。

相关仓库

public-apis/public-apis avatar
public-apispublic-apis
1 天前
498.9k
55.9k
2.7k

免费 API 汇总列表

apipublic-apisfree+7
Python
16.4 MB
7
详情
EbookFoundation/free-programming-books avatar
free-programming-booksEbookFoundation
2 天前
401.6k
67.8k
93

免费可获取的编程书籍

bookseducationhacktoberfest+2
Python
21.8 MB
3
详情
donnemartin/system-design-primer avatar
system-design-primerdonnemartin
9月15日
377.9k
59.3k
647

学习如何设计大规模系统。为系统设计面试做准备。包含 Anki 闪卡。

designdesign-patternsdesign-system+10
Python
11.0 MB
0
详情
vinta/awesome-python avatar
awesome-pythonvinta
1 天前
334.7k
29.1k
23

回答“我想用 Python 做 X,该用哪个工具?”的权威清单

awesomeawesome-listpython+3
Python
6.9 MB
2
详情
practical-tutorials/project-based-learning avatar
project-based-learningpractical-tutorials
5 天前
289.7k
36.8k
224

精选的项目实战教程列表

tutorialprojectbeginner-project+5
Python
472 KB
1
详情
NousResearch/hermes-agent avatar
hermes-agentNousResearch
29 分钟前
263.4k
59.4k
53.3k

与你共同成长的智能体

aiai-agentai-agents+10
Python
1.4 GB
4
详情
TheAlgorithms/Python avatar
PythonTheAlgorithms
1 天前
226.1k
51.3k
113

所有算法均用 Python 实现

algorithmalgorithm-competitionsalgorithms-implemented+11
Python
18.0 MB
2
详情
yt-dlp/yt-dlp avatar
yt-dlpyt-dlp
1 周前
207.8k
18.1k
2.1k

功能丰富的命令行音视频下载器

youtube-dlpythonsponsorblock+4
Python
63.5 MB
0
详情

关于

aiai-cinematographyai-filmmakingai-video-generationcpmcritical-path-methoddaggenerative-aigradiollm-workflowmulti-modalopen-source-videotext-to-videovideo-aivideo-generationworkflow-automation
  • MIT License
  • 540 Stars
  • 16 Forks
  • 1 Watching

简要分析

热度分
573
价值分
328
活跃状态
活跃
GitHub

语言占比

Python

贡献者

F-R-LF-R-L

Forge Banner

🎬 Forge

One story, multiple AI models, zero manual stitching.

CI Python License: MIT Version

中文文档 | Quick Start


Making a multi-scene AI film means logging into Kling, CogVideoX, Seedance separately — downloading frames, color-correcting between models, stitching manually. An 8-scene short can eat half a day.

Forge automates the entire pipeline. You write a story. Forge compiles it into a scene graph, routes each scene to the right model, runs them in parallel, keeps visual continuity across model boundaries, and outputs a single final.mp4.


What Forge does

🧭 Story → DAG — GPT-4o (or Claude / DeepSeek) compiles your story into a dependency graph. Scenes with no dependencies run in parallel.

⚡ CPM parallel scheduling — Critical Path Method finds the longest dependency chain and prioritizes it. N workers run simultaneously, not one by one.

🎯 Scene-type routing — dialogue → Kling, landscapes → CogVideoX (free, local), action → Kling. Fully configurable in forge.yaml.

🎨 Cross-model continuity — when scene B (CogVideoX) follows scene A (Kling), Forge extracts A’s last frame, applies histogram color matching, and passes it as the i2v seed. No jarring cuts.

🎬 Final assembly — once all scenes are generated, clips are concatenated in a single ffmpeg pass. Normalized resolution and frame rate. Outputs final.mp4.


End-to-end walkthrough

Given this story (examples/detective.txt):

A weary private detective takes on a missing-person case. His client is an anxious middle-aged woman whose husband vanished without a trace three days ago.
The detective searches the husband's office and finds an unsent letter and a basement key.
Meanwhile, a mysterious man begins tailing the detective through the streets.
The detective locates the basement and discovers a secret ledger the missing husband had hidden away.
The mysterious man suddenly appears — a confrontation erupts.
The detective delivers the secret ledger to the police, and the truth finally comes to light.

Forge compiles it into a DAG and schedules:

forge plan examples/detective.txt --scenes 6

Plan: 6 scenes
DAG: {'S1': ['S2', 'S3'], 'S2': ['S4'], 'S3': ['S5'], 'S4': ['S6'], 'S5': ['S6'], 'S6': []}

Routing:
  S1  dialogue    → kling_light
  S2  action      → kling_heavy
  S3  landscape   → cogvideo
  S4  action      → kling_heavy
  S5  dialogue    → kling_light
  S6  dialogue    → kling_light

Critical path: S1 → S2 → S4 → S6  (longest chain)
Estimated time: 20 min parallel  vs  30 min serial

Then runs:

forge run examples/detective.txt --workers 4

[00:00] S1 started  (kling_light)
[00:00] S3 started  (cogvideo)       ← parallel
[05:00] S1 done  → S2 unlocked
[05:00] S2 started  (kling_heavy)
[07:00] S3 done  → S3→S2 color calibration applied
[10:00] S2 done  → S4 unlocked
[10:00] S4 started  (kling_heavy)
...
[20:00] S6 done  → assembling final.mp4

Done. Output: ./output/final.mp4

Parallel scheduling

Forge uses the Critical Path Method (CPM) to find the longest dependency chain in your scene DAG and prioritizes those scenes first. Scenes with no blocking dependencies start immediately.

In the example above: S1→S2→S4→S6 is the critical path. With 4 workers, S1 and S3 launch simultaneously at t=0. The total wall time drops from 30 min (serial) to 20 min.

Speedup scales with scene independence — a story where half the scenes are parallel will run roughly 2× faster.

gantt title Without Forge — 6 scenes × 5 min = 30 min dateFormat mm axisFormat %M min section Sequential S1 :s1, 00, 5m S2 :s2, after s1, 5m S3 :s3, after s2, 5m S4 :s4, after s3, 5m S5 :s5, after s4, 5m S6 :s6, after s5, 5m
gantt title With Forge (CPM) — critical path = 15 min dateFormat mm axisFormat %M min section Worker 1 S1 (Kling) :s1, 00, 5m S3 (CogVideoX) :s3, after s1, 5m S5 (Seedance) :s5, after s3, 5m section Worker 2 S2 (Kling) :s2, 00, 5m S4 (CogVideoX) :s4, after s2, 5m S6 (Seedance) :s6, after s4, 5m

Cross-model continuity

Kling, CogVideoX, and Seedance have different color profiles, exposure levels, and visual styles. Cutting directly between them produces jarring transitions.

When scene B depends on scene A and they use different backends, Forge automatically:

  1. Extracts the last frame of scene A
  2. Applies histogram color matching to align the color distribution
  3. Passes the corrected frame as the i2v (image-to-video) seed for scene B

The result: visual continuity across model boundaries without manual color grading.

flowchart LR A["Scene A\nKling"] -->|"last frame"| B["ColorCalibrator\nhistogram match"] B -->|"seed image"| C["Scene B\nCogVideoX"] C -->|"last frame"| D["ColorCalibrator\nhistogram match"] D -->|"seed image"| E["Scene C\nSeedance"] style B fill:#f0a500,color:#000 style D fill:#f0a500,color:#000

🚀 Quickstart

Note 注意

No API keys? Use --backend mock for a full end-to-end run with zero external dependencies.

Requirements: Python 3.11+ · ffmpeg · GPU optional (CogVideoX local needs CUDA 12+)

git clone https://github.com/F-R-L/forge-film
cd forge-film
pip install -e .
cp .env.example .env
# Run with mock backend — no API keys needed
forge run examples/detective.txt --backend mock --workers 4

# Multi-model orchestration
forge run examples/multi_backend_demo.txt --workers 4

# Inspect DAG and routing without generating video
forge plan examples/detective.txt --scenes 6

# Launch Web UI
forge webui

Web UI — Run forge webui to launch the Gradio interface locally.

Forge Web UI

As a library

from forge.config import ForgeConfig
from forge.compiler.vision_compiler import VisionCompiler
from forge.scheduler.scheduler import ForgeScheduler

cfg = ForgeConfig("forge.yaml")
compiler = VisionCompiler(cfg.build_llm_provider())
plan = await compiler.compile(story_text, num_scenes=6)

scheduler = ForgeScheduler(plan, generate_fn, num_workers=cfg.workers)
results, failed = await scheduler.run(asset_map, output_dir="./output")

⚙️ Configuration

forge.yaml — all fields optional, falls back to environment variables and defaults.

llm:
  provider: openai      # openai | anthropic | deepseek
  model: gpt-4o

imagegen:
  provider: mock        # mock | openai | flux

routing:
  dialogue: kling_light     # Kling v1 — lip sync & character consistency
  action: kling_heavy       # Kling v1.5 Pro — motion quality
  landscape: cogvideo       # CogVideoX local — free
  default: mock

scheduler:
  workers: 4
# .env
OPENAI_API_KEY=sk-...
KLING_API_KEY=...
KLING_API_SECRET=...
Key Options Default
llm.provider openai | anthropic | deepseek openai
imagegen.provider openai | flux | mock mock
validator.provider openai | anthropic | mock mock
routing.dialogue any backend name kling_light
routing.landscape any backend name cogvideo
scheduler.workers int 4

🆚 How Forge compares

Forge OpusClip Agent Seedance Multi-shot FilmAgent
Open source ✅ MIT ❌ Closed SaaS ❌ ✅ Research prototype
Local deployment ✅ ❌ ❌ Partial
Multi-model mixing ✅ ✅ not configurable ❌ single model ❌ 3D virtual space
Cross-model color calibration ✅ Unknown N/A N/A
Pluggable backends ✅ ❌ ❌ ❌
Data privacy ✅ stays local ❌ third-party ❌ Partial

🎬 Supported backends

Backend Type Best for Cost
kling_light API (Kling v1) Dialogue, character consistency, lip sync Per-second
kling_heavy API (Kling v1.5 Pro) Action, complex motion, longer clips Per-second (higher)
cogvideo Local (CogVideoX-2b) Landscapes, transitions, atmospheric shots Free (GPU)
seedance API (Seedance) Fast motion, sports, dynamic scenes Per-second
wan Local (Wan 2.x) General purpose, good quality/cost ratio Free (GPU)
mock Local (no-op) Testing, CI, development Free

All backends implement the same BasePipeline interface — adding a new one takes ~50 lines.


❓ FAQ

Do I need a GPU? No. All cloud backends (Kling, Seedance) are API-based. A GPU is only needed if you use the local CogVideoX or Wan backends.

Can I use only one video model? Yes. Set all routing keys to the same backend in forge.yaml, or pass --backend kling_light on the CLI.

How does Forge handle API failures? Each scene retries up to scheduler.max_retries times (default: 2) with exponential backoff. Failed scenes are returned in the failed dict so you can inspect or re-run them.

What video formats does the assembler output? H.264 MP4 by default via ffmpeg. Resolution and frame rate are normalized across all input clips before concatenation.

Can I plug in my own video model? Yes — subclass BasePipeline in forge/generation/base.py, implement generate(), and register it in the router. No changes needed elsewhere.


🏗️ Architecture

Forge Architecture

forge.yaml
    │
    ├── VisionCompiler   story → ProductionPlan (scenes + DAG)
    ├── AssetFoundry     reference images per character / location
    ├── ForgeScheduler   CPM critical path · N workers · retries
    │       ├── PipelineRouter    scene_type → kling / cogvideo / seedance
    │       └── ColorCalibrator   last-frame histogram match for i2v
    ├── VLM Validator    optional frame consistency check
    └── StreamAssembler  ffmpeg concat → final.mp4

📁 Project structure

forge/
  compiler/      # Story → DAG (LLM-driven)
  providers/     # LLM / ImageGen / VLM abstractions
  scheduler/     # DAG topology + CPM scheduling
  generation/    # Video backend pipelines
  continuity/    # Cross-model color calibration
  assets/        # Reference image generation + cache
  validation/    # VLM frame consistency check
  assembler/     # Streaming video concatenation
  cli.py
  webui/
forge.yaml
examples/
tests/         # 20 tests, no API keys needed
benchmarks/

🗺️ Roadmap

  • Multi-model semantic routing by scene type
  • Cross-model color calibration (histogram matching)
  • Pluggable LLM / ImageGen / VLM providers
  • CPM scheduling with backend-aware duration estimates
  • forge.yaml unified config
  • Gradio Web UI
  • CogVideoX local backend
  • Seedance backend
  • Wan 2.x backend
  • GPU-accelerated local video assembly
  • Story template library
  • Real benchmark results with Kling API

🤝 Contributing

PRs and issues welcome — see CONTRIBUTING.md.


📄 License

MIT — see LICENSE

评论

登录 后发表评论
暂无评论
GitRead 中文社区
深度解读 · 趋势洞察 · 价值精选

关于

关于我们联系我们编辑准则收录标准赞赏人员

发现

技术趋势新手训练营资源精选实战指南精选专题热门话题GitHub 文档

条款

隐私政策服务条款网站地图
26.9万收录项目
7.3万中文话题
155精选专题
发现技术价值,连接开源智慧
© 2026 GitRead · GitHub 中文社区 本站与 GitHub, Inc. 无隶属关系;GitHub 是 GitHub, Inc. 的商标。