@ww_nero/skills 3.4.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,141 @@
1
+ 制作视频的完整步骤如下(可根据当前实际状态,跳过部分已经完成的环节):
2
+
3
+ **重要说明**:本指南仅适用于**定格动画风格**的视频制作,即通过若干静态图片按顺序拼接成视频。如需制作**连续变化、流畅过渡**的视频(如人物动作、场景变换等),建议使用以下专业工具:
4
+ - AI视频生成工具:Sora、Kling、Runway、Pika等
5
+ - 专业视频剪辑软件:Adobe Premiere Pro、Final Cut Pro、DaVinci Resolve等
6
+
7
+ ---
8
+
9
+ ## 一、规划视频内容
10
+
11
+ **确定视频结构**,存储到markdown文件中:
12
+ - 视频主题和整体风格
13
+ - 分镜脚本:每个画面的内容描述、旁白/字幕文本
14
+ - 背景音乐需求(如有)
15
+
16
+ ## 二、生成配音并获取时间戳
17
+
18
+ 由于语音的时长难以精确控制,应**先生成配音,再根据音频时长编排画面**。
19
+
20
+ 1. **准备旁白文本**:根据分镜脚本整理完整的旁白内容
21
+ 2. **使用语音合成工具生成语音**:将文本转为音频文件
22
+ 3. **使用语音识别工具获取时间戳**:对生成的音频进行识别,获取带时间戳的SRT字幕文件
23
+ 4. **根据时间戳规划画面**:根据SRT文件中每段文字的起止时间,确定每张图片的显示时长
24
+
25
+ ## 三、准备图片素材
26
+
27
+ 根据语音识别工具返回的时间戳信息准备图片:
28
+
29
+ 1. **收集或生成图片**:
30
+ - 优先使用用户提供的图片素材
31
+ - 如需生成图片,使用图像生成工具创建
32
+ 2. **图片规格要求**:
33
+ - 所有图片保存到`images`文件夹
34
+ - 建议使用统一的分辨率(如1920x1080或1280x720)
35
+ - 图片命名规则:`frame_01.png`、`frame_02.png`等,按播放顺序编号
36
+
37
+ ## 四、使用ffmpeg合成视频
38
+
39
+ ### 基础图片序列转视频
40
+
41
+ ```bash
42
+ # 将图片序列转为视频(每张图片显示2秒)
43
+ ffmpeg -framerate 0.5 -i images/frame_%02d.png -c:v libx264 -pix_fmt yuv420p -r 30 output.mp4
44
+ ```
45
+
46
+ 参数说明:
47
+ - `-framerate 0.5`:输入帧率,0.5表示每张图片持续2秒(1/0.5=2秒)
48
+ - `-i images/frame_%02d.png`:输入图片序列,%02d表示两位数编号
49
+ - `-c:v libx264`:使用H.264编码
50
+ - `-pix_fmt yuv420p`:像素格式,确保兼容性
51
+ - `-r 30`:输出帧率30fps
52
+
53
+ ### 添加背景音乐
54
+
55
+ ```bash
56
+ # 合成视频和背景音乐
57
+ ffmpeg -i video.mp4 -i bgm.mp3 -c:v copy -c:a aac -shortest output_with_bgm.mp4
58
+ ```
59
+
60
+ ### 添加配音
61
+
62
+ ```bash
63
+ # 合成视频和配音
64
+ ffmpeg -i video.mp4 -i narration.mp3 -c:v copy -c:a aac -map 0:v -map 1:a output_with_voice.mp4
65
+ ```
66
+
67
+ ### 添加字幕
68
+
69
+ 1. **准备字幕文件**(SRT格式),例如`subtitles.srt`:
70
+ ```
71
+ 1
72
+ 00:00:00,000 --> 00:00:03,000
73
+ 这是第一段字幕
74
+
75
+ 2
76
+ 00:00:03,000 --> 00:00:06,000
77
+ 这是第二段字幕
78
+ ```
79
+
80
+ 2. **烧录字幕到视频**:
81
+ ```bash
82
+ # 硬字幕(字幕嵌入视频画面)
83
+ ffmpeg -i video.mp4 -vf "subtitles=subtitles.srt:force_style='FontName=Microsoft YaHei,FontSize=24,PrimaryColour=&HFFFFFF&'" -c:a copy output_with_sub.mp4
84
+ ```
85
+
86
+ ### 完整合成示例
87
+
88
+ ```bash
89
+ # 一次性合成:图片序列 + 配音 + 字幕
90
+ ffmpeg -framerate 0.5 -i images/frame_%02d.png -i narration.mp3 \
91
+ -c:v libx264 -pix_fmt yuv420p -r 30 \
92
+ -vf "subtitles=subtitles.srt:force_style='FontName=Microsoft YaHei,FontSize=24'" \
93
+ -c:a aac -shortest output_final.mp4
94
+ ```
95
+
96
+ ## 五、注意事项
97
+
98
+ 1. **图片尺寸一致性**:所有图片必须使用相同的分辨率,否则ffmpeg可能报错
99
+ 2. **图片编号连续**:图片序列编号必须连续,不能有间断(如01、02、04会导致03之后的图片被忽略)
100
+ 3. **中文字幕字体**:使用中文字幕时需指定支持中文的字体(如Microsoft YaHei、SimHei等)
101
+ 4. **音视频同步**:使用`-shortest`参数可让视频在音频或视频任一结束时停止
102
+ 5. **文件格式**:输出建议使用MP4格式(H.264+AAC),兼容性最好
103
+
104
+ ## 六、进阶技巧
105
+
106
+ ### 不同图片不同持续时间
107
+
108
+ 如需每张图片显示不同时长,可使用concat方式:
109
+
110
+ 1. 创建`input.txt`文件:
111
+ ```
112
+ file 'images/frame_01.png'
113
+ duration 3
114
+ file 'images/frame_02.png'
115
+ duration 2
116
+ file 'images/frame_03.png'
117
+ duration 4
118
+ file 'images/frame_03.png'
119
+ ```
120
+ 注意:最后一个文件需要重复一次(ffmpeg的concat demuxer要求)
121
+
122
+ 2. 执行合成:
123
+ ```bash
124
+ ffmpeg -f concat -i input.txt -c:v libx264 -pix_fmt yuv420p -r 30 output.mp4
125
+ ```
126
+
127
+ ### 添加转场效果
128
+
129
+ ffmpeg支持简单的转场效果(如淡入淡出):
130
+
131
+ ```bash
132
+ # 添加淡入效果(前2秒)
133
+ ffmpeg -i video.mp4 -vf "fade=t=in:st=0:d=2" -c:a copy output_fade.mp4
134
+
135
+ # 添加淡出效果(最后2秒,假设视频10秒)
136
+ ffmpeg -i video.mp4 -vf "fade=t=out:st=8:d=2" -c:a copy output_fade.mp4
137
+ ```
138
+
139
+ ---
140
+
141
+ **完成后建议保留**:规划文档、图片素材、字幕文件和音频文件,方便后续修改调整。
package/index.js CHANGED
@@ -89,6 +89,7 @@ const loadText = (filename) => {
89
89
  };
90
90
 
91
91
  const PPT_PROMPT = loadText('ppt_prompt.txt');
92
+ const VIDEO_PROMPT = loadText('video_prompt.txt');
92
93
 
93
94
  const buildSnippet = (title, workingDirectory) => {
94
95
  const entry = SNIPPETS[title];
@@ -145,11 +146,20 @@ const listTools = () => ({
145
146
  properties: {},
146
147
  required: []
147
148
  }
149
+ },
150
+ {
151
+ name: 'video',
152
+ description: '制作视频的全流程指导说明和注意事项',
153
+ inputSchema: {
154
+ type: 'object',
155
+ properties: {},
156
+ required: []
157
+ }
148
158
  }
149
159
  ]
150
160
  });
151
161
 
152
- const server = new Server({ name: 'skills', version: '3.4.1' }, { capabilities: { tools: {} } });
162
+ const server = new Server({ name: 'skills', version: '3.5.0' }, { capabilities: { tools: {} } });
153
163
 
154
164
  server.setRequestHandler(ListToolsRequestSchema, async () => listTools());
155
165
 
@@ -170,6 +180,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
170
180
  return { content: [{ type: 'text', text: PPT_PROMPT }] };
171
181
  }
172
182
 
183
+ if (name === 'video') {
184
+ return { content: [{ type: 'text', text: VIDEO_PROMPT }] };
185
+ }
186
+
173
187
  return { content: [{ type: 'text', text: `未知工具: ${name}` }], isError: true };
174
188
  } catch (error) {
175
189
  const message = error?.message || '未知错误';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ww_nero/skills",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "MCP server that returns Python reference snippets and skill guides",
5
5
  "main": "index.js",
6
6
  "bin": {