Narrative-aware Multimodal Video Editing Agent
多模态理解 + 长视频检索 + 多 Agent 粗剪 + 轻量偏好学习 + 可解释评测。
CineCut-Agent 输入 10–60 分钟长视频 + 自然语言创作 brief,输出:
- 2–3 个(可扩展到 30/60/90)候选 rough cut(mp4)
- timeline JSON / EDL
- SRT 字幕
- 可解释报告(Markdown + HTML)
- baseline/full/ablation 的评测结果
This project focuses on editing orchestration, not video generation model training.
系统按阶段串联为一条可追踪主链路:
- 输入层:接收长视频与自然语言 brief,并进行参数标准化。
- 解析与规划层:Brief Parser 输出结构化约束;DirectorAgent 生成故事节拍计划(story beats)。
- 记忆构建层:Memory Builder 生成 shot / scene / episode 三层记忆,融合 ASR、OCR、音频、运动、视觉标签信息。
- 检索层:RetrieverAgent 基于节拍计划执行迭代检索(sub-queries),联合向量检索与结构化过滤。
- 编辑层:EditorAgent 在时长约束下生成多候选时间线(语义优先、节奏情绪优先、叙事完整性优先)。
- 评审与修订层:CriticAgent 从 brief 满足度、连贯性、节奏、冗余、镜头多样性等维度打分并给出修订建议。
- 排序层:Reranker 使用规则弱标、合成偏好样本与人工 A/B 标注特征进行候选重排序。
- 导出与评测层:输出 mp4/json/edl/srt 与解释报告,并通过 baseline/full/ablation 评测指标进行对比。
-
backend/app/services/memory_builder.py
分层 memory(shot/scene/episode)构建,支持 PySceneDetect/faster-whisper/EasyOCR/librosa 的可选接入与 fallback。 -
backend/app/agents/DirectorAgent: brief -> story beats JSONRetrieverAgent: iterative sub-query temporal retrievalEditorAgent: Candidate A/B/C 生成CriticAgent: 多维打分 + 修订建议
-
backend/app/services/reranker.py
pairwise logistic reranker + synthetic negatives(7 类)+ 特征工程。 -
backend/app/evaluation/runner.py
baseline/full/ablation 统一评测入口。 -
frontend/gradio_app/app.py
Gradio 交互页面:上传/brief、日志、候选预览、播放、解释、A/B 标注。
cinecut-agent/
backend/app/
api/ core/ models/ schemas/ services/
agents/ memory/ retrieval/ editing/ evaluation/ providers/
frontend/gradio_app/
scripts/
tests/
configs/
docs/
sample_data/
references/
notes/
outputs/
- Python 3.11+
- 建议安装 ffmpeg
python -m pip install -e .
# 如果需要本地视频工具链
python -m pip install -e .[video]python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --app-dir backendpython -m frontend.gradio_app.apppython scripts/run_demo.py --provider stub- 运行
python scripts/run_demo.py --provider stub。 - 脚本自动生成
sample_data/generated/demo_input.mp4(若不存在)。 - 执行
plan -> retrieve -> edit -> critique -> revise -> export -> report。 - 输出位于
outputs/demo_run/:A-*.mp4/B-*.mp4/C-*.mp4*.timeline.json,*.edl,*.srtreport.md,report.html,result.json
配置 .env(参考 .env.example):
PROVIDER_MODE=auto|stub|openaiOPENAI_BASE_URLOPENAI_API_KEYOPENAI_MODEL
统一接口(ProviderBase):
caption_cliptag_shotsummarize_sceneplan_editcritique_timelinejudge_pairwise
无 API Key 时自动 fallback 到 LocalStubProvider。
python scripts/train_reranker.py --pairs sample_data/preference_pairs.json特征包含:
- semantic relevance
- narrative coverage
- emotion peak coverage
- dialogue density
- shot diversity
- aesthetic score
- redundancy penalty
- duration penalty
- brief constraint satisfaction
python scripts/run_eval.py --benchmark sample_data/benchmark.json --system full_system
python scripts/run_eval.py --benchmark sample_data/benchmark.json --system baseline_transcript
python scripts/run_eval.py --benchmark sample_data/benchmark.json --ablation no_critic
python scripts/run_eval.py --benchmark sample_data/benchmark.json --ablation no_reranker
python scripts/run_eval.py --benchmark sample_data/benchmark.json --ablation no_cinematic_tags指标:
- duration error
- redundancy ratio
- brief coverage score
- narrative coverage score
- shot diversity score
- judge preference win rate
- human preference win rate(接口预留)
参考仓库位于 references/,详细审计见:
notes/reference_audit.md
主仓库 license:MIT。
对于非商用或 license 不清晰仓库,仅参考思路,不复用实现代码。