Skip to content

Reverse-engineer any video, shot by shot: filmed, AI-generated or coded, and how to remake it. Breakdowns in the open VIDEO.md format. 逆向一切视频,逐个镜头看是拍的、AI 生成的还是代码做的,再告诉你怎么复刻;拆解结果按 VIDEO.md 格式输出。

Tailor remake plans, prompt drafts, and API options to each video model

june6c8dd9de06f8
diff --git a/rea_video/capabilities/models/video.yaml b/rea_video/capabilities/models/video.yaml
index 66ec49d..45db048 100644
--- a/rea_video/capabilities/models/video.yaml
+++ b/rea_video/capabilities/models/video.yaml
@@ -18,6 +18,7 @@ models:
# 首帧 / 首尾帧 和 参考图 / 参考视频 / 参考音频 不能放在同一个请求里(多家接口文档一致;即梦 App 的「全能参考」可用 @图片 作为首帧)
exclusive_inputs: [[video.i2v_first_frame, video.i2v_first_last], [video.multi_reference, video.reference_video, video.reference_audio]]
audio: {native: true}
+ planning: {no_real_faces: true, api_params: {omni_reference_task_type: reference}}
strengths:
- 单次 30 秒,内含多个逻辑连贯的镜头
- 一次可传 30 图 + 10 视频 + 10 音频参考;支持 clay render(无纹理 3D 白模)、动作、创意参考
@@ -51,6 +52,7 @@ models:
# 首帧 / 首尾帧 和 参考素材 不能同传:按 Seedance 2.5 推断,Flash 没有单独说明
exclusive_inputs: [[video.i2v_first_frame, video.i2v_first_last], [video.multi_reference, video.reference_video, video.reference_audio]]
audio: {native: true}
+ planning: {no_real_faces: true, api_params: {omni_reference_task_type: reference}}
strengths:
- 比 Seedance 2.5 便宜约三分之一、快约一倍,适合出草稿
- 和 2.5 一样有首尾帧和全能参考两种模式
@@ -82,6 +84,7 @@ models:
# 首帧 / 首尾帧 和 参考素材 不能放在同一个请求里;即梦 App 的「全能参考」可用 @图片 作为首帧
exclusive_inputs: [[video.i2v_first_frame, video.i2v_first_last], [video.multi_reference, video.reference_video, video.reference_audio]]
audio: {native: true}
+ planning: {no_real_faces: true}
strengths:
- 成本低;Mini 720p 被 Hypit 用作 A-roll / B-roll 主力(单条视频总成本约 1.1 美元)
- 一次可出多个镜头:在提示词里按镜头编号写(不支持逐镜时间戳)
@@ -205,6 +208,7 @@ models:
refs: {image: 7, video: 1}
ref_video_s: {min: 3, max: 10}
audio: {native: true}
+ planning: {no_audio_with_ref_video: true}
strengths:
- 视频改视频:换角色或道具、重新风格化、重打光,保留原动作
- Element 参考一致性更强;Director Mode 可组合文本、首尾帧、参考图和角色视频
@@ -353,6 +357,7 @@ models:
limits:
duration_s: {max: 16}
audio: {native: true}
+ planning: {api_params: {is_rec: false}}
strengths:
- Reference-to-Video 主打多主体一致:主体、环境、服装、道具、风格都可以作为参考
- 原生音效覆盖环境声、动作音、Foley、情绪音效;内置粒子、流体、转场等 6 类特效
@@ -377,6 +382,7 @@ models:
resolutions: [540p, 720p, 1080p, 2K, 4K]
refs: {image: 15, audio: 3}
audio: {native: true, voice_ref: true}
+ planning: {api_params: {is_rec: false}}
strengths:
- 表演和口型自然,台词和音效一起生成;最高 4K,2K / 4K 为 10-bit
- 参考生视频最多 15 张参考图加 3 段声音参考,保持角色长相和音色
@@ -406,6 +412,7 @@ models:
duration_s: {max: 15}
resolutions: [1080p]
audio: {native: true}
+ planning: {strategy: keyframes, api_params: {thinking_type: disabled}}
strengths:
- 20 多种镜头参数(焦段、光圈、景深、畸变、色差、暗角),适合复刻有特定"镜头感"的片子
- 多镜头;Hypit 已接入(通过 HypiHub 支持参考视频与首尾帧)
@@ -471,6 +478,7 @@ models:
# 首帧 / 尾帧 和 参考素材 不能同传;视频和音频只能在参考模式下用
exclusive_inputs: [[video.i2v_first_frame, video.i2v_first_last], [video.multi_reference, video.reference_video, video.reference_audio]]
audio: {native: true, voice_ref: true}
+ planning: {strategy: frames, api_params: {prompt_expansion_mode: disabled}}
strengths:
- H3 的快速版(名字叫 Max,官方文档写的是快速生成档),厂商称 5 秒片段约 3 秒出
- 参考图、参考视频、参考音频都能用;可以关掉提示词扩写
@@ -499,6 +507,7 @@ models:
resolutions: [480p, 768p]
refs: {image: 9, video: 3, audio: 3, total: 12}
audio: {native: true, voice_ref: true}
+ planning: {strategy: keyframes, images: 4}
strengths:
- 便宜、快(6 步采样);可以单独导出声音分轨
- 提示词指南写得很细,参考图、参考视频、参考音频都能用
@@ -601,6 +610,7 @@ models:
duration_s: {max: 10}
resolutions: [768p, 1080p]
audio: {native: false}
+ planning: {api_params: {prompt_optimizer: false}}
strengths:
- 微表情、风格化、动作有提升
- 便宜(Fast 版 768p 6 秒约 0.19 美元起)
@@ -628,6 +638,7 @@ models:
# 首帧 / 首尾帧 和 参考素材 不能放在同一个请求里
exclusive_inputs: [[video.i2v_first_frame, video.i2v_first_last], [video.multi_reference, video.reference_video, video.reference_audio]]
audio: {native: true}
+ planning: {api_params: {prompt_extend: false}}
strengths:
- 第三方榜单第二(Elo 约 1229)
- 一次可出多个镜头:按「第 N 个镜头[起-止秒]」写,每段 2–5 秒
@@ -692,6 +703,7 @@ models:
limits:
resolutions: [720p]
audio: {native: false}
+ planning: {api_params: {prompt_extend: false}}
strengths:
- Apache 2.0;TI2V-5B 单张消费级显卡可跑
- 可自部署、可微调,适合批量低成本生成
@@ -735,6 +747,7 @@ models:
access: [open-weights, api]
primitives: [video.t2v, video.i2v_first_frame, video.reference_audio, video.multi_shot, video.edit_v2v, video.native_audio, avatar.audio_driven]
audio: {native: true}
+ planning: {api_params: {enhance_prompt: false}}
strengths:
- 开源模型中少有的音画同出,支持音频条件生成、编辑、多镜头和超分
weaknesses:
@@ -758,6 +771,7 @@ models:
primitives: [video.t2v, video.i2v_first_frame]
limits:
resolutions: [720p, 1080p]
+ planning: {api_params: {rewrite: false}}
strengths:
- 8.3B,约 14GB 显存可跑(需 offload);自带超分模块,可把自身输出放大到 1080p
weaknesses:
diff --git a/rea_video/capabilities/prompting.yaml b/rea_video/capabilities/prompting.yaml
index 928e8e0..dd7ce74 100644
--- a/rea_video/capabilities/prompting.yaml
+++ b/rea_video/capabilities/prompting.yaml
@@ -22,6 +22,14 @@ keyframes:
models:
seedance-2.5:
basis: vendor
+ draft:
+ shot: {zh: "{s0}-{s1}秒:{text}", en: "{s0}-{s1}s: {text}"}
+ remix_shot: {zh: "镜头{i}:{text}", en: "Shot {i}: {text}"}
+ image_tag: {zh: "图片{n}", en: "Image {n}"}
+ video_tag: {zh: "视频{n}", en: "Video {n}"}
+ dialogue_fmt: {zh: '{speaker}:"{text}"', en: '{speaker}: "{text}"'}
+ negatives_line: false
+ tail: {zh: ["无BGM、无配乐、无氛围铺底音,不要字幕"], en: ["No BGM, no background music, no ambient score, no subtitles"]}
structure: >-
四块:素材指代 → 一句话概述(主体 + 地点 + 事件 + 题材 / 风格 + 特殊运镜)→ 具体情节(按时间戳或「镜头 N」分段,逐段写画面、运镜、动作、台词、音效)→ 结尾写全程不变的东西(机位、环境、声音、氛围)
language: 中文、英文都支持,官方没说哪个更好;台词语言要统一
@@ -66,6 +74,18 @@ models:
seedance-2.5-flash:
basis: vendor
+ draft:
+ shot: {zh: "{s0}-{s1}秒:{text}", en: "{s0}-{s1}s: {text}"}
+ remix_shot: {zh: "镜头{i}:{text}", en: "Shot {i}: {text}"}
+ image_tag: {zh: "图片{n}", en: "Image {n}"}
+ video_tag: {zh: "视频{n}", en: "Video {n}"}
+ dialogue_fmt: {zh: '{speaker}:"{text}"', en: '{speaker}: "{text}"'}
+ negatives_line: false
+ tail: {zh: ["无BGM、无配乐、无氛围铺底音,不要字幕"], en: ["No BGM, no background music, no ambient score, no subtitles"]}
+ lint:
+ max_cjk: 500
+ forbid:
+ - {re: '编辑视频|增加|加上|删除|去掉|修改|替换|改成|换成|延长|延续|续写', when: refs, level: warn, why: 带参考素材时这些词会让请求被当成编辑或续写任务:换个说法,或把 omni_reference_task_type 设成 reference}
structure: >-
官方只说写得简洁具体:主体、动作、运镜、画面风格,一次只写一个动作。没有单独的指南,按 Seedance 2.5 的写法(rea-video models seedance-2.5)
frame_mode: >-
@@ -81,6 +101,12 @@ models:
seedance-2.0:
basis: vendor
+ draft:
+ shot: {zh: "镜头{i}:{text}", en: "Shot {i}: {text}"}
+ image_tag: {zh: "@图片{n}", en: "@Image{n}"}
+ video_tag: {zh: "@视频{n}", en: "@Video{n}"}
+ dialogue_fmt: {zh: "{speaker}说{{{text}}}", en: "{speaker} says {{{text}}}"}
+ sfx_fmt: "<{text}>"
structure: 精准主体 + 动作细节 + 场景环境 + 光影色调 + 镜头运镜 + 视觉风格 + 画质 + 约束条件
language: 中文、英文;台词语言统一,不要中英混用;不要整段贴剧本
length: 中文 500 字以内,英文 1000 词以内
@@ -114,7 +140,14 @@ models:
kling-4.0:
basis: vendor
- draft: {shot: {zh: "镜头{i}({d}秒):{text}", en: "Shot {i} ({d}s): {text}"}, image_tag: "@Image{n}", video_tag: "@Video{n}"}
+ draft:
+ shot: {zh: "镜头{i}({d}秒):{text}", en: "Shot {i} ({d}s): {text}"}
+ image_tag: "@Image{n}"
+ video_tag: "@Video{n}"
+ dialogue_fmt: {zh: '{speaker}:"{text}"', en: '{speaker}: "{text}"'}
+ lint:
+ forbid:
+ - {re: '\b(?:premium look|masterpiece|8k|best quality)\b', level: warn, why: Kling 4.0 对抽象质量词没有响应,请换成具体的光线与质感描述}
structure: >-
四块:[Asset Roles] 每个素材管什么 → [Overall Settings] 整体设定 → [Sequence of Events] 按时间写事件,再写运镜 → [Audio] 声音。先用一句话写清主体、场景、动作、情绪,再只补运镜、时间、声音和要保持不变的东西
language: 没有指定提示词语言;台词和画面文字支持中、英、日、韩、西、葡、德、法、印地语,中文方言和英语口音
@@ -143,6 +176,11 @@ models:
kling-4.0-flash:
basis: vendor
+ draft:
+ shot: {zh: "镜头{i}({d}秒):{text}", en: "Shot {i} ({d}s): {text}"}
+ image_tag: "@Image{n}"
+ video_tag: "@Video{n}"
+ dialogue_fmt: {zh: '{speaker}:"{text}"', en: '{speaker}: "{text}"'}
structure: >-
和 Kling 4.0 同一套写法(rea-video models kling-4.0):素材职责 → 整体设定 → 按时间写事件 → 声音
length: >-
@@ -160,6 +198,10 @@ models:
kling-3.0:
basis: third-party
+ draft:
+ shot: {zh: "[Shot {i}] {text}", en: "[Shot {i}] {text}"}
+ image_tag: "@Element{n}"
+ dialogue_fmt: {zh: '{speaker}:"{text}"', en: '{speaker}: "{text}"'}
lint: {max_chars: 2500}
structure: 没有固定公式;按 主体、动作、场景、运镜、光线、情绪 来写,示例顺序是 场景 → 主体 → 运镜 → 动作 → 台词
language: 中文、英文都可以;台词支持中、英、日、韩、西和方言口音
@@ -188,6 +230,12 @@ models:
kling-o3:
basis: vendor
+ draft:
+ shot: {zh: "镜头{i}({d}秒):{text}", en: "Shot {i} ({d}s): {text}"}
+ image_tag: "@Image{n}"
+ video_tag: "@Video{n}"
+ dialogue_fmt: {zh: '{speaker}:"{text}"', en: '{speaker}: "{text}"'}
+ sfx_fmt: "Audio: {text}"
lint: {max_chars: 2500}
structure: >-
参考生成:[主体的细节描述] + [主体之间的互动 / 动作] + [环境或背景] + [光线、风格等视觉方向]
@@ -214,8 +262,17 @@ models:
veo-3.1:
basis: vendor
- draft: {lang: en, shot: "[{a}-{z}] {text}", image_tag: "image {n}", negatives_line: false}
- lint: {language: en}
+ draft:
+ lang: en
+ shot: "[{a}-{z}] {text}"
+ image_tag: "image {n}"
+ dialogue_fmt: "{speaker} says: {text}"
+ sfx_fmt: "SFX: {text}"
+ negatives_line: false
+ lint:
+ language: en
+ forbid:
+ - {re: '\bsays?\s*[,:]?\s*"', level: warn, why: "Veo 3.1 台词建议用冒号不加引号(says: …),加引号容易烧出乱码字幕"}
structure: >-
[Cinematography 镜头] + [Subject 主体] + [Action 动作] + [Context 环境] + [Style & Ambiance 风格氛围];短片一条提示词只写一个集中的瞬间
language: 提示词用英文
@@ -246,6 +303,9 @@ models:
grok-imagine-video-1.5:
basis: vendor
+ draft:
+ image_tag: "<IMAGE_{n0}>"
+ negatives_line: false
references: >-
按位置编号:<IMAGE_0>、<IMAGE_1>…,不是 @image;如果用 image 字段锁了首帧,它就是 <IMAGE_0>。声音是 <AUDIO_0> 到 <AUDIO_2>(预设音色)。每张参考图只给一个职责、在画面里一个固定位置;参考图多时人物少放、道具别动
frame_mode: >-
@@ -260,8 +320,17 @@ models:
gemini-omni-flash:
basis: vendor
- draft: {lang: en, shot: "[{s0}-{s1}s] {text}", image_tag: "reference image {n}", video_tag: "reference video {n}"}
- lint: {language: en}
+ draft:
+ lang: en
+ shot: "[{s0}-{s1}s] {text}"
+ image_tag: "reference image {n}"
+ video_tag: "reference video {n}"
+ dialogue_fmt: "{speaker} says: {text}"
+ sfx_fmt: "Sound design: {text}"
+ lint:
+ language: en
+ forbid:
+ - {re: '<FIRST_FRAME>|<LAST_FRAME>', level: warn, why: Google 原生接口已弃用 <FIRST_FRAME> 控制串,请改用自然语言说明}
structure: 没有公式,自然语言写清场景、运镜、光线、氛围
language: 英文(其他语言官方未评估)
length: 官方没给上限
@@ -285,6 +354,11 @@ models:
vidu-q3:
basis: third-party
+ draft:
+ shot: {zh: "{s0}–{s1}秒:{text}", en: "{s0}-{s1}s: {text}"}
+ image_tag: {zh: "图{n}", en: "Image {n}"}
+ sfx_fmt: "SFX: {text}"
+ lint: {max_chars: 5000}
structure: 主体 / 场景 + 场景描述 + 环境描述 + 画风 / 媒介;用自然的句子,主体少一点,关键风格词可以重复
language: 没有指定;语音输出支持中、英、日
length: 文生、图生、首尾帧 20000 字符以内(Turbo 文生 5000);参考生视频 5000
@@ -310,6 +384,10 @@ models:
vidu-q4-preview:
basis: vendor
+ draft:
+ shot: {zh: "{s0}–{s1}秒:{text}", en: "{s0}-{s1}s: {text}"}
+ image_tag: "@{n}"
+ lint: {max_chars: 20000}
structure: >-
官方没有提示词指南。第三方建议按时间分段:0–4 秒交代场景,4–10 秒动作,10–16 秒反应;每段写景别、运镜、台词和声音
length: >-
@@ -331,6 +409,19 @@ models:
pixverse-v6:
basis: vendor
+ draft:
+ lang: en
+ first_shot: "Start with: {text}"
+ shot: "Cut to: {text}"
+ image_tag: "@Subject{n}"
+ video_tag: "@Video{n}"
+ sfx_fmt: "Audio: {text}"
+ negatives_line: false
+ tail: ["Preserve consistent lighting and color grade across all shots."]
+ lint:
+ max_chars: 2000
+ forbid:
+ - {re: '\b(?:no|not|without|don''t|avoid)\s+\w+|不要|禁止', level: warn, why: PixVerse 把否定词当正面指令,请改成正面约束(如 camera stays steady)}
structure: 三句:第一句 主体 + 动作 + 地点;第二句 运镜 + 风格;第三句 约束。核心动作放最前
language: 什么语言都收,建议英文
length: 50–80 个词起步;fal 上限 2048 字节(中文一个字占 3 字节)
@@ -361,6 +452,7 @@ models:
shot: "[Shot {i}] At {at}, the camera cuts to: {text}"
image_tag: "<Picture {n}>"
video_tag: "<Video {n}>"
+ dialogue_fmt: "({speaker}) <d>[{lang}] {text}</d>"
negatives_line: false
tail: ["overall_soundscape: Only the natural sounds of the actions on screen.", "non_diegetic_music: N/A"]
structure: >-
@@ -404,6 +496,7 @@ models:
shot: "[Shot {i}] At {at}, the camera cuts to: {text}"
image_tag: "<Picture {n}>"
video_tag: "<Video {n}>"
+ dialogue_fmt: "({speaker}) <d>[{lang}] {text}</d>"
negatives_line: false
tail: ["overall_soundscape: Only the natural sounds of the actions on screen.", "non_diegetic_music: N/A"]
structure: >-
@@ -434,7 +527,13 @@ models:
pika-h3-flex:
basis: vendor
- draft: {lang: en, first_shot: "[Shot 1] {text}", shot: "[Shot {i}] at {a}: {text}", image_tag: "@Image{n}", video_tag: "@Video{n}"}
+ draft:
+ lang: en
+ first_shot: "[Shot 1] {text}"
+ shot: "[Shot {i}] at {a}: {text}"
+ image_tag: "@Image{n}"
+ video_tag: "@Video{n}"
+ dialogue_fmt: '{speaker}: "{text}"'
lint: {language: en, max_chars: 8000}
structure: >-
按播放顺序写:画面和场景 → 谁在哪 → 每个动作以及它怎么结束
@@ -474,7 +573,13 @@ models:
hailuo-2.3:
basis: vendor
- lint: {max_chars: 2000}
+ draft:
+ camera_brackets: true
+ negatives_line: false
+ lint:
+ max_chars: 2000
+ forbid:
+ - {re: '\[Shot\s*\d|镜头\s*\d', why: Hailuo 2.3 一次只出一个镜头,不支持多镜头分段}
structure: 官方没有公式;常用顺序是 景别 / 运镜 → 主体 → 动作 → 场景 / 光线,一段 6 秒只写一个动作节拍
language: 没有说明
length: 2000 字符以内
@@ -497,9 +602,10 @@ models:
wan-3.0:
basis: vendor
draft:
- shot: {zh: "第{i}个镜头[{s0}-{s1}秒]{text}"}
+ shot: {zh: "第{i}个镜头[{s0}-{s1}秒]{text}", en: "Shot {i} [{s0}-{s1}s] {text}"}
image_tag: {zh: "图{n}", en: "Image {n}"}
video_tag: {zh: "视频{n}", en: "Video {n}"}
+ dialogue_fmt: {zh: '{speaker}说:"{text}"', en: '{speaker} says: "{text}"'}
negatives_line: false
tail: {zh: ["负向清单:字幕、文字、水印"], en: ["Negative list: subtitles, captions, watermarks"]}
lint: {max_chars: 20000}
@@ -544,6 +650,12 @@ models:
wan-2.2:
basis: vendor
+ draft:
+ negatives_line: false
+ lint:
+ max_chars: 800
+ forbid:
+ - {re: '\[Shot\s*\d|镜头\s*\d', why: Wan 2.2 一次只出一个镜头,不支持多镜头分段}
structure: >-
主体 + 场景 + 运动 + 美学控制(光源、光线、景别、视角、镜头、运镜)+ 风格化。有风格就放最前,美学词用标签,后面接主体、动作过程、背景。不写氛围、感受一类的文学描写
language: 中文、英文都可以(官方负面词和改写默认是中文)
@@ -567,8 +679,18 @@ models:
ltx-2.5:
basis: vendor
- draft: {lang: en}
- lint: {language: en}
+ draft:
+ lang: en
+ first_shot: "{text}"
+ shot: "A hard cut transitions to {text}"
+ join: " "
+ dialogue_fmt: '{speaker} says "{text}"'
+ negatives_line: false
+ lint:
+ language: en
+ forbid:
+ - {re: '\[Shot\s*\d+\]|(?:^|\n)\s*Shot\s+\d+\s*[:(]', why: LTX-2.5 用一段连贯英文描写,不用镜头编号列表(切镜写 A hard cut transitions to…)}
+ - {re: '\b(?:Visual|Audio|SFX)\s*:', level: warn, why: "LTX-2.5 不用 Visual: / Audio: 标签,直接写进句子里"}
structure: >-
一整段英文,按时间顺序、现在时:主要动作 → 细节动作 → 外观 → 环境 → 运镜 → 光线 → 变化。不用 "Audio:" "Visual:" 这类标签;景别、运镜、视角写进句子里,不要写成 "medium shot, static camera —" 这样的前缀;不写推测出来的情绪,写看得见的动作
language: 英文;台词保留原语言,原样放在引号里
@@ -595,6 +717,11 @@ models:
hunyuanvideo-1.5:
basis: vendor
+ draft:
+ negatives_line: false
+ lint:
+ forbid:
+ - {re: '\[Shot\s*\d|镜头\s*\d', why: HunyuanVideo 1.5 一次只出一个镜头,不支持多镜头分段}
structure: >-
文生视频:主体 + 运动 + 场景 + [景别] + [运镜] + [光线] + [风格] + [氛围]。复杂动作:场景设定 + 按顺序拆动作(First… then… next… meanwhile… finally…)+ 关键细节。情绪词换成动作细节;方向用画面坐标(画面左侧 / 右侧、前景 / 背景);多个角色用属性或位置区分
language: 中文、英文都可以
@@ -613,6 +740,11 @@ models:
flux-3-video:
basis: vendor
+ draft:
+ lang: en
+ first_shot: "SHOT ONE: {text}"
+ shot: "HARD CUT. SHOT {I_WORD}: {text}"
+ dialogue_fmt: '{speaker}: "{text}"'
structure: >-
主体和动作 → 运镜 → 场景和氛围 → 运动的质感 → 连续性约束
multi_shot: >-
@@ -634,6 +766,11 @@ models:
flux-3-video-max:
basis: vendor
+ draft:
+ lang: en
+ first_shot: "SHOT ONE: {text}"
+ shot: "HARD CUT. SHOT {I_WORD}: {text}"
+ dialogue_fmt: '{speaker}: "{text}"'
structure: >-
没有单独的指南,按 FLUX 3 Video 的写法(rea-video models flux-3-video)
frames: >-
@@ -646,7 +783,13 @@ models:
runway-gen-4.5:
basis: vendor
- lint: {max_chars: 1000}
+ draft:
+ lang: en
+ negatives_line: false
+ lint:
+ max_chars: 1000
+ forbid:
+ - {re: '\b(?:no|not|without|don''t|avoid)\s+\w+|不要|禁止', level: warn, why: Runway Gen-4.5 不支持否定词(可能得到相反结果),请改成正面描述}
structure: >-
文生视频:"[Camera] shot of [subject] [action] in [environment]. [补充描述]";图生视频:"The camera [运镜] as the subject [动作]. [补充描述]"。不认 JSON 格式
language: 什么语言都收,英文最稳
@@ -678,8 +821,15 @@ models:
luma-ray3.2:
basis: vendor
- draft: {lang: en}
- lint: {language: en, max_chars: 6000}
+ draft:
+ lang: en
+ negatives_line: false
+ lint:
+ language: en
+ max_chars: 6000
+ forbid:
+ - {re: '\b(?:vibrant|whimsical|hyper-realistic)\b', level: warn, why: Luma 官方建议避免 vibrant / whimsical / hyper-realistic 这类空泛词}
+ - {re: '\[Shot\s*\d|(?:^|\n)\s*Shot\s+\d+\s*[:(]', why: Luma Ray 3.2 一次只出一个镜头,不支持多镜头分段}
structure: 运镜放最前,再写场景、发生什么、光线和风格;加一个速度词(slowly、smoothly)。动词用进行中的动作(running,不用 begins to run),现在时
language: 英文
length: 100 个词左右(上限 6000 字符)
diff --git a/rea_video/capabilities/schema.json b/rea_video/capabilities/schema.json
index 3c8de9e..d58562a 100644
--- a/rea_video/capabilities/schema.json
+++ b/rea_video/capabilities/schema.json
@@ -60,7 +60,19 @@
}
},
"confidence": {"enum": ["high", "medium", "low"]},
- "planning": {"type": "object", "additionalProperties": false, "description": "How remake plans use this model by default, when that is narrower than its limits", "properties": {"strategy": {"enum": ["remix", "keyframes", "frames", "text"]}, "images": {"type": "integer", "minimum": 1}}},
+ "planning": {
+ "type": "object",
+ "additionalProperties": false,
+ "description": "How remake plans use this model by default, when that is narrower than its limits",
+ "properties": {
+ "strategy": {"enum": ["remix", "keyframes", "frames", "text"]},
+ "images": {"type": "integer", "minimum": 1},
+ "no_real_faces": {"type": "boolean", "description": "Model rejects reference images or videos containing identifiable real human faces"},
+ "no_audio_with_ref_video": {"type": "boolean", "description": "Native audio cannot be enabled when a reference video is sent"},
+ "max_hardcut_s": {"type": "number", "minimum": 1, "description": "Maximum seconds of consecutive hard-cut shots in a non-remix multi-shot call"},
+ "api_params": {"type": "object", "description": "Model-specific API parameters to pass in remake jobs"}
+ }
+ },
"prompting": {"type": "object", "description": "Optional inline prompt-writing rules for user-defined model entries"},
"probe_scores": {"type": "object"},
"notes": {"type": "string"}
diff --git a/rea_video/cli.py b/rea_video/cli.py
index d4bda17..b3561e7 100644
--- a/rea_video/cli.py
+++ b/rea_video/cli.py
@@ -765,6 +765,15 @@ def cmd_plan(args) -> int:
set_lang(b.get("lang", "zh"))
b = finalize(b, out, engine=m["id"])
plan = b.get("production_plan") or {}
+ if getattr(args, "rewrite_prompts", False) and plan.get("units"):
+ from .generation import rewrite_prompts
+
+ _check_vlm_config()
+ rewritten = rewrite_prompts(plan, out, client=_vlm_client(out))
+ b = finalize(b, out, engine=m["id"])
+ plan = b.get("production_plan") or {}
+ print(T("已按 {m} 的写法自动重写 {n} 段提示词 → {f}", "Rewrote {n} unit prompt(s) for {m} → {f}",
+ m=m["id"], n=len(rewritten), f=out / "remake" / "prompts.json"))
n = sum(len(ref_clips(b, out, u)) for u in plan.get("units") or [])
v = m.get("verified") or {}
print(T("复刻方案已按 {m} 重出(报告第二部分):{p}", "Remake plan redone for {m} (part two of the report): {p}",
@@ -1084,6 +1093,7 @@ def main(argv: list[str] | None = None) -> int:
pl_.add_argument("out_dir", help="拆解目录")
pl_.add_argument("--model", help="模型 id 或名称,写进 remake/intent.yaml(rea-video models 列出的;没有的先查资料补进 ~/.rea-video/capabilities/models/)")
pl_.add_argument("--generate", choices=["ai", "all"], help="ai:只生成原片里 AI 做的镜头,实拍的出拍摄方案;all:整条都用模型生成(换人、换物后整条复刻)")
+ pl_.add_argument("--rewrite-prompts", action="store_true", help="用已配置的大模型(GEMINI_API_KEY 或 REA_VLM_*)按所选模型的提示词指南自动重写每段提示词,校验后写入 remake/prompts.json")
pl_.set_defaults(func=cmd_plan)
mo = sub.add_parser("models", help="列出能力地图里的生成模型;带模型 id 时打印这个模型的提示词写法和关键帧要求")
diff --git a/rea_video/cli_en.py b/rea_video/cli_en.py
index a0e05a6..cfdeb3b 100644
--- a/rea_video/cli_en.py
+++ b/rea_video/cli_en.py
@@ -152,6 +152,7 @@ HELP = {
"plan.out_dir": "breakdown directory",
"plan.model": "model id or name, saved to remake/intent.yaml (from rea-video models; for others, look it up and add it under ~/.rea-video/capabilities/models/)",
"plan.generate": "ai: generate only the shots that were AI in the original and write a shooting plan for live action; all: generate the whole video (full remake after swapping people or objects)",
+ "plan.rewrite_prompts": "use the configured model (GEMINI_API_KEY or REA_VLM_*) to rewrite each unit's prompt in the chosen video model's style, validate and save to remake/prompts.json",
"models": "list generation models in the capability map; with a model id, print its prompt guide and key-frame requirements",
"models.model": "model id (such as seedance-2.5, kling-3.0); keyframes prints the general key-frame guide",
diff --git a/rea_video/generation.py b/rea_video/generation.py
index caa4f2b..75aa79e 100644
--- a/rea_video/generation.py
+++ b/rea_video/generation.py
@@ -27,10 +27,10 @@ from pathlib import Path
import yaml
from .readings import shot_description
-from . import performance
+from . import entities, performance
from .classify import LABEL_ZH
from .i18n import T, join, lang, model_name, semi, shot_ids, using
-from .plan import framing_words, shot_prompts, with_acting
+from .plan import camera_move_words, framing_words, hailuo_bracket, shot_prompts, with_acting
REF_CLIP_S = 15.0 # one reference video: Seedance / Kling take clips up to about 15 s each
SHORT_UNIT_S = 3.0 # a call this short on its own is unstable and wasteful
@@ -102,6 +102,14 @@ def load_prompts(out: Path) -> dict[str, str]:
return {k: v for k, v in got.items() if isinstance(v, str) and v.strip()} if isinstance(got, dict) else {}
+def save_prompts(out: Path, prompts: dict[str, str]) -> Path:
+ p = Path(out) / PROMPTS_FILE
+ p.parent.mkdir(parents=True, exist_ok=True)
+ clean = {k: v.strip() for k, v in prompts.items() if isinstance(k, str) and isinstance(v, str) and v.strip()}
+ p.write_text(json.dumps(clean, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
+ return p
+
+
# ---------------------------------------------------------------- what the model takes
def spec_of(model: dict | None) -> dict:
m = model or {}
@@ -117,10 +125,19 @@ def spec_of(model: dict | None) -> dict:
"ref_total": float(rv) if rv else REF_CLIP_S * max(1, int(refs.get("video") or 1)),
"multi_ref": multi_ref, "images": int(refs.get("image") or (UNKNOWN_IMAGES if multi_ref else 0)),
"images_stated": bool(refs.get("image")), "prefer": plan.get("strategy"), "plan_images": plan.get("images"),
+ "no_real_faces": bool(plan.get("no_real_faces")),
+ "no_audio_with_ref_video": bool(plan.get("no_audio_with_ref_video")),
+ "max_hardcut_s": float(plan["max_hardcut_s"]) if plan.get("max_hardcut_s") else None,
+ "api_params": dict(plan["api_params"]) if isinstance(plan.get("api_params"), dict) else {},
"first": "video.i2v_first_frame" in prim, "last": "video.i2v_first_last" in prim,
"exclusive": bool(lim.get("exclusive_inputs")), "native_audio": bool((m.get("audio") or {}).get("native"))}
+def effective_native_audio(spec: dict, strategy: str) -> bool:
+ """Whether the chosen strategy can actually generate native sound on this model."""
+ return bool(spec.get("native_audio")) and not (strategy == "remix" and spec.get("no_audio_with_ref_video"))
+
+
def call_seconds(spec: dict, secs: float, refs: bool = False) -> int:
"""The length one call asks for: the model's allowed lengths when it only takes some (Veo: 4 / 6 / 8 s, 8 s with
reference images), else whole seconds within its range; the clip is trimmed to `secs` afterwards."""
@@ -137,10 +154,17 @@ def planned_images(spec: dict) -> int:
def choose_strategy(spec: dict, n_own: int) -> str:
- if spec["ref_video"] and spec.get("prefer") in (None, "remix") and spec["ref_total"] >= REMIX_MIN_REF_S:
+ pref = spec.get("prefer")
+ if pref == "text":
+ return "text"
+ if pref == "frames" and spec["first"]:
+ return "frames"
+ if spec["ref_video"] and (spec["multi_shot"] or pref == "remix") and pref in (None, "remix") and spec["ref_total"] >= REMIX_MIN_REF_S:
return "remix"
- if spec["multi_shot"] and spec["multi_ref"] and planned_images(spec) >= n_own + 2:
+ if spec["multi_shot"] and spec["multi_ref"] and pref in (None, "keyframes") and planned_images(spec) >= n_own + 2:
return "keyframes"
+ if spec["multi_shot"] and not spec["multi_ref"] and n_own == 0:
+ return "text"
if spec["first"]:
return "frames"
return "text"
@@ -220,6 +244,13 @@ def _clips(ranges: list[list[float]], each: float) -> list[list[list[float]]]:
# ---------------------------------------------------------------- one unit
+_WORD_NUMS = ("ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "ELEVEN", "TWELVE")
+_STATIC_ZH_RE = re.compile(r"^(?:(?:竖屏|横屏|方屏)(?:\s*\d+:\d+)?[,,;;\s]*)*(?:(?:大?远景|大?全景|中近景|中全景|中景|近景|大?特写|平视|略?[俯仰]拍|顶拍)[,,。;;\s]*)+")
+_STATIC_EN_RE = re.compile(r"^(?:(?:vertical|horizontal|square)(?:\s*\d+:\d+)?[,;.\s]*)*(?:(?:extreme\s+|medium\s+)?(?:wide|full|medium|close-up)(?:\s+shot)?[,;.\s]*|(?:eye-level|slightly\s+(?:high|low)\s+angle|high\s+angle|low\s+angle|top-down)[,;.\s]*)+", re.I)
+_LANG_MAP = {"zh": "Chinese", "en": "English", "ja": "Japanese", "ko": "Korean", "es": "Spanish", "fr": "French"}
+_REAL_FACE_LABELS = ("live_action", "film_footage", "avatar")
+
+
def _shot_text(r: dict) -> str:
"""What happens in the shot, in the report's language when the reader wrote it in both."""
p = shot_prompts(r)
@@ -228,16 +259,82 @@ def _shot_text(r: dict) -> str:
return p.get("video_prompt") or shot_description(r)
-def _brief(seg: list[dict], keyframe_tag: dict[int, str]) -> list[dict]:
+def _motion_text(r: dict, en: bool = False) -> str:
+ """Motion-only text for first/last-frame image-to-video: prefers an explicit motion_prompt, else strips static
+ framing prefixes from the video prompt so the text does not repeat what the input frame already shows."""
+ p = shot_prompts(r)
+ if en:
+ if p.get("motion_prompt_en"):
+ return p["motion_prompt_en"]
+ base = p.get("video_prompt_en") or ""
+ return _STATIC_EN_RE.sub("", base).strip() or base
+ if lang() == "en" and p.get("motion_prompt_en"):
+ return p["motion_prompt_en"]
+ if p.get("motion_prompt"):
+ return p["motion_prompt"]
+ base = _shot_text(r)
+ return (_STATIC_EN_RE if lang() == "en" else _STATIC_ZH_RE).sub("", base).strip() or base
+
+
+def _line_lang(text: str, default_code: str = "") -> str:
+ if re.search(r"[\u3040-\u30ff]", text):
+ return "Japanese"
+ if re.search(r"[\uac00-\ud7af]", text):
+ return "Korean"
+ if re.search(r"[\u3400-\u9fff]", text):
+ return "Chinese"
+ return _LANG_MAP.get(default_code.lower(), "English")
+
+
+def _shot_audio(b: dict | None, r: dict, want_dialogue: bool, want_sfx: bool) -> tuple[list[dict], list[str]]:
+ """Spoken lines and diegetic SFX falling inside shot `r`."""
+ if not b:
+ return [], []
+ dlg: list[dict] = []
+ if want_dialogue:
+ narr_lang = str(((b.get("whole_video_vlm") or {}).get("narration") or {}).get("language") or "")
+ for idx, ln in enumerate(entities.script(b), 1):
+ a, z = ln.get("start"), ln.get("end")
+ if isinstance(a, (int, float)) and isinstance(z, (int, float)) and r["start"] <= (a + z) / 2 < r["end"]:
+ txt = str(ln.get("text") or "").strip()
+ if not txt:
+ continue
+ spk = str(ln.get("voice") or ln.get("speaker") or f"S{idx}").strip()
+ dlg.append({"speaker": spk, "text": txt, "lang": _line_lang(txt, narr_lang),
+ **({"delivery": ln["delivery"]} if ln.get("delivery") else {})})
+ sfx: list[str] = []
+ if want_sfx:
+ for e in (b.get("audio_plan") or {}).get("sfx_merged") or []:
+ t = e.get("t")
+ if isinstance(t, (int, float)) and r["start"] <= t < r["end"] and e.get("confidence") != "low" and e.get("sync_with") != "text_pop":
+ desc = str(e.get("description") or e.get("type") or "").strip()
+ if desc and desc not in sfx:
+ sfx.append(desc)
+ return dlg, sfx
+
+
+def _brief(seg: list[dict], keyframe_tag: dict[int, str], b: dict | None = None,
+ want_dialogue: bool = False, want_sfx: bool = False) -> list[dict]:
out, acc = [], 0.0
for r in seg:
act = performance.of(r)
+ mv_loc, mv_en = camera_move_words(r)
+ dlg, sfx = _shot_audio(b, r, want_dialogue, want_sfx)
+ has_face = r["base"]["label"] in _REAL_FACE_LABELS or (isinstance(r.get("faces"), (int, float)) and r["faces"] >= 0.3)
out.append({"shot": r["index"], "time": [round(r["start"], 3), round(r["end"], 3)], "at": round(acc, 3),
"duration": round(r["duration"], 3), "label": r["base"]["label"],
"source": shot_description(r),
- "action": with_acting(_shot_text(r), act, en=lang() == "en"), "framing": framing_words(r)[0],
- "action_en": with_acting(shot_prompts(r).get("video_prompt_en") or "", act, en=True), "framing_en": framing_words(r)[1],
- "composition": keyframe_tag.get(r["index"]), **({"acting": performance.summary(act)} if act else {})})
+ "action": with_acting(_shot_text(r), act, en=lang() == "en"),
+ "motion": with_acting(_motion_text(r, en=lang() == "en"), act, en=lang() == "en"),
+ "framing": framing_words(r)[0], "camera_move": mv_loc,
+ "action_en": with_acting(shot_prompts(r).get("video_prompt_en") or "", act, en=True),
+ "motion_en": with_acting(_motion_text(r, en=True), act, en=True),
+ "framing_en": framing_words(r)[1], "camera_move_en": mv_en,
+ "bracket": hailuo_bracket(r), "real_face": has_face,
+ "composition": keyframe_tag.get(r["index"]),
+ **({"dialogue": dlg} if dlg else {}),
+ **({"sfx": sfx} if sfx else {}),
+ **({"acting": performance.summary(act)} if act else {})})
acc += r["duration"]
return out
@@ -253,10 +350,52 @@ def _swap_line(sw: dict) -> str:
+ (T("(参考 {k})", " (see {k})", k=sw["tag"]) if sw.get("tag") else ""))
-def _draft(strategy: str, refs: list[dict], brief: list[dict], swaps: list[dict], style, fmt: dict | None = None) -> str:
+def _format_audio_bits(x: dict, fmt: dict, en: bool) -> str:
+ """Format a shot's spoken lines and SFX in the chosen model's own syntax."""
+ bits = []
+ sfx_tpl = fmt.get("sfx_fmt")
+ for s in x.get("sfx") or []:
+ if en and not s.isascii():
+ continue
+ bits.append(sfx_tpl.format(speaker="", lang="English", text=s, emotion="") if sfx_tpl else T("音效:{s}", "SFX: {s}", s=s))
+ dlg_tpl = fmt.get("dialogue_fmt")
+ for idx, d in enumerate(x.get("dialogue") or [], 1):
+ spk = d.get("speaker") or f"S{idx}"
+ if en and not spk.isascii():
+ spk = f"S{idx}"
+ elif dlg_tpl and "({speaker})" in dlg_tpl and not re.fullmatch(r"S\d+", spk):
+ spk = f"S{idx}" # MiniMax H3 expects speaker codes (S1), (S2)
+ txt = d["text"]
+ if dlg_tpl:
+ bits.append(dlg_tpl.format(speaker=spk, lang=d.get("lang", "Chinese"), text=txt, emotion=""))
+ else:
+ bits.append(T('{p}:"{t}"', '{p}: "{t}"', p=spk, t=txt))
+ return (". " if en else "。") + (" ".join(bits) if en else ";".join(bits)) if bits else ""
+
+
+def _tail_lines(raw_tail: list[str] | None, brief: list[dict], ambience: str = "") -> list[str]:
+ """Populate soundscape tail fields (such as MiniMax H3's overall_soundscape:) with measured SFX / ambience when available."""
+ if not raw_tail:
+ return []
+ sfx_en = list(dict.fromkeys(s for x in brief for s in (x.get("sfx") or []) if s.isascii()))
+ amb_en = ambience.strip() if ambience and ambience.isascii() else ""
+ out = []
+ for line in raw_tail:
+ if line.startswith("overall_soundscape:") and (sfx_en or amb_en):
+ parts = [amb_en.rstrip(".")] if amb_en else []
+ if sfx_en:
+ parts.append("Distinct action sounds: " + ", ".join(sfx_en[:5]))
+ out.append("overall_soundscape: " + ". ".join(parts) + ".")
+ else:
+ out.append(line)
+ return out
+
+
+def _draft(strategy: str, refs: list[dict], brief: list[dict], swaps: list[dict], style, fmt: dict | None = None,
+ ambience: str = "") -> str:
"""A prompt from the brief: what to keep, what changes, shot by shot. `fmt` (the model's `draft` block in
- prompting.yaml) sets the prompt language, the shot lines, how images / videos are named and the fixed fields, so the
- draft is already in the model's own shape; the agent still checks it against the model's notes."""
+ prompting.yaml) sets the prompt language, the shot lines, how images / videos are named, camera brackets, dialogue
+ syntax and the fixed fields, so the draft is already in the model's own shape."""
raw = fmt or {}
dl = raw.get("lang") or lang()
with using(dl):
@@ -272,25 +411,46 @@ def _draft(strategy: str, refs: list[dict], brief: list[dict], swaps: list[dict]
head.append(T("按下面的镜头顺序一次生成,镜头之间硬切;每个镜头的构图、景别和机位参考对应的原片画面图",
"Generate the shots below in order in one go, hard cuts between them; each shot takes composition, size and camera from its source frame image"))
head += [_swap_line(sw) for sw in swaps]
- st = style.get(lang(), "") if isinstance(style, dict) else style
- if st:
- head.append(st)
+ # in first/last-frame mode, the input frame already fixes aspect ratio, lighting and colour grade; repeating them weakens motion
+ if strategy != "frames":
+ st = style.get(lang(), "") if isinstance(style, dict) else style
+ if st:
+ head.append(st)
if fmt.get("negatives_line", True):
head.append(T("画面里不要出现字幕、文字和水印", "No subtitles, captions or watermarks in the picture"))
lines = []
for i, x in enumerate(brief, 1):
- text = (x.get("action_en") if en and x.get("action_en") else x["action"]) \
- or T("(缺镜头描述:先看图复核补写)", "(no description: write one in the image review)")
- framing = x.get("framing_en") if en else x.get("framing")
- if strategy == "keyframes" and not x.get("composition") and framing:
- text = framing + T("。", ". ") + text
- if x.get("composition"):
- text += T("(构图参考 {k})", " (composition: {k})", k=x["composition"])
+ if strategy == "frames":
+ text = (x.get("motion_en") if en and x.get("motion_en") else x.get("motion") or x.get("action")) \
+ or T("(缺镜头描述:先看图复核补写)", "(no description: write one in the image review)")
+ mv = x.get("camera_move_en") if en else x.get("camera_move")
+ if fmt.get("camera_brackets") and x.get("bracket") and "[" not in text:
+ text = f"{x['bracket']} {text}"
+ elif mv and mv.lower() not in text.lower():
+ text = mv + T(",", ", ") + text
+ else:
+ text = (x.get("action_en") if en and x.get("action_en") else x["action"]) \
+ or T("(缺镜头描述:先看图复核补写)", "(no description: write one in the image review)")
+ framing = x.get("framing_en") if en else x.get("framing")
+ if strategy == "keyframes" and not x.get("composition") and framing:
+ text = framing + T("。", ". ") + text
+ if x.get("composition"):
+ text += T("(构图参考 {k})", " (composition: {k})", k=x["composition"])
+ if fmt.get("camera_brackets") and x.get("bracket") and "[" not in text:
+ text = f"{x['bracket']} {text}"
+ audio_tail = _format_audio_bits(x, fmt, en)
+ if audio_tail:
+ text = text.rstrip("。.;;") + audio_tail
a, z = x["at"], x["at"] + x["duration"]
- keys = {"i": i, "text": text, "a": _mmss(a), "z": _mmss(z), "at": _mmss(a, ms=True),
+ i_word = _WORD_NUMS[i - 1] if i <= len(_WORD_NUMS) else str(i)
+ keys = {"i": i, "I_WORD": i_word, "text": text, "a": _mmss(a), "z": _mmss(z), "at": _mmss(a, ms=True),
"s0": int(round(a)), "s1": max(int(round(z)), int(round(a)) + 1), "d": max(1, int(round(x["duration"])))}
- if fmt.get("shot"):
- lines.append((fmt.get("first_shot") if i == 1 and fmt.get("first_shot") else fmt["shot"]).format(**keys))
+ shot_tpl = fmt.get("remix_shot") if strategy == "remix" and fmt.get("remix_shot") else fmt.get("shot")
+ if shot_tpl:
+ if len(brief) == 1 and strategy == "frames" and not fmt.get("first_shot"):
+ lines.append(text)
+ else:
+ lines.append((fmt.get("first_shot") if i == 1 and fmt.get("first_shot") else shot_tpl).format(**keys))
elif len(brief) == 1:
lines.append(text)
elif strategy == "remix":
@@ -298,11 +458,15 @@ def _draft(strategy: str, refs: list[dict], brief: list[dict], swaps: list[dict]
else:
lines.append(T("镜头{i}(从 {a:.1f} 秒起):{t}", "Shot {i} (from {a:.1f}s): {t}", i=i, a=a, t=text))
sep = T("。", ". ")
- out = fmt.get("head", "") + sep.join(h.rstrip("。.") for h in head) + sep.rstrip() + "\n" + "\n".join(lines)
- if fmt.get("tail"):
- out += "\n" + "\n".join(fmt["tail"])
+ join_str = fmt.get("join") if isinstance(fmt.get("join"), str) else "\n"
+ body_lines = join_str.join(ln.rstrip(".") + "." if join_str == " " and not ln.rstrip().endswith((".", "!", "?", '"')) else ln for ln in lines)
+ prefix = (sep.join(h.rstrip("。.") for h in head) + sep.rstrip() + (" " if join_str == " " else "\n")) if head else ""
+ out = (fmt.get("head") or "") + prefix + body_lines
+ tail = _tail_lines(fmt.get("tail"), brief, ambience=ambience)
+ if tail:
+ out += "\n" + "\n".join(tail)
tags = {"图片": fmt.get("image_tag"), "视频": fmt.get("video_tag")}
- return REF_TAG.sub(lambda m: tags[m.group(1)].format(n=m.group(2)) if tags[m.group(1)] else m.group(0), out)
+ return REF_TAG.sub(lambda m: tags[m.group(1)].format(n=m.group(2), n0=max(0, int(m.group(2)) - 1)) if tags[m.group(1)] else m.group(0), out)
def _mmss(t: float, ms: bool = False) -> str:
@@ -338,7 +502,7 @@ def _inputs(strategy: str, refs: list[dict], seg: list[dict], spec: dict) -> lis
def build_unit(seg: list[dict], k: int, strategy: str, spec: dict, own: list[dict], swaps: list[dict], style,
- model: dict | None, fmt: dict | None = None) -> dict:
+ model: dict | None, fmt: dict | None = None, b: dict | None = None) -> dict:
t0, t1 = seg[0]["start"], seg[-1]["end"]
dur = round(sum(r["duration"] for r in seg), 3)
ranges = _ranges(seg)
@@ -372,13 +536,17 @@ def build_unit(seg: list[dict], k: int, strategy: str, spec: dict, own: list[dic
keyframe_tag[r["index"]] = tag
refs.append({"tag": tag, "keyframe": r["index"], "t": round(r["start"] + min(0.3, r["duration"] / 2), 3),
"what": T("原片镜头 #{i} 的画面(擦掉字幕):只参考构图、景别和机位", "source shot #{i} (subtitles erased): composition, size and camera only", i=r["index"])})
- brief = _brief(seg, keyframe_tag)
+ can_audio = effective_native_audio(spec, strategy)
+ vsrc = (((b or {}).get("sound_sources") or {}).get("voice") or {}).get("source")
+ want_dlg = can_audio and (vsrc == "ai_video_native" or bool(((b or {}).get("intent") or {}).get("native_dialogue")))
+ ambience = str(((b or {}).get("whole_video_vlm") or {}).get("ambience") or "")
+ brief = _brief(seg, keyframe_tag, b=b, want_dialogue=want_dlg, want_sfx=can_audio)
call_s = call_seconds(spec, dur / parts, refs=bool(refs))
unit = {"id": f"G{k}", "kind": "generate", "strategy": strategy, "label": label, "label_zh": LABEL_ZH[label],
"shots": [r["index"] for r in seg], "start": round(t0, 3), "end": round(t1, 3), "duration": dur, "ranges": ranges,
"mode": "multi_shot" if len(seg) > 1 else ("split" if parts > 1 else "single"), "calls": parts,
"generate_s": round(dur / parts, 3), "call_s": call_s, "model": (model or {}).get("id"), "model_name": model_name((model or {}).get("name")),
- "refs": refs, "brief": brief, "draft": _draft(strategy, refs, brief, unit_swaps, style, fmt), "draft_format": bool(fmt),
+ "refs": refs, "brief": brief, "draft": _draft(strategy, refs, brief, unit_swaps, style, fmt, ambience=ambience), "draft_format": bool(fmt),
"inputs": _inputs(strategy, refs, seg, spec)}
unframed = [x["shot"] for x in brief if strategy == "keyframes" and not x.get("composition")]
missing = [x["shot"] for x in brief if not x["action"]]
@@ -412,7 +580,7 @@ def part_starts(b: dict) -> set[int]:
def plan_generation(b: dict, model: dict | None, intent: dict, new_scene: set[int], style, skip: set[int],
- notes: dict | None = None) -> dict:
+ notes: dict | None = None, hardcut_max_s: float = 10.0) -> dict:
"""Generation units and the facts they were planned on. `skip`: shots made another way (motion drive, a clip
reused from another unit)."""
spec = spec_of(model)
@@ -428,29 +596,33 @@ def plan_generation(b: dict, model: dict | None, intent: dict, new_scene: set[in
if s["from"] or s["to"]:
swaps.append({"from": s["from"], "to": s["to"], "tag": tag})
strategy = choose_strategy(spec, len(own))
+ cap_hardcut = spec.get("max_hardcut_s") or hardcut_max_s
if strategy == "remix":
- max_s, max_shots = min(spec["max"], spec["ref_total"]), spec["shots"]
+ max_s, max_shots = min(spec["max"], spec["ref_total"]), (spec["shots"] if spec["multi_shot"] else 1)
elif strategy == "keyframes":
# a swapped-in subject with no image is held only by its description: every extra call is another chance for it
- # to come out different, so keep calls whole and let some shots go without a source frame
+ # to come out different, so keep calls whole and let some shots go without a source frame; otherwise apply S06 hardcut guard
text_only = any(not s.get("image") for s in intent.get("swaps") or [])
- max_s, max_shots = spec["max"], (spec["shots"] if text_only else min(x for x in (spec["shots"], planned_images(spec) - len(own)) if x))
+ max_s = spec["max"] if text_only else min(spec["max"], cap_hardcut)
+ max_shots = spec["shots"] if text_only else min(x for x in (spec["shots"], planned_images(spec) - len(own)) if x)
elif strategy == "text" and spec["multi_shot"]:
- max_s, max_shots = spec["max"], spec["shots"]
+ max_s, max_shots = min(spec["max"], cap_hardcut), spec["shots"]
else:
max_s, max_shots = spec["max"], 1
units: list[dict] = []
new_part = part_starts(b)
- for run in runs(b["shots"], labels, skip, joinable_inserts=strategy in ("remix", "keyframes", "text")):
+ for run in runs(b["shots"], labels, skip, joinable_inserts=strategy in ("remix", "keyframes", "text") and max_shots != 1):
for seg in pack(run, max_s, max_shots, new_scene, new_part):
- units.append(build_unit(seg, len(units) + 1, strategy, spec, own, swaps, style, model, (notes or {}).get("draft")))
+ units.append(build_unit(seg, len(units) + 1, strategy, spec, own, swaps, style, model, (notes or {}).get("draft"), b=b))
return {"strategy": strategy, "spec": spec, "labels": list(labels), "units": units, "own_refs": own,
"rules": {"max_s": max_s, "max_shots": max_shots, "generate": intent.get("generate", "ai")}}
# ---------------------------------------------------------------- checks
-TAG_RES = (r"@图片(\d+)", r"<Picture (\d+)>", r"(?<![@<])图片(\d+)", r"\[Image (\d+)\]", r"\bImage (\d+)\b")
-VIDEO_TAG_RES = (r"@视频(\d+)", r"<Video (\d+)>", r"\bVideo (\d+)\b")
+TAG_RES = (r"@图片(\d+)", r"@Image(\d+)", r"@Element(\d+)", r"@Subject(\d+)", r"<Picture (\d+)>",
+ r"(?<![@<])图片(\d+)", r"(?<![@<])图(\d+)", r"\[Image (\d+)\]", r"\b[Ii]mage (\d+)\b")
+ZERO_TAG_RE = r"<IMAGE_(\d+)>"
+VIDEO_TAG_RES = (r"@视频(\d+)", r"@Video(\d+)", r"<Video (\d+)>", r"(?<![@<])视频(\d+)", r"\b[Vv]ideo (\d+)\b")
def lint_prompt(text: str, n_images: int, n_videos: int, notes: dict | None) -> list[str]:
@@ -464,7 +636,7 @@ def lint(text: str, n_images: int, n_videos: int, notes: dict | None) -> list[tu
`when: refs` (only when reference images or videos are sent) and `level: warn` (a risk, not a format error)."""
rules = (notes or {}).get("lint") or {}
errs: list = []
- imgs = [int(x) for p in TAG_RES for x in re.findall(p, text)]
+ imgs = [int(x) for p in TAG_RES for x in re.findall(p, text)] + [int(x) + 1 for x in re.findall(ZERO_TAG_RE, text)]
vids = [int(x) for p in VIDEO_TAG_RES for x in re.findall(p, text)]
if imgs and max(imgs) > n_images:
errs.append(T("提到了第 {k} 张图,但只传 {n} 张", "refers to image {k} but only {n} are sent", k=max(imgs), n=n_images))
@@ -494,12 +666,15 @@ def lint(text: str, n_images: int, n_videos: int, notes: dict | None) -> list[tu
return [("error", e) for e in errs] + [("warn", w) for w in warns]
-SHOT_RES = (r"\[Shot (\d+)\]", r"镜头\s*(\d+)", r"\bShot (\d+)\b")
+SHOT_RES = (r"\[Shot (\d+)\]", r"镜头\s*(\d+)", r"第\s*(\d+)\s*个镜头", r"\bShot (\d+)\b")
+WORD_SHOT_RE = re.compile(r"\bSHOT\s+(" + "|".join(_WORD_NUMS) + r")\b")
def shots_written(text: str) -> int:
"""How many shots a prompt numbers (0 when it does not number them)."""
- return max([int(x) for p in SHOT_RES for x in re.findall(p, text)] or [0])
+ nums = [int(x) for p in SHOT_RES for x in re.findall(p, text)]
+ nums += [_WORD_NUMS.index(w) + 1 for w in WORD_SHOT_RE.findall(text)]
+ return max(nums or [0])
def redrawn_frame(out: Path, name: str) -> Path | None:
@@ -571,6 +746,14 @@ def checks(plan: dict, intent: dict, prompts: dict[str, str], notes: dict | None
add("warn", T("{u} 的参考帧还是原片里被替换的主体,模型会在镜头中途变来变去:先照换入的主体重画,存成 remake/redrawn/{f}.png",
"{u}'s reference frames still show the subject being swapped, so the model may morph it mid-shot: redraw them with the new subject as remake/redrawn/{f}.png",
u=u["id"], f="|".join(stale_frames)), u["id"])
+ if spec.get("no_real_faces"):
+ face_shots = [x["shot"] for x in u.get("brief") or [] if x.get("real_face")]
+ has_unredrawn_ref = n_vid > 0 or any(not (root and redrawn_frame(root, x)) for x in source_frame_names(u))
+ if face_shots and has_unredrawn_ref:
+ m_name = u.get("model_name") or u.get("model") or "?"
+ add("warn", T("{u}:{m} 不收带真人脸的参考图或参考视频(镜头 {s} 含实拍/真人画面),请先把参考帧重画成虚拟/授权形象存入 remake/redrawn/,或换其他模型",
+ "{u}: {m} rejects reference images or videos with real human faces (shots {s} show filmed / real people); redraw frames into remake/redrawn/ or pick another model",
+ u=u["id"], m=m_name, s=shot_ids(face_shots)), u["id"])
final = prompts.get(u["id"])
if not final:
m = u.get("model_name") or u.get("model") or "?"
@@ -578,9 +761,13 @@ def checks(plan: dict, intent: dict, prompts: dict[str, str], notes: dict | None
"{u} still has the tool's draft (already in {m}'s layout): check it against the model's notes and put the final into remake/prompts.json", u=u["id"], m=m)
if u.get("draft_format") else
T("{u} 还是通用草稿:按 {m} 的写法写好最终提示词,放进 remake/prompts.json", "{u} still has the generic draft: write the final prompt in {m}'s format into remake/prompts.json", u=u["id"], m=m), u["id"])
- for lv, e in lint(final or u.get("draft") or "", n_img, n_vid, notes):
+ draft_or_final = final or u.get("draft") or ""
+ for lv, e in lint(draft_or_final, n_img, n_vid, notes):
if final or lv == "warn": # a draft is the tool's own wording: only its risks are worth a line
add(lv, f"{u['id']}: {e}", u["id"])
+ elif not final and ((notes or {}).get("lint") or {}).get("language") == "en" and ("英文" in e or "English" in e):
+ add("warn", T("{u} 的草稿里还带有中文(如替换主体或镜头描述),这个模型要求英文提示词:请翻译后写入 remake/prompts.json,或运行 rea-video plan --rewrite-prompts",
+ "{u}'s draft still contains non-English text, while this model expects English prompts: translate it into remake/prompts.json or run rea-video plan --rewrite-prompts", u=u["id"]), u["id"])
if final:
n = shots_written(final)
if n and len(u["shots"]) > 1 and n != len(u["shots"]): # written for another split of the shots
@@ -598,6 +785,115 @@ def checks(plan: dict, intent: dict, prompts: dict[str, str], notes: dict | None
DEFAULT_MODEL = "minimax-h3" # used until the user names a model or sets a usual one (prefs engine)
+REWRITE_TEMPLATE = """You are an expert video-generation prompt engineer.
+Rewrite each generation unit's draft prompt into an idiomatic, production-ready final prompt strictly tailored to the target video model: {model_name} ({model_id}).
+
+Target strategy: {strategy}
+{strategy_rule}
+
+Target model prompt-writing specification:
+{guide}
+
+Hard validation rules your output MUST satisfy:
+- Output ONLY a valid JSON object: {{"prompts": {{"G1": "...", ...}}}} with one string per unit id.
+- Keep the exact number of shots in each multi-shot unit (if a unit has N shots and the model numbers shots, number 1..N; if the model forbids shot numbering like LTX-2.5, write one continuous paragraph with explicit cut transitions).
+- Address uploaded images and videos ONLY up to the exact count sent in each unit, using this model's exact reference syntax.
+- If the model requires English prompts, translate all scene, subject, swap and action descriptions into natural English, while keeping spoken dialogue or on-screen text in its original language.
+- Respect the model's negative-prompt rule: if the model forbids negative words (no / not / without / 不要), rewrite constraints positively.
+- Never describe emotions with abstract labels ("happy", "sad"); keep concrete visible facial expressions, body actions, camera movements and end states.
+
+Generation units to rewrite:
+{units_json}
+"""
+
+
+def _unit_rewrite_spec(u: dict, fmt: dict) -> dict:
+ raw = fmt or {}
+ img_tpl = raw.get("image_tag")
+ vid_tpl = raw.get("video_tag")
+ if isinstance(img_tpl, dict):
+ img_tpl = img_tpl.get(raw.get("lang") or lang()) or next(iter(img_tpl.values()), None)
+ if isinstance(vid_tpl, dict):
+ vid_tpl = vid_tpl.get(raw.get("lang") or lang()) or next(iter(vid_tpl.values()), None)
+
+ def _tag(tag: str) -> str:
+ m = REF_TAG.fullmatch(tag)
+ if not m:
+ return tag
+ tpl = img_tpl if m.group(1) == "图片" else vid_tpl
+ return tpl.format(n=m.group(2), n0=max(0, int(m.group(2)) - 1)) if tpl else tag
+
+ imgs = [{"index": i, "tag": _tag(r["tag"]), "what": r["what"]} for i, r in enumerate(unit_images(u), 1)]
+ vids = [{"index": i, "tag": _tag(r["tag"]), "what": r["what"]}
+ for i, r in enumerate([x for x in u.get("refs") or [] if x["tag"].startswith("@视频") and x.get("part", 1) == 1], 1)]
+ return {"id": u["id"], "shots_count": len(u["shots"]), "duration_s": u["duration"], "strategy": u["strategy"],
+ "uploaded_images": imgs, "uploaded_videos": vids, "shots": u["brief"], "draft": u["draft"]}
+
+
+def rewrite_prompts(plan: dict, out: Path, client=None) -> dict[str, str]:
+ """Use a configured LLM/VLM client to rewrite every generation unit's prompt into the target model's native style,
+ validate against `lint` + shot counts (retrying once with error feedback if needed), and save `remake/prompts.json`."""
+ units = plan.get("units") or []
+ if not units:
+ return {}
+ if client is None:
+ from .vlm import make_client
+
+ client = make_client(Path(out) / "vlm_cache")
+ if client is None:
+ raise RuntimeError("no LLM/VLM configured (set GEMINI_API_KEY or REA_VLM_BASE_URL / REA_VLM_API_KEY / REA_VLM_MODEL)")
+ notes = plan.get("prompting") or {}
+ fmt = notes.get("draft") or {}
+ st = plan.get("strategy") or "frames"
+ st_rule = {
+ "frames": "IMPORTANT (First/Last-Frame I2V mode): The input image ALREADY fixes subject appearance, clothing, background, lighting and framing. Write ONLY the motion progression, end state and camera movement; delete static scene/appearance descriptions.",
+ "remix": "IMPORTANT (Reference-video Remix mode): The reference video carries shot cuts, camera movement and pacing. Assign roles to uploaded assets clearly and describe what happens in each shot with the swapped subjects/props.",
+ "keyframes": "IMPORTANT (Multi-shot Keyframe Reference mode): Each framed shot gets a source composition image; swapped subjects have their own reference images. State each image's role clearly and write shots in order.",
+ "text": "Text-to-video mode: Describe subject, action progression, end state, environment, camera movement and lighting clearly.",
+ }.get(st, "")
+ guide_keys = ("structure", "language", "length", "multi_shot", "references", "dialogue", "negatives", "camera", "frame_mode", "pitfalls", "lint")
+ guide = yaml.safe_dump({k: notes[k] for k in guide_keys if notes.get(k)}, allow_unicode=True, sort_keys=False).strip() or "Follow standard concise video prompting."
+ u_specs = [_unit_rewrite_spec(u, fmt) for u in units]
+ base_prompt = REWRITE_TEMPLATE.format(
+ model_name=plan.get("model_name") or plan.get("model") or "video model",
+ model_id=plan.get("model") or "unknown",
+ strategy=st, strategy_rule=st_rule, guide=guide,
+ units_json=json.dumps(u_specs, ensure_ascii=False, indent=2),
+ )
+ got = dict(load_prompts(out))
+ pending = list(units)
+ feedback = ""
+ for _attempt in range(2):
+ if not pending:
+ break
+ ask = base_prompt if not feedback else (base_prompt + "\n\nFix these validation errors from your previous attempt:\n" + feedback)
+ ans = client.ask_json(ask, media=[], max_tokens=4096)
+ raw_map = ans.get("prompts") if isinstance(ans.get("prompts"), dict) else ans
+ bad_lines = []
+ still_pending = []
+ for u in pending:
+ uid = u["id"]
+ cand = str((raw_map or {}).get(uid) or "").strip()
+ if not cand:
+ still_pending.append(u)
+ bad_lines.append(f"- {uid}: missing from JSON output")
+ continue
+ n_img = len(unit_images(u))
+ n_vid = len({r["tag"] for r in u["refs"] if r["tag"].startswith("@视频") and r.get("part", 1) == 1})
+ errs = lint_prompt(cand, n_img, n_vid, notes)
+ n_sh = shots_written(cand)
+ if n_sh and len(u["shots"]) > 1 and n_sh != len(u["shots"]):
+ errs.append(f"numbers {n_sh} shots, but unit {uid} has {len(u['shots'])} shots")
+ got[uid] = cand
+ if errs:
+ still_pending.append(u)
+ bad_lines.append(f"- {uid}: " + "; ".join(errs))
+ pending = still_pending
+ feedback = "\n".join(bad_lines)
+ save_prompts(out, got)
+ return got
+
+
def check_lines(cs: list[dict]) -> list[str]:
icon = {"error": "❌", "warn": "⚠️"}
return [f"- {icon.get(c['level'], '-')} {c['msg']}" for c in cs]
diff --git a/rea_video/integrations/capsule_cinema.py b/rea_video/integrations/capsule_cinema.py
index 2281cc0..765d8de 100644
--- a/rea_video/integrations/capsule_cinema.py
+++ b/rea_video/integrations/capsule_cinema.py
@@ -290,8 +290,10 @@ def write_handoff(b: dict, bdir: Path, jobs: list[dict]) -> Path:
for sh in b["shots"]]
code = bdir / "code" / "remake.mp4"
out = rdir / "handoff.json"
+ api_opts = (plan.get("spec") or {}).get("api_params") or {}
write_json(out, {"schema": HANDOFF_SCHEMA, "width": w, "height": h, "fps": src["fps"], "duration": duration,
- "has_audio": bool(src.get("has_audio")), "shots": shots,
+ "has_audio": bool(src.get("has_audio")), "engine": plan.get("model"),
+ **({"model_options": api_opts} if api_opts else {}), "shots": shots,
"overlays": {"ass": ass, "stickers": stickers}, "code_video": "code/remake.mp4" if code.is_file() else None})
return out
@@ -299,6 +301,21 @@ def write_handoff(b: dict, bdir: Path, jobs: list[dict]) -> Path:
GEN_TYPE = {"remix": "multimodal", "keyframes": "multimodal", "frames": "first_last_frame", "text": "text_to_video"}
+def _unit_model_options(u: dict, spec: dict, eng: str | None, vids: list[str], images: list[dict]) -> dict:
+ """Model-specific API switches from the capability map, plus structured multi-shot / audio flags where needed."""
+ opts = dict(spec.get("api_params") or {})
+ if opts.get("omni_reference_task_type") == "reference" and not (vids or images):
+ opts.pop("omni_reference_task_type", None) # only meaningful when reference media are sent
+ if spec.get("no_audio_with_ref_video") and vids:
+ opts["enable_audio"] = False
+ if eng == "kling-3.0" and len(u.get("brief") or []) > 1:
+ opts["shot_type"] = "customize"
+ opts["multi_prompt"] = [{"index": idx, "prompt": str(x.get("action") or x.get("source") or "")[:512],
+ "duration": max(1, int(round(x["duration"])))}
+ for idx, x in enumerate(u["brief"], 1)]
+ return opts
+
+
def _unit_jobs(b: dict, bdir: Path, run_dir: Path, plan: dict, prompts: dict[str, str]) -> list[dict]:
"""One job per call of each unit, fed as the plan says: the source stretch as reference video (remix), one source
frame per shot (keyframes), the shot's first / last frame (frames) or nothing but text; the user's images first; the
@@ -339,9 +356,11 @@ def _unit_jobs(b: dict, bdir: Path, run_dir: Path, plan: dict, prompts: dict[str
words = list(dict.fromkeys(w for t in times for w in scene_text(b, t)))
warning = T("参考帧里还有画面内文字({w}),模型可能照着生成:换成干净图,或确认有授权", "the reference frames still show text in the picture ({w}), which the model may copy: use a clean image or confirm you have the rights",
w=join(words[:6])) if words else None
+ m_opts = _unit_model_options(u, spec, eng, vids, images)
jobs.append({"shot": u["shots"][0], "id": jid, "unit": u["id"], "part": part, "parts": len(parts), "shots": u["shots"],
"executor": "capsule_cinema", "label": u["label"], "strategy": u["strategy"], "images": images,
- "params": params, "trim_to": round(secs, 3), "prompt_source": "final" if u["id"] in prompts else "draft",
+ "params": params, **({"model_options": m_opts} if m_opts else {}),
+ "trim_to": round(secs, 3), "prompt_source": "final" if u["id"] in prompts else "draft",
**({"warning": warning} if warning else {})})
return jobs
diff --git a/rea_video/integrations/run_remake.py b/rea_video/integrations/run_remake.py
index 958f252..66b3f94 100644
--- a/rea_video/integrations/run_remake.py
+++ b/rea_video/integrations/run_remake.py
@@ -101,8 +101,25 @@ def main() -> None:
print(f"{label}: {j['params']['generation_type']} via {j['params']['engine']} ...", flush=True)
try:
if j.get("unit"): # a unit's references go straight to the engine's own tool
+ import inspect
+
+ eng_tool = vgt._tool_for_engine(vgt.normalize_video_engine(j["params"]["engine"]))
p = {k: v for k, v in j["params"].items() if k != "engine"}
- res = vgt._tool_for_engine(vgt.normalize_video_engine(j["params"]["engine"]))._run(**p)
+ m_opts = j.get("model_options") or {}
+ if m_opts:
+ sig = inspect.signature(eng_tool._run)
+ accepts_var_kw = any(param.kind == inspect.Parameter.VAR_KEYWORD for param in sig.parameters.values())
+ if accepts_var_kw:
+ p.update(m_opts)
+ else:
+ for k, v in m_opts.items():
+ if k in sig.parameters:
+ p[k] = v
+ if "extra" in sig.parameters and isinstance(p.get("extra"), (dict, type(None))):
+ rest = {k: v for k, v in m_opts.items() if k not in sig.parameters}
+ if rest:
+ p["extra"] = {**(p.get("extra") or {}), **rest}
+ res = eng_tool._run(**p)
else:
res = tool._run(**j["params"])
except Exception as exc: # keep going, record the failure
diff --git a/rea_video/plan.py b/rea_video/plan.py
index d232ac5..da41386 100644
--- a/rea_video/plan.py
+++ b/rea_video/plan.py
@@ -80,14 +80,71 @@ def engine_range(engine: str | None, models: dict | None = None) -> tuple[int, i
return 4, 15
+PROMPT_KEYS = ("image_prompt", "video_prompt", "video_prompt_en", "motion_prompt", "motion_prompt_en")
+
+
def shot_prompts(shot: dict) -> dict:
"""Reverse-engineered prompts for one shot: the agent's review wins over the VLM (it is the later, checked pass)."""
out = {}
for src in ((shot.get("vlm") or {}).get("replication") or {}, (shot.get("review") or {}).get("replication") or {}):
- out.update({k: v for k, v in src.items() if k in ("image_prompt", "video_prompt", "video_prompt_en") and v})
+ out.update({k: v for k, v in src.items() if k in PROMPT_KEYS and v})
return out
+HAILUO_MOVES = {
+ "推": "[Push in]", "push-in": "[Push in]",
+ "拉": "[Pull out]", "pull-out": "[Pull out]",
+ "摇": "[Pan right]", "pan": "[Pan right]",
+ "移": "[Truck right]", "track": "[Tracking shot]",
+ "摇/移": "[Pan right,Truck right]", "拉/摇/移": "[Pull out,Pan right]",
+ "跟": "[Tracking shot]", "tracking": "[Tracking shot]",
+ "环绕": "[Pan right,Truck left]", "orbit": "[Pan right,Truck left]",
+ "手持": "[Shake]", "handheld": "[Shake]",
+}
+
+
+def hailuo_bracket(shot: dict) -> str:
+ """Hailuo 2.3's fixed bracket camera command for a shot, from its measured or seen camera movement."""
+ from .aspects.vocab import canon
+
+ cm = ((shot.get("aspects") or {}).get("camera") or {}).get("measured") or {}
+ v = shot.get("review") or shot.get("vlm") or {}
+ move = cm.get("move") or v.get("camera_move")
+ c = canon(move) if move else None
+ if c and c in HAILUO_MOVES:
+ return HAILUO_MOVES[c]
+ if move and str(move).lower() in HAILUO_MOVES:
+ return HAILUO_MOVES[str(move).lower()]
+ feat = (shot.get("features") or {}).get("camera")
+ if feat == "handheld_like":
+ return "[Shake]"
+ if feat == "smooth_move":
+ return "[Tracking shot]"
+ if feat == "planar_zoom_pan":
+ z = (shot.get("features") or {}).get("zoom_per_s", 0.0)
+ return "[Push in]" if z > 0.01 else "[Pull out]" if z < -0.01 else "[Pan right]"
+ return "[Static shot]"
+
+
+def camera_move_words(shot: dict) -> tuple[str, str]:
+ """Only the camera move (report language, English), for first-frame mode where static framing is already in the image."""
+ from .aspects.vocab import ZH2EN, canon, show
+
+ cm = ((shot.get("aspects") or {}).get("camera") or {}).get("measured") or {}
+ v = shot.get("review") or shot.get("vlm") or {}
+ move = cm.get("move") or (v.get("camera_move") if v.get("camera_move") not in (None, "", "固定", "static") else None)
+ if not move:
+ feat = (shot.get("features") or {}).get("camera")
+ if feat == "handheld_like":
+ return T("手持镜头", "handheld camera"), "handheld camera"
+ if feat == "smooth_move":
+ return T("镜头平滑移动", "smooth camera movement"), "smooth camera movement"
+ return T("固定镜头", "static camera"), "static camera"
+ c = canon(move)
+ en_m = ZH2EN.get(c) or (move if move.isascii() else "moves")
+ return T("镜头{m}", "camera {m}", m=show(move)), f"camera {en_m}"
+
+
def _where(cx: float | None, cy: float | None) -> tuple[str, str] | None:
"""Where the measured subject sits in the frame, (zh, en)."""
if cx is None or cy is None:
diff --git a/rea_video/playbook.py b/rea_video/playbook.py
index 5c047aa..f76b429 100644
--- a/rea_video/playbook.py
+++ b/rea_video/playbook.py
@@ -271,7 +271,11 @@ def _generate(b: dict) -> list[str]:
secs = sum(float(u.get("duration") or 0) for u in units)
chained = any(any(i.get("kind") == "first_frame" and i.get("need") == "yes" and "shot_" not in (i.get("source") or "") for i in u.get("inputs") or [])
for u in units)
- native = ((b.get("sound_sources") or {}).get("voice") or {}).get("source") == "ai_video_native"
+ from .generation import effective_native_audio
+
+ spec = plan.get("spec") or {}
+ can_native = effective_native_audio(spec, plan.get("strategy") or "") if spec else True
+ native = ((b.get("sound_sources") or {}).get("voice") or {}).get("source") == "ai_video_native" and can_native
calls = plan.get("calls") or len(units)
if plan.get("strategy") == "remix":
L.append(T("**AI 生成**:{c} 次生成(共 {s:.0f} 秒)。每次把原片对应的一段当参考视频喂给模型,模型照它的分镜和节奏出完这段的镜头,"
@@ -297,6 +301,10 @@ def _generate(b: dict) -> list[str]:
L.append(T("**提示词**:已按 {m} 的写法写好,在「AI 生成」每段里", "**Prompts**: written in {m}'s format, in each part under “AI generation”", m=m)
+ (T(",有 {n} 处要改", ", {n} to fix", n=len(errs)) if errs else ""))
return L
+ if all(u.get("draft_format") for u in units):
+ L.append(T("**按模型改提示词**:每段的草稿已按 {m} 的分镜、素材标签和声音字段排好;生成前对照它的提示词指南细化(或运行 `rea-video plan <拆解目录> --rewrite-prompts` 自动重写进 `remake/prompts.json`)",
+ "**Adapt the prompts to your model**: each unit's draft is already laid out in {m}'s shot, tag and audio format; refine it against the model's prompt guide before generating (or run `rea-video plan <folder> --rewrite-prompts`)", m=m))
+ return L
L.append(T("**按模型改提示词**:报告里的提示词是通用写法,不同模型的写法不一样(分镜头怎么写、参考图怎么指代、台词怎么写都不同)。"
"生成前按你实际用的模型的官方提示词指南改一遍,或者让 agent 用这个模型的提示词 skill 优化",
"**Adapt the prompts to your model**: the prompts in this report are generic, and every model reads them differently (how shots are "
@@ -373,7 +381,12 @@ def _footage(b: dict) -> str | None:
def _voice(b: dict) -> str | None:
if not ((b.get("audio") or {}).get("voice") or {}).get("present"):
return None
- if ((b.get("sound_sources") or {}).get("voice") or {}).get("source") == "ai_video_native" and _units(b):
+ from .generation import effective_native_audio
+
+ plan = b.get("production_plan") or {}
+ spec = plan.get("spec") or {}
+ can_native = effective_native_audio(spec, plan.get("strategy") or "") if spec else True
+ if ((b.get("sound_sources") or {}).get("voice") or {}).get("source") == "ai_video_native" and _units(b) and can_native:
return None # generated with the picture: the generate step says so
src = _src(b, "voice")
k = len(entities.script(b))
diff --git a/rea_video/production.py b/rea_video/production.py
index 3d9906c..c695705 100644
--- a/rea_video/production.py
+++ b/rea_video/production.py
@@ -380,8 +380,9 @@ def production_plan(b: dict, out: Path, engine: str = "minimax-h3") -> dict:
from . import dance
motion = dance.motion_indices(b) # the moves are the point: driven from the source motion, not generated from frames
+ hardcut_max = float((seg.get("multishot_hardcut_s") or {}).get("max", 10.0))
g = gen_mod.plan_generation(b, model, intent, new_scene, style, set(reused) | motion,
- notes=planner.prompting.get((model or {}).get("id")))
+ notes=planner.prompting.get((model or {}).get("id")), hardcut_max_s=hardcut_max)
units = g["units"]
for again, src in sorted(reused.items()):
u = next((u for u in units if src in u["shots"]), None)
@@ -403,9 +404,14 @@ def production_plan(b: dict, out: Path, engine: str = "minimax-h3") -> dict:
plan["prompting"] = planner.prompting[model["id"]]
voice = ((b.get("audio") or {}).get("voice") or {}).get("present")
vsrc = ((b.get("sound_sources") or {}).get("voice") or {}).get("source")
- if lim["native_audio"]:
+ if lim.get("no_audio_with_ref_video") and g["strategy"] == "remix":
+ plan["audio_note"] = T("当前模型在传参考视频时不能同时开启原生音频:人声、音效和配乐全部单独准备后在后期混入(若需音画同出对白,可改选支持参考视频出声的模型或改走关键帧模式)",
+ "sending a reference video disables native audio on this model: prepare voice, sound effects and music separately and mix them in post")
+ elif lim["native_audio"]:
plan["audio_note"] = T("模型可以同时生成动作音效和环境声", "the model can generate action sound effects and ambience along with the picture") + \
- (semi() + (T("口播建议单独 TTS 再混进去,方便改文案和卡时间", "voice-over is better done as separate TTS and mixed in, so copy and timing stay editable")
+ (semi() + (T("原片对白是随画面生成的:台词已按该模型格式放进提示词草稿", "the original dialogue was generated with the picture: spoken lines are formatted into the prompt drafts")
+ if vsrc == "ai_video_native" else
+ T("口播建议单独 TTS 再混进去,方便改文案和卡时间", "voice-over is better done as separate TTS and mixed in, so copy and timing stay editable")
if vsrc == "tts" else
T("口播是真人录的:单独录好再混进去,不让视频模型生成,方便改文案和卡时间",
"the voice was recorded by a person: record it separately and mix it in rather than having the video model speak, so copy and timing stay editable"))
@@ -601,6 +607,9 @@ def report_md(plan: dict) -> list[str]:
L += ["", T("### 生成单元", "### Generation units"), ""] + gen_report(plan, plan.get("prompts") or {})
if plan.get("prompting") and lang() == "zh":
L += ["", "<details><summary>" + f"{plan['model_name']} 的提示词写法" + "</summary>", ""] + prompting_md(plan["prompting"]) + ["", "</details>"]
+ elif plan.get("prompting") and (plan["prompting"].get("sources") or []):
+ srcs = [f"- {u}" for u in plan["prompting"]["sources"]]
+ L += ["", f"<details><summary>Prompt guides for {plan['model_name']}</summary>", ""] + srcs + ["", "</details>"]
if plan.get("drive"):
from .dance import report_md as _drive_md
diff --git a/rea_video/review.py b/rea_video/review.py
index 489904c..549a2dc 100644
--- a/rea_video/review.py
+++ b/rea_video/review.py
@@ -54,7 +54,8 @@ kind 取 {"|".join(ASSET_KINDS)},is_real_material 为 true/false)。
同一段成片在片中出现不止一次(开头先放一段成片当预告、结尾完整放;或中途回放),在较短的那一处填 same_clip_as:另一处的镜头号(整数),复刻时只生成一次;不是就不要填。
实拍或定格镜头被 AI 二次加工过时填 ai_edits:[{{"kind": "{"|".join(EDIT_KINDS)}", "evidence": "看到的破绽"}}](换脸、对口型、风格化、换装、换背景、加删物体、美颜);没有就留空。
AI 生成 / 3D / 实拍镜头再填 replication:image_prompt(复刻首帧的<PROMPT_LANG>图像提示词:景别、机位高度和俯仰角、主体在画面里的位置和朝向、主体、光线、风格,有人物时写首帧的表情,具体可执行)、
-video_prompt(复刻该镜头的<PROMPT_LANG>视频提示词:先写景别、机位角度、主体在画面里的位置,再写动作过程和结束状态、运镜;人物表演写看得见的表情和动作,不写情绪词,幅度宁小勿大;只写想要的内容,不写否定句)、video_prompt_en(英文版)。
+video_prompt(复刻该镜头的<PROMPT_LANG>视频提示词:先写景别、机位角度、主体在画面里的位置,再写动作过程和结束状态、运镜;人物表演写看得见的表情和动作,不写情绪词,幅度宁小勿大;只写想要的内容,不写否定句)、video_prompt_en(英文版)、
+motion_prompt(首帧/首尾帧模式下的纯动态提示词:只写动作过程、结束状态和运镜,不重复描述首帧图里已有的外貌、场景和光线)、motion_prompt_en(英文纯动态版)。
这些提示词会被合并进「生成单元」的多镜头提示词,所以每镜只写这一镜的内容,统一的风格和场景描述写在 description 里即可。
实拍/写实镜头再填 aspects(怎么拍、怎么打光;纯图形/界面画面不填),像素测不出的部分靠你看:
@@ -213,7 +214,7 @@ def build_tasks(breakdown: dict, out_dir: str) -> tuple[dict, dict]:
"evidence": [], "description": "", "narrative": {"role": "", "point": ""}, "embedded_assets": [],
"ai_edits": list(((rec_by_id.get(s["id"], {}).get("vlm") or {}).get("ai_edits")) or []),
"same_clip_as": None,
- "replication": {"image_prompt": "", "video_prompt": "", "video_prompt_en": ""},
+ "replication": {"image_prompt": "", "video_prompt": "", "video_prompt_en": "", "motion_prompt": "", "motion_prompt_en": ""},
**({"aspects": aspects.review_template()} if shoot[s["id"]] else {}),
**({"performance": dict(PERF_TEMPLATE)} if acting[s["id"]] else {})} for s in shots],
"aspects": aspects.review_template(video=True),
@@ -263,7 +264,7 @@ def _clean(ans: dict) -> tuple[dict | None, str | None]:
soft = {k: AGENT_WEIGHT * v / total + (1 - AGENT_WEIGHT) * u for k, v in vals.items()}
src = ans.get("image_source") if ans.get("image_source") in IMAGE_SOURCES else "unknown"
rep_in = ans.get("replication") if isinstance(ans.get("replication"), dict) else {}
- rep = {k: str(rep_in.get(k) or "").strip() for k in ("image_prompt", "video_prompt", "video_prompt_en") if str(rep_in.get(k) or "").strip()}
+ rep = {k: str(rep_in.get(k) or "").strip() for k in ("image_prompt", "video_prompt", "video_prompt_en", "motion_prompt", "motion_prompt_en") if str(rep_in.get(k) or "").strip()}
assets = []
for e in ans.get("embedded_assets") or []:
if isinstance(e, dict) and e.get("kind") in ASSET_KINDS:
diff --git a/rea_video/vlm.py b/rea_video/vlm.py
index 25e4b43..2a12ac8 100644
--- a/rea_video/vlm.py
+++ b/rea_video/vlm.py
@@ -361,7 +361,9 @@ AI 仿定格风格(材质在帧间漂移)与真正的定格动画(同一
"replication": {{
"image_prompt": "复刻首帧的中文图像提示词(主体、构图、光线、风格,具体可执行;有人物时写首帧的表情)",
"video_prompt": "复刻该镜头的中文视频提示词:写清动作过程和结束状态、运镜;人物表演写看得见的表情和动作(眼、眉、嘴、头、手),不写「开心」「难过」这类情绪词,幅度宁小勿大;只写想要的内容,不写否定句",
- "video_prompt_en": "same video prompt in English"
+ "video_prompt_en": "same video prompt in English",
+ "motion_prompt": "图生视频(首帧/首尾帧模式)的纯动态提示词:只写主体接下来的运动过程、结束状态和运镜,删掉首帧图里已有的外貌、服装、场景和光线描述",
+ "motion_prompt_en": "same motion-only prompt in English (actions, end state and camera movement only, without repeating static look/scene)"
}}
}}"""
@@ -375,7 +377,7 @@ TAKE_NOTE = """
这段片子是同一机位、同一条素材剪成的 {n} 段(跳剪),后面几段从片段开头后 {cuts} 秒开始。
制作方式、拍法和素材(label_probs、aspects、embedded_assets 等)对整段给一次即可;
另外加一个 segments 数组,按顺序给每一段的内容,共 {n} 项:
-"segments": [{{"description": "这一段的主体、动作和结束状态", "replication": {{"video_prompt": "复刻这一段的中文视频提示词", "video_prompt_en": "same in English"}}}}]
+"segments": [{{"description": "这一段的主体、动作和结束状态", "replication": {{"video_prompt": "复刻这一段的中文视频提示词", "video_prompt_en": "same in English", "motion_prompt": "首帧模式纯动态中文提示词", "motion_prompt_en": "motion-only in English"}}}}]
"""
diff --git a/scripts/validate_capabilities.py b/scripts/validate_capabilities.py
index a95797d..5c1735a 100644
--- a/scripts/validate_capabilities.py
+++ b/scripts/validate_capabilities.py
@@ -159,12 +159,19 @@ def main() -> int:
errors.append(f"prompting.yaml:{mid}: lint 格式不对")
continue
if k == "draft": # the layout of the tool's prompt draft for this model (rea_video/generation.py _draft)
- keys = {"lang", "head", "shot", "first_shot", "image_tag", "video_tag", "negatives_line", "tail"}
+ keys = {"lang", "head", "shot", "first_shot", "remix_shot", "join", "image_tag", "video_tag",
+ "negatives_line", "camera_brackets", "dialogue_fmt", "sfx_fmt", "tail"}
ok = isinstance(x, dict) and set(x) <= keys and x.get("lang") in (None, "zh", "en")
- for f in ("shot", "first_shot"):
+ for f in ("shot", "first_shot", "remix_shot"):
for v in ((x or {}).get(f).values() if isinstance((x or {}).get(f), dict) else [(x or {}).get(f)]):
try:
- v and v.format(i=1, text="", a="", z="", at="", s0=0, s1=1, d=1)
+ v and v.format(i=1, I_WORD="ONE", text="", a="", z="", at="", s0=0, s1=1, d=1)
+ except (KeyError, IndexError, ValueError):
+ ok = False
+ for f in ("dialogue_fmt", "sfx_fmt"):
+ for v in ((x or {}).get(f).values() if isinstance((x or {}).get(f), dict) else [(x or {}).get(f)]):
+ try:
+ v and v.format(speaker="S1", lang="English", text="", emotion="")
except (KeyError, IndexError, ValueError):
ok = False
if not ok:
diff --git a/skills/rea-video/SKILL.md b/skills/rea-video/SKILL.md
index 2c1f92b..c2c95d6 100644
--- a/skills/rea-video/SKILL.md
+++ b/skills/rea-video/SKILL.md
@@ -121,7 +121,7 @@ rea-video summary out/ref/breakdown.json # 用并入后的结果写回复
```
2. 方案按这个模型的最新实际情况来:`rea-video models <id>` 看能力地图里的资料和核实日期,再上网核对它最新的官方文档和更新(有没有新版本,单次时长、参考视频 / 参考图的数量和时长、一次多镜头、首尾帧、原生音频、提示词写法有没有变)。能力地图里没有、或和最新资料不一致的,按能力地图的格式写进 `~/.rea-video/capabilities/models/<id>.yaml`(同 id 会覆盖自带的),写上来源和核实日期。
3. `rea-video plan out/ref`:按意图和模型出报告第二部分,并做方案检查。工具按模型能吃什么选输入方式(参考原片视频 / 每镜一张原片关键帧 / 首尾帧 / 纯文字),在单次时长和参考数量以内用最少的调用装下所有镜头,原片参考擦掉字幕后放在 `remake/refs/`。
-4. 写之前上网搜这个模型的提示词写法和同类镜头的优质提示词:先看口碑好的创作者的实测(X、YouTube、B站、小红书等),再看官方文档和示例;平台的教程页(CapCut、fal 这类)只当二手资料。参考结构和写法,不照抄内容;和能力地图不一致的按第 2 步记下来。报告里的草稿大多已按这个模型的格式排好,再按它的写法(`rea-video models <id>`,或这个模型的提示词 skill)核对改好,写成最终提示词,放进 `out/ref/remake/prompts.json`(`{"G1": "..."}`,图片编号按单元里参考图的顺序),再跑一次 `rea-video plan`,直到方案检查没有 ❌。
+4. 写之前上网搜这个模型的提示词写法和同类镜头的优质提示词:先看口碑好的创作者的实测(X、YouTube、B站、小红书等),再看官方文档和示例;平台的教程页(CapCut、fal 这类)只当二手资料。参考结构和写法,不照抄内容;和能力地图不一致的按第 2 步记下来。报告里的草稿已按这个模型的分镜、参考标签、首帧纯运动精简和台词音效格式排好,再按它的写法(`rea-video models <id>`,或这个模型的提示词 skill)核对改写成最终提示词放进 `out/ref/remake/prompts.json`(`{"G1": "..."}`,图片编号按单元里参考图的顺序;单跑命令行时也可直接用 `rea-video plan out/ref --rewrite-prompts` 自动按模型指南重写并校验),再跑一次 `rea-video plan`,直到方案检查没有 ❌。
5. 把方案给用户看(调用次数、每次喂什么、检查结果),用户同意后再生成。
用户要自己动手做时,先给报告第二部分「照着做」的步骤,不要先讲模型规则和输入表。
diff --git a/skills/rea-video/references/remake.md b/skills/rea-video/references/remake.md
index 93fcc0c..1111cea 100644
--- a/skills/rea-video/references/remake.md
+++ b/skills/rea-video/references/remake.md
@@ -13,7 +13,7 @@
## 用哪个模型
- 模型、整条重做还是只做 AI 镜头、换什么,都写在 `remake/intent.yaml`(见 SKILL.md「复刻」),`rea-video plan out/ref` 按它出方案。用户没说用哪个模型时,先按默认模型(MiniMax H3,或 `prefs engine` 记住的模型)出方案并在回复里说明,不要先停下来追问;用户想换模型再跑 `rea-video plan out/ref --model <id>`。
-- 报告里每个单元的提示词是草稿,有格式模板的模型已按它的镜头写法、语言和素材编号排好。按 `rea-video models <id>` 打印的写法核对,写成最终版放进 `remake/prompts.json`:时间和镜头怎么分、参考素材怎么指代、台词和不想要的内容怎么写;首帧 / 首尾帧模式下只留运动和运镜。`rea-video plan` 会按这个模型的格式规则检查。
+- 报告里每个单元的提示词是草稿,已按该模型的镜头写法、语言、素材编号、台词音效格式排好(首帧 / 首尾帧模式下自动去掉重复的静态环境/光线描述,只留运动和运镜)。按 `rea-video models <id>` 打印的写法核对,写成最终版放进 `remake/prompts.json`(或运行 `rea-video plan out/ref --rewrite-prompts` 用配置的大模型自动重写并过校验)。`rea-video plan` 会按这个模型的格式规则检查。
- 选帧、擦字、首尾帧怎么配:`rea-video models keyframes`。
## 各类镜头怎么复刻