@synap-core/workspace-templates 0.34.0 → 0.36.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.
- package/README.md +74 -0
- package/capabilities/media-download.capability.json +237 -0
- package/capabilities/media-ffmpeg.capability.json +1456 -0
- package/capabilities/media-matte.capability.json +195 -0
- package/capabilities/media-transcribe.capability.json +282 -0
- package/dist/{define-DHDi8C33.d.ts → define-YL-hIPcn.d.ts} +10 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -1
- package/dist/wire.d.ts +13 -1
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
- package/src/crm-health.template.test.ts +82 -0
- package/src/crm.yaml +102 -0
- package/src/templates.ts +75 -0
- package/src/types.ts +5 -0
- package/src/wire-core.ts +12 -0
|
@@ -0,0 +1,1456 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiVersion": "synap/v1",
|
|
3
|
+
"kind": "capability",
|
|
4
|
+
"meta": {
|
|
5
|
+
"slug": "media-ffmpeg",
|
|
6
|
+
"name": "ffmpeg on your computer",
|
|
7
|
+
"description": "Edits video and audio on your own computer with ffmpeg and a library of named recipes: vertical crops, captions, loudness, silence cuts, colour, transitions, overlays, background replacement, slideshows, GIFs and platform exports. Nothing leaves the computer. ffmpeg is GPL software, installed from its usual source, never bundled.",
|
|
8
|
+
"tags": [
|
|
9
|
+
"capability",
|
|
10
|
+
"media",
|
|
11
|
+
"video",
|
|
12
|
+
"computer"
|
|
13
|
+
],
|
|
14
|
+
"isPublic": true
|
|
15
|
+
},
|
|
16
|
+
"spec": {
|
|
17
|
+
"key": "media-ffmpeg",
|
|
18
|
+
"name": "ffmpeg on your computer",
|
|
19
|
+
"description": "ffmpeg with libass, freetype, fribidi and zimg (captions, text, HDR tone-mapping), installed on a computer and pinned to its path, plus the recipe library (spec.recipes): each recipe is typed params and argv steps the computer fills, never a shell line. Mac: Homebrew ffmpeg-full (keg-only, next to any core ffmpeg; core ffmpeg has no libass). Linux: the BtbN static GPL build of 9.0.2, pinned to the month-end build of 31 Oct 2026 by its sha256 (BtbN keeps month-end builds), unpacked in Synap's tools folder (no sudo). Windows: winget Gyan.FFmpeg (the full build). The check prints the ffmpeg version and proves libass is there.",
|
|
20
|
+
"licence": "GPL-2.0-or-later",
|
|
21
|
+
"placement": {
|
|
22
|
+
"runsOn": [
|
|
23
|
+
"computer"
|
|
24
|
+
],
|
|
25
|
+
"prefer": [
|
|
26
|
+
"computer"
|
|
27
|
+
],
|
|
28
|
+
"platforms": [
|
|
29
|
+
{
|
|
30
|
+
"os": "darwin",
|
|
31
|
+
"arch": [
|
|
32
|
+
"arm64",
|
|
33
|
+
"x64"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"os": "linux",
|
|
38
|
+
"arch": [
|
|
39
|
+
"x64",
|
|
40
|
+
"arm64"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"os": "win32",
|
|
45
|
+
"arch": [
|
|
46
|
+
"x64"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"requires": {
|
|
51
|
+
"runtimes": {
|
|
52
|
+
"python": ">=3.9"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"install": {
|
|
57
|
+
"darwin": {
|
|
58
|
+
"steps": [
|
|
59
|
+
{
|
|
60
|
+
"kind": "brew",
|
|
61
|
+
"package": "ffmpeg-full"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"bins": {
|
|
65
|
+
"ffmpeg": "{brewPrefix}/opt/ffmpeg-full/bin/ffmpeg",
|
|
66
|
+
"ffprobe": "{brewPrefix}/opt/ffmpeg-full/bin/ffprobe"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"linux": {
|
|
70
|
+
"steps": [
|
|
71
|
+
{
|
|
72
|
+
"kind": "download",
|
|
73
|
+
"what": "archive",
|
|
74
|
+
"url": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2026-10-31-12-59/ffmpeg-n9.0.2-39-g7adfbe40dc-linux64-gpl-9.0.tar.xz",
|
|
75
|
+
"sha256": "73e29a56974ae5a651133a04584c7483b21afe941e17dc91d79814a758b608d3",
|
|
76
|
+
"dest": "{tools}/ffmpeg",
|
|
77
|
+
"stripComponents": 1,
|
|
78
|
+
"sizeMb": 140,
|
|
79
|
+
"arch": [
|
|
80
|
+
"x64"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"kind": "download",
|
|
85
|
+
"what": "archive",
|
|
86
|
+
"url": "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2026-10-31-12-59/ffmpeg-n9.0.2-39-g7adfbe40dc-linuxarm64-gpl-9.0.tar.xz",
|
|
87
|
+
"sha256": "6cad88ae5bcec356cfc5d7979a036cc4007128201928a0cf243df3db483276cc",
|
|
88
|
+
"dest": "{tools}/ffmpeg",
|
|
89
|
+
"stripComponents": 1,
|
|
90
|
+
"sizeMb": 130,
|
|
91
|
+
"arch": [
|
|
92
|
+
"arm64"
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"bins": {
|
|
97
|
+
"ffmpeg": "{tools}/ffmpeg/bin/ffmpeg",
|
|
98
|
+
"ffprobe": "{tools}/ffmpeg/bin/ffprobe"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"win32": {
|
|
102
|
+
"steps": [
|
|
103
|
+
{
|
|
104
|
+
"kind": "winget",
|
|
105
|
+
"id": "Gyan.FFmpeg"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"bins": {
|
|
109
|
+
"ffmpeg": "ffmpeg.exe",
|
|
110
|
+
"ffprobe": "ffprobe.exe"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"elevation": "never",
|
|
114
|
+
"diskFreeMb": 600
|
|
115
|
+
},
|
|
116
|
+
"verify": {
|
|
117
|
+
"darwin": {
|
|
118
|
+
"command": [
|
|
119
|
+
"ffmpeg",
|
|
120
|
+
"-hide_banner",
|
|
121
|
+
"-version"
|
|
122
|
+
],
|
|
123
|
+
"expect": {
|
|
124
|
+
"exitCode": 0,
|
|
125
|
+
"stdoutMatches": "^ffmpeg version n?(\\d+\\.\\d+(?:\\.\\d+)?)"
|
|
126
|
+
},
|
|
127
|
+
"captureVersion": 1,
|
|
128
|
+
"smoke": {
|
|
129
|
+
"command": [
|
|
130
|
+
"ffmpeg",
|
|
131
|
+
"-hide_banner",
|
|
132
|
+
"-h",
|
|
133
|
+
"filter=subtitles"
|
|
134
|
+
],
|
|
135
|
+
"expect": {
|
|
136
|
+
"exitCode": 0,
|
|
137
|
+
"stdoutContains": "libass"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"linux": {
|
|
142
|
+
"command": [
|
|
143
|
+
"ffmpeg",
|
|
144
|
+
"-hide_banner",
|
|
145
|
+
"-version"
|
|
146
|
+
],
|
|
147
|
+
"expect": {
|
|
148
|
+
"exitCode": 0,
|
|
149
|
+
"stdoutMatches": "^ffmpeg version n?(\\d+\\.\\d+(?:\\.\\d+)?)"
|
|
150
|
+
},
|
|
151
|
+
"captureVersion": 1,
|
|
152
|
+
"smoke": {
|
|
153
|
+
"command": [
|
|
154
|
+
"ffmpeg",
|
|
155
|
+
"-hide_banner",
|
|
156
|
+
"-h",
|
|
157
|
+
"filter=subtitles"
|
|
158
|
+
],
|
|
159
|
+
"expect": {
|
|
160
|
+
"exitCode": 0,
|
|
161
|
+
"stdoutContains": "libass"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"win32": {
|
|
166
|
+
"command": [
|
|
167
|
+
"ffmpeg",
|
|
168
|
+
"-hide_banner",
|
|
169
|
+
"-version"
|
|
170
|
+
],
|
|
171
|
+
"expect": {
|
|
172
|
+
"exitCode": 0,
|
|
173
|
+
"stdoutMatches": "^ffmpeg version n?(\\d+\\.\\d+(?:\\.\\d+)?)"
|
|
174
|
+
},
|
|
175
|
+
"captureVersion": 1,
|
|
176
|
+
"smoke": {
|
|
177
|
+
"command": [
|
|
178
|
+
"ffmpeg",
|
|
179
|
+
"-hide_banner",
|
|
180
|
+
"-h",
|
|
181
|
+
"filter=subtitles"
|
|
182
|
+
],
|
|
183
|
+
"expect": {
|
|
184
|
+
"exitCode": 0,
|
|
185
|
+
"stdoutContains": "libass"
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
"timeoutSec": 30,
|
|
190
|
+
"reverifyEvery": "P7D"
|
|
191
|
+
},
|
|
192
|
+
"uninstall": {
|
|
193
|
+
"darwin": {
|
|
194
|
+
"steps": [
|
|
195
|
+
{
|
|
196
|
+
"kind": "brew",
|
|
197
|
+
"package": "ffmpeg-full",
|
|
198
|
+
"action": "uninstall"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
"win32": {
|
|
203
|
+
"steps": [
|
|
204
|
+
{
|
|
205
|
+
"kind": "winget",
|
|
206
|
+
"id": "Gyan.FFmpeg",
|
|
207
|
+
"action": "uninstall"
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
"keepUserData": true
|
|
212
|
+
},
|
|
213
|
+
"permissions": {
|
|
214
|
+
"filesystem": [
|
|
215
|
+
{
|
|
216
|
+
"path": "{workdir}",
|
|
217
|
+
"access": "rw"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"network": [],
|
|
221
|
+
"devices": []
|
|
222
|
+
},
|
|
223
|
+
"recipes": [
|
|
224
|
+
{
|
|
225
|
+
"name": "reframe-crop",
|
|
226
|
+
"description": "Crop a landscape video to a vertical or square frame (9:16 by default; 1080x1350 for 4:5, 1080x1080 for 1:1).",
|
|
227
|
+
"params": {
|
|
228
|
+
"in": {
|
|
229
|
+
"type": "file",
|
|
230
|
+
"description": "The video to work on.",
|
|
231
|
+
"required": true
|
|
232
|
+
},
|
|
233
|
+
"out": {
|
|
234
|
+
"type": "output",
|
|
235
|
+
"description": "Where the result is written.",
|
|
236
|
+
"required": true
|
|
237
|
+
},
|
|
238
|
+
"width": {
|
|
239
|
+
"type": "integer",
|
|
240
|
+
"description": "Output width in pixels.",
|
|
241
|
+
"default": 1080
|
|
242
|
+
},
|
|
243
|
+
"height": {
|
|
244
|
+
"type": "integer",
|
|
245
|
+
"description": "Output height in pixels.",
|
|
246
|
+
"default": 1920
|
|
247
|
+
},
|
|
248
|
+
"xFrac": {
|
|
249
|
+
"type": "number",
|
|
250
|
+
"description": "Where the subject sits across the frame: 0 = left edge, 0.5 = centre, 1 = right edge.",
|
|
251
|
+
"default": 0.5
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"steps": [
|
|
255
|
+
{
|
|
256
|
+
"program": "ffmpeg",
|
|
257
|
+
"args": [
|
|
258
|
+
"-y",
|
|
259
|
+
"-i",
|
|
260
|
+
"{in}",
|
|
261
|
+
"-vf",
|
|
262
|
+
"crop=ih*{width}/{height}:ih:(iw-ih*{width}/{height})*{xFrac}:0,scale={width}:{height}:flags=lanczos,setsar=1",
|
|
263
|
+
"-c:a",
|
|
264
|
+
"copy",
|
|
265
|
+
"{out}"
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
"needs": {
|
|
270
|
+
"filters": [
|
|
271
|
+
"crop",
|
|
272
|
+
"scale",
|
|
273
|
+
"setsar"
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
"gotchas": [
|
|
277
|
+
"A 1080p source cropped to 9:16 is only 608x1080 before scaling: shoot 4K for vertical output, or accept the softness.",
|
|
278
|
+
"A fixed crop cannot follow a subject who moves.",
|
|
279
|
+
"The source must be wider than the target frame (landscape in, vertical or square out)."
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "reframe-vertical-blur-pad",
|
|
284
|
+
"description": "Fit a landscape video inside a 9:16 frame over a blurred, darkened copy of itself (screen recordings, slides).",
|
|
285
|
+
"params": {
|
|
286
|
+
"in": {
|
|
287
|
+
"type": "file",
|
|
288
|
+
"description": "The video to work on.",
|
|
289
|
+
"required": true
|
|
290
|
+
},
|
|
291
|
+
"out": {
|
|
292
|
+
"type": "output",
|
|
293
|
+
"description": "Where the result is written.",
|
|
294
|
+
"required": true
|
|
295
|
+
},
|
|
296
|
+
"brightness": {
|
|
297
|
+
"type": "number",
|
|
298
|
+
"description": "How much the blurred fill is darkened (-1 to 1).",
|
|
299
|
+
"default": -0.06
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"steps": [
|
|
303
|
+
{
|
|
304
|
+
"program": "ffmpeg",
|
|
305
|
+
"args": [
|
|
306
|
+
"-y",
|
|
307
|
+
"-i",
|
|
308
|
+
"{in}",
|
|
309
|
+
"-filter_complex",
|
|
310
|
+
"[0:v]split=2[b][f];[b]scale=270:480:force_original_aspect_ratio=increase,crop=270:480,boxblur=20:2,scale=1080:1920,eq=brightness={brightness}:saturation=1.1[bg];[f]scale=1080:-2:flags=lanczos[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2,setsar=1[v]",
|
|
311
|
+
"-map",
|
|
312
|
+
"[v]",
|
|
313
|
+
"-map",
|
|
314
|
+
"0:a?",
|
|
315
|
+
"-c:a",
|
|
316
|
+
"copy",
|
|
317
|
+
"{out}"
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"needs": {
|
|
322
|
+
"filters": [
|
|
323
|
+
"boxblur",
|
|
324
|
+
"eq",
|
|
325
|
+
"overlay"
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
"gotchas": [
|
|
329
|
+
"The fill is blurred at quarter size then scaled up: about 10x faster than a full-size blur and it looks the same.",
|
|
330
|
+
"Darken the fill a little so it does not compete with the content."
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"name": "loudness-normalize",
|
|
335
|
+
"description": "Two-pass loudness normalisation to -14 LUFS (YouTube, Spotify, social); -16 for podcasts.",
|
|
336
|
+
"params": {
|
|
337
|
+
"in": {
|
|
338
|
+
"type": "file",
|
|
339
|
+
"description": "The video to work on.",
|
|
340
|
+
"required": true
|
|
341
|
+
},
|
|
342
|
+
"out": {
|
|
343
|
+
"type": "output",
|
|
344
|
+
"description": "Where the result is written.",
|
|
345
|
+
"required": true
|
|
346
|
+
},
|
|
347
|
+
"target": {
|
|
348
|
+
"type": "number",
|
|
349
|
+
"description": "Integrated loudness target in LUFS.",
|
|
350
|
+
"default": -14
|
|
351
|
+
},
|
|
352
|
+
"truePeak": {
|
|
353
|
+
"type": "number",
|
|
354
|
+
"description": "True-peak ceiling in dBTP.",
|
|
355
|
+
"default": -1.5
|
|
356
|
+
},
|
|
357
|
+
"lra": {
|
|
358
|
+
"type": "number",
|
|
359
|
+
"description": "Loudness range target.",
|
|
360
|
+
"default": 11
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"steps": [
|
|
364
|
+
{
|
|
365
|
+
"program": "python",
|
|
366
|
+
"args": [
|
|
367
|
+
"{script:loudnorm2pass.py}",
|
|
368
|
+
"{bin:ffmpeg}",
|
|
369
|
+
"{in}",
|
|
370
|
+
"{out}",
|
|
371
|
+
"{target}",
|
|
372
|
+
"{truePeak}",
|
|
373
|
+
"{lra}"
|
|
374
|
+
]
|
|
375
|
+
}
|
|
376
|
+
],
|
|
377
|
+
"scripts": [
|
|
378
|
+
{
|
|
379
|
+
"name": "loudnorm2pass.py",
|
|
380
|
+
"sha256": "0e884b91836477b9a9970629ccbc9f09a9f0cf79160a4e067882ed415b706ee1",
|
|
381
|
+
"source": "#!/usr/bin/env python3\n# loudnorm2pass.py FFMPEG IN OUT TARGET_I TRUE_PEAK LRA\n# Two-pass loudnorm: measure, then normalise linearly to the target (video copied, audio AAC 48 kHz).\nimport json, re, subprocess, sys\nffmpeg, inp, out, i, tp, lra = sys.argv[1:7]\nbase = f\"loudnorm=I={i}:TP={tp}:LRA={lra}\"\nlog = subprocess.run([ffmpeg, \"-hide_banner\", \"-nostats\", \"-i\", inp, \"-af\", base + \":print_format=json\", \"-f\", \"null\", \"-\"],\n capture_output=True, text=True).stderr\nm = re.search(r\"\\{[^{}]*\\\"input_i\\\"[^{}]*\\}\", log)\nif not m:\n sys.exit(\"loudnorm2pass: the first pass printed no measurement\")\nln = json.loads(m.group(0))\nsecond = (f\"{base}:measured_I={ln['input_i']}:measured_TP={ln['input_tp']}:measured_LRA={ln['input_lra']}\"\n f\":measured_thresh={ln['input_thresh']}:offset={ln['target_offset']}:linear=true:print_format=summary\")\nsubprocess.run([ffmpeg, \"-y\", \"-i\", inp, \"-af\", second, \"-ar\", \"48000\", \"-c:v\", \"copy\", \"-c:a\", \"aac\", \"-b:a\", \"192k\", out], check=True)\n"
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
"needs": {
|
|
385
|
+
"filters": [
|
|
386
|
+
"loudnorm"
|
|
387
|
+
]
|
|
388
|
+
},
|
|
389
|
+
"gotchas": [
|
|
390
|
+
"loudnorm resamples to 192 kHz inside: the script sets 48 kHz on the output.",
|
|
391
|
+
"Normalise after the mix (voice plus music), as the last audio step.",
|
|
392
|
+
"If the summary says Dynamic, the target could not be reached under the peak limit: lower the target."
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"name": "silence-cut",
|
|
397
|
+
"description": "Cut the silences out of a talking-head take (jump cuts), keeping a little air around speech.",
|
|
398
|
+
"params": {
|
|
399
|
+
"in": {
|
|
400
|
+
"type": "file",
|
|
401
|
+
"description": "The video to work on.",
|
|
402
|
+
"required": true
|
|
403
|
+
},
|
|
404
|
+
"out": {
|
|
405
|
+
"type": "output",
|
|
406
|
+
"description": "Where the result is written.",
|
|
407
|
+
"required": true
|
|
408
|
+
},
|
|
409
|
+
"noiseDb": {
|
|
410
|
+
"type": "number",
|
|
411
|
+
"description": "Below this level (dB) counts as silence; measure the room, usually -30 to -40.",
|
|
412
|
+
"default": -35
|
|
413
|
+
},
|
|
414
|
+
"minSilence": {
|
|
415
|
+
"type": "number",
|
|
416
|
+
"description": "Shortest silence to cut, in seconds (0.5 to 0.7 sounds natural).",
|
|
417
|
+
"default": 0.5
|
|
418
|
+
},
|
|
419
|
+
"pad": {
|
|
420
|
+
"type": "number",
|
|
421
|
+
"description": "Seconds kept around speech.",
|
|
422
|
+
"default": 0.12
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
"steps": [
|
|
426
|
+
{
|
|
427
|
+
"program": "python",
|
|
428
|
+
"args": [
|
|
429
|
+
"{script:silencecut.py}",
|
|
430
|
+
"{bin:ffmpeg}",
|
|
431
|
+
"{bin:ffprobe}",
|
|
432
|
+
"{in}",
|
|
433
|
+
"{out}",
|
|
434
|
+
"{noiseDb}",
|
|
435
|
+
"{minSilence}",
|
|
436
|
+
"{pad}"
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
"scripts": [
|
|
441
|
+
{
|
|
442
|
+
"name": "silencecut.py",
|
|
443
|
+
"sha256": "1fcf74c96c1605d98a12c7137b1a21f09dfb6bb681258868f0ffe0e77676ea63",
|
|
444
|
+
"source": "#!/usr/bin/env python3\n# silencecut.py FFMPEG FFPROBE IN OUT NOISE_DB MIN_SILENCE PAD\n# Cuts the silences out of a take: keeps PAD seconds around speech, 10 ms fades at each joint.\nimport re, subprocess, sys\nffmpeg, ffprobe, inp, out = sys.argv[1:5]\nnoise = f\"{float(sys.argv[5])}dB\"\ndmin, pad = float(sys.argv[6]), float(sys.argv[7])\ndur = float(subprocess.check_output([ffprobe, \"-v\", \"error\", \"-show_entries\", \"format=duration\", \"-of\", \"csv=p=0\", inp]))\nlog = subprocess.run([ffmpeg, \"-hide_banner\", \"-nostats\", \"-i\", inp, \"-af\", f\"silencedetect=noise={noise}:d={dmin}\",\n \"-f\", \"null\", \"-\"], capture_output=True, text=True).stderr\nstarts = [max(0.0, float(x)) for x in re.findall(r\"silence_start: (-?[\\d.]+)\", log)]\nends = [float(x) for x in re.findall(r\"silence_end: ([\\d.]+)\", log)]\nif len(ends) < len(starts):\n ends.append(dur)\nkeep, t = [], 0.0\nfor s, e in zip(starts, ends):\n a, b = t, min(s + pad, dur)\n if b - a > 0.05:\n keep.append((a, b))\n t = max(e - pad, 0.0)\nif dur - t > 0.05:\n keep.append((t, dur))\nif not keep:\n sys.exit(\"silencecut: nothing but silence at this noise level\")\nparts, labels = [], \"\"\nfor i, (a, b) in enumerate(keep):\n d = b - a\n parts.append(f\"[0:v]trim={a:.3f}:{b:.3f},setpts=PTS-STARTPTS[v{i}];\"\n f\"[0:a]atrim={a:.3f}:{b:.3f},asetpts=PTS-STARTPTS,afade=t=in:d=0.01,afade=t=out:st={d-0.01:.3f}:d=0.01[a{i}]\")\n labels += f\"[v{i}][a{i}]\"\ngraph = out + \".graph\"\nwith open(graph, \"w\") as f:\n f.write(\";\".join(parts) + f\";{labels}concat=n={len(keep)}:v=1:a=1[v][a]\")\nsubprocess.run([ffmpeg, \"-y\", \"-i\", inp, \"-/filter_complex\", graph, \"-map\", \"[v]\", \"-map\", \"[a]\",\n \"-c:v\", \"libx264\", \"-crf\", \"16\", \"-preset\", \"medium\", \"-c:a\", \"aac\", \"-b:a\", \"192k\", out], check=True)\n"
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
"needs": {
|
|
448
|
+
"filters": [
|
|
449
|
+
"silencedetect",
|
|
450
|
+
"trim",
|
|
451
|
+
"atrim",
|
|
452
|
+
"concat",
|
|
453
|
+
"afade"
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
"gotchas": [
|
|
457
|
+
"Too high a noise level cuts soft word endings.",
|
|
458
|
+
"A minimum silence under 0.35 s makes speech feel breathless.",
|
|
459
|
+
"Transcribe again after the cut, so word timings match the new file."
|
|
460
|
+
]
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "captions-burn-in",
|
|
464
|
+
"description": "Burn word-by-word captions (Reels style, the spoken word highlighted) into a 9:16 video, from whisper word timings, inside the safe zone.",
|
|
465
|
+
"params": {
|
|
466
|
+
"in": {
|
|
467
|
+
"type": "file",
|
|
468
|
+
"description": "The 9:16 (1080x1920) video.",
|
|
469
|
+
"required": true
|
|
470
|
+
},
|
|
471
|
+
"words": {
|
|
472
|
+
"type": "file",
|
|
473
|
+
"description": "The transcript JSON with word timings (segments[].words[]), from media-transcribe.",
|
|
474
|
+
"required": true
|
|
475
|
+
},
|
|
476
|
+
"fontsDir": {
|
|
477
|
+
"type": "file",
|
|
478
|
+
"description": "A folder holding the caption font files (the brand font), so the render never depends on system fonts.",
|
|
479
|
+
"required": true
|
|
480
|
+
},
|
|
481
|
+
"out": {
|
|
482
|
+
"type": "output",
|
|
483
|
+
"description": "Where the result is written.",
|
|
484
|
+
"required": true
|
|
485
|
+
},
|
|
486
|
+
"wordsPerCard": {
|
|
487
|
+
"type": "integer",
|
|
488
|
+
"description": "Words shown at once.",
|
|
489
|
+
"default": 3
|
|
490
|
+
},
|
|
491
|
+
"font": {
|
|
492
|
+
"type": "string",
|
|
493
|
+
"description": "The font's family name (its internal name, not the file name).",
|
|
494
|
+
"default": "Inter"
|
|
495
|
+
},
|
|
496
|
+
"fontSize": {
|
|
497
|
+
"type": "integer",
|
|
498
|
+
"description": "Font size on the 1080x1920 canvas.",
|
|
499
|
+
"default": 84
|
|
500
|
+
},
|
|
501
|
+
"marginV": {
|
|
502
|
+
"type": "integer",
|
|
503
|
+
"description": "Distance from the bottom edge in pixels; 680 keeps the text above the platform buttons and caption.",
|
|
504
|
+
"default": 680
|
|
505
|
+
},
|
|
506
|
+
"highlight": {
|
|
507
|
+
"type": "color",
|
|
508
|
+
"description": "Colour of the spoken word.",
|
|
509
|
+
"default": "FFD700"
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
"steps": [
|
|
513
|
+
{
|
|
514
|
+
"program": "python",
|
|
515
|
+
"args": [
|
|
516
|
+
"{script:words2ass.py}",
|
|
517
|
+
"{words}",
|
|
518
|
+
"{workdir}/captions.ass",
|
|
519
|
+
"{wordsPerCard}",
|
|
520
|
+
"{font}",
|
|
521
|
+
"{fontSize}",
|
|
522
|
+
"{marginV}",
|
|
523
|
+
"{highlight}"
|
|
524
|
+
]
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"program": "ffmpeg",
|
|
528
|
+
"args": [
|
|
529
|
+
"-y",
|
|
530
|
+
"-i",
|
|
531
|
+
"{in}",
|
|
532
|
+
"-vf",
|
|
533
|
+
"ass={workdir}/captions.ass:fontsdir={fontsDir}",
|
|
534
|
+
"-c:a",
|
|
535
|
+
"copy",
|
|
536
|
+
"{out}"
|
|
537
|
+
]
|
|
538
|
+
}
|
|
539
|
+
],
|
|
540
|
+
"scripts": [
|
|
541
|
+
{
|
|
542
|
+
"name": "words2ass.py",
|
|
543
|
+
"sha256": "d2cc3eefb42343e196dc9e9ccb962adf5bcc544e37a66cdffbd04c3727c04bad",
|
|
544
|
+
"source": "#!/usr/bin/env python3\n# words2ass.py WHISPER_JSON OUT_ASS WORDS_PER_CARD FONT FONT_SIZE MARGIN_V HIGHLIGHT_HEX\n# Word-by-word captions (Reels style) from whisper word timings (segments[].words[]: word, start, end).\n# 1080x1920 canvas; MARGIN_V from the bottom keeps the text inside the safe zone (680 = baseline near y 1240).\nimport json, sys\nsrc, out = sys.argv[1], sys.argv[2]\nn, font, size, margin_v, hi = int(sys.argv[3]), sys.argv[4], int(sys.argv[5]), int(sys.argv[6]), sys.argv[7].lstrip(\"#\")[-6:]\nwords = [w for s in json.load(open(src, encoding=\"utf-8\"))[\"segments\"] for w in s.get(\"words\", [])]\nif not words:\n sys.exit(\"words2ass: the transcript has no word timings (transcribe with word timestamps)\")\ndef ts(t):\n return f\"{int(t // 3600)}:{int(t % 3600 // 60):02d}:{t % 60:05.2f}\"\nhead = f\"\"\"[Script Info]\nScriptType: v4.00+\nPlayResX: 1080\nPlayResY: 1920\nWrapStyle: 2\nScaledBorderAndShadow: yes\n\n[V4+ Styles]\nFormat: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\nStyle: Cap,{font},{size},&H00FFFFFF,&H00FFFFFF,&H00000000,&H64000000,-1,0,0,0,100,100,0,0,1,7,0,2,100,100,{margin_v},1\n\n[Events]\nFormat: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n\"\"\"\nbgr = hi[4:6] + hi[2:4] + hi[0:2]\non, off = \"{\\\\c&H\" + bgr + \"&}\", \"{\\\\c&HFFFFFF&}\"\nevents = []\nfor i in range(0, len(words), n):\n card = words[i:i + n]\n for j, w in enumerate(card):\n end = card[j + 1][\"start\"] if j + 1 < len(card) else w[\"end\"]\n text = \" \".join(on + x[\"word\"].strip() + off if k == j else x[\"word\"].strip() for k, x in enumerate(card))\n events.append(f\"Dialogue: 0,{ts(w['start'])},{ts(end)},Cap,,0,0,0,,{text}\")\nwith open(out, \"w\", encoding=\"utf-8\") as f:\n f.write(head + \"\\n\".join(events) + \"\\n\")\n"
|
|
545
|
+
}
|
|
546
|
+
],
|
|
547
|
+
"needs": {
|
|
548
|
+
"filters": [
|
|
549
|
+
"ass"
|
|
550
|
+
]
|
|
551
|
+
},
|
|
552
|
+
"gotchas": [
|
|
553
|
+
"Safe zone on Reels, TikTok and Shorts: keep about 270 px at the top, 670 px at the bottom and 65 px at the sides free (third-party summaries of Meta's guidance; check once against an overlay).",
|
|
554
|
+
"Review the transcript text first: a burned-in typo cannot be fixed.",
|
|
555
|
+
"The fonts folder path is spliced into the filter: copy it to a simple path with no spaces or colons.",
|
|
556
|
+
"Needs ffmpeg built with libass (ffmpeg-full on a Mac; core ffmpeg has no ass filter)."
|
|
557
|
+
]
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"name": "lut-grade",
|
|
561
|
+
"description": "Apply a colour look from a .cube LUT.",
|
|
562
|
+
"params": {
|
|
563
|
+
"in": {
|
|
564
|
+
"type": "file",
|
|
565
|
+
"description": "The video to work on.",
|
|
566
|
+
"required": true
|
|
567
|
+
},
|
|
568
|
+
"out": {
|
|
569
|
+
"type": "output",
|
|
570
|
+
"description": "Where the result is written.",
|
|
571
|
+
"required": true
|
|
572
|
+
},
|
|
573
|
+
"lut": {
|
|
574
|
+
"type": "file",
|
|
575
|
+
"description": "The .cube LUT file.",
|
|
576
|
+
"required": true
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
"steps": [
|
|
580
|
+
{
|
|
581
|
+
"program": "ffmpeg",
|
|
582
|
+
"args": [
|
|
583
|
+
"-y",
|
|
584
|
+
"-i",
|
|
585
|
+
"{in}",
|
|
586
|
+
"-vf",
|
|
587
|
+
"lut3d=file={lut}:interp=tetrahedral,format=yuv420p",
|
|
588
|
+
"-c:a",
|
|
589
|
+
"copy",
|
|
590
|
+
"{out}"
|
|
591
|
+
]
|
|
592
|
+
}
|
|
593
|
+
],
|
|
594
|
+
"needs": {
|
|
595
|
+
"filters": [
|
|
596
|
+
"lut3d"
|
|
597
|
+
]
|
|
598
|
+
},
|
|
599
|
+
"gotchas": [
|
|
600
|
+
"A creative LUT expects Rec.709 input: log footage needs its camera's conversion LUT first.",
|
|
601
|
+
"The LUT path is spliced into the filter: copy it to a simple path with no spaces or colons."
|
|
602
|
+
]
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"name": "hdr-to-sdr",
|
|
606
|
+
"description": "Tone-map iPhone HDR (HLG or Dolby Vision) to SDR Rec.709, so edited footage does not look washed out or neon.",
|
|
607
|
+
"params": {
|
|
608
|
+
"in": {
|
|
609
|
+
"type": "file",
|
|
610
|
+
"description": "The video to work on.",
|
|
611
|
+
"required": true
|
|
612
|
+
},
|
|
613
|
+
"out": {
|
|
614
|
+
"type": "output",
|
|
615
|
+
"description": "Where the result is written.",
|
|
616
|
+
"required": true
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
"steps": [
|
|
620
|
+
{
|
|
621
|
+
"program": "ffmpeg",
|
|
622
|
+
"args": [
|
|
623
|
+
"-y",
|
|
624
|
+
"-i",
|
|
625
|
+
"{in}",
|
|
626
|
+
"-vf",
|
|
627
|
+
"zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p",
|
|
628
|
+
"-color_primaries",
|
|
629
|
+
"bt709",
|
|
630
|
+
"-color_trc",
|
|
631
|
+
"bt709",
|
|
632
|
+
"-colorspace",
|
|
633
|
+
"bt709",
|
|
634
|
+
"-c:a",
|
|
635
|
+
"copy",
|
|
636
|
+
"{out}"
|
|
637
|
+
]
|
|
638
|
+
}
|
|
639
|
+
],
|
|
640
|
+
"needs": {
|
|
641
|
+
"filters": [
|
|
642
|
+
"zscale",
|
|
643
|
+
"tonemap"
|
|
644
|
+
]
|
|
645
|
+
},
|
|
646
|
+
"gotchas": [
|
|
647
|
+
"Needs zscale (zimg): ffmpeg-full has it, core ffmpeg does not.",
|
|
648
|
+
"Always tag the output bt709, or it can be read as bt601."
|
|
649
|
+
]
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"name": "crossfade-join",
|
|
653
|
+
"description": "Join clips with a crossfade between each (video and audio).",
|
|
654
|
+
"params": {
|
|
655
|
+
"clips": {
|
|
656
|
+
"type": "files",
|
|
657
|
+
"description": "The clips, in order (same size, frame rate and pixel format).",
|
|
658
|
+
"required": true
|
|
659
|
+
},
|
|
660
|
+
"out": {
|
|
661
|
+
"type": "output",
|
|
662
|
+
"description": "Where the result is written.",
|
|
663
|
+
"required": true
|
|
664
|
+
},
|
|
665
|
+
"duration": {
|
|
666
|
+
"type": "number",
|
|
667
|
+
"description": "Length of each transition in seconds.",
|
|
668
|
+
"default": 0.5
|
|
669
|
+
},
|
|
670
|
+
"transition": {
|
|
671
|
+
"type": "enum",
|
|
672
|
+
"description": "The transition.",
|
|
673
|
+
"default": "fade",
|
|
674
|
+
"options": [
|
|
675
|
+
"fade",
|
|
676
|
+
"fadeblack",
|
|
677
|
+
"dissolve",
|
|
678
|
+
"wipeleft",
|
|
679
|
+
"slideup",
|
|
680
|
+
"smoothleft",
|
|
681
|
+
"circleopen",
|
|
682
|
+
"zoomin"
|
|
683
|
+
]
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
"steps": [
|
|
687
|
+
{
|
|
688
|
+
"program": "python",
|
|
689
|
+
"args": [
|
|
690
|
+
"{script:xfade.py}",
|
|
691
|
+
"{bin:ffmpeg}",
|
|
692
|
+
"{bin:ffprobe}",
|
|
693
|
+
"{out}",
|
|
694
|
+
"{duration}",
|
|
695
|
+
"{transition}",
|
|
696
|
+
"{clips}"
|
|
697
|
+
]
|
|
698
|
+
}
|
|
699
|
+
],
|
|
700
|
+
"scripts": [
|
|
701
|
+
{
|
|
702
|
+
"name": "xfade.py",
|
|
703
|
+
"sha256": "05b25f1a5013e047e2013e2635599ea49979976e8214552de8a640110c2ad9dd",
|
|
704
|
+
"source": "#!/usr/bin/env python3\n# xfade.py FFMPEG FFPROBE OUT DURATION TRANSITION CLIP1 CLIP2 [CLIP...]\n# Joins clips with a video crossfade and an audio crossfade. Every clip must share size, fps and pixel format\n# (run the normalise recipe first).\nimport subprocess, sys\nffmpeg, ffprobe, out, d, transition = sys.argv[1], sys.argv[2], sys.argv[3], float(sys.argv[4]), sys.argv[5]\nclips = sys.argv[6:]\nif len(clips) < 2:\n sys.exit(\"xfade: give at least two clips\")\ndef duration(p):\n return float(subprocess.check_output([ffprobe, \"-v\", \"error\", \"-select_streams\", \"v:0\", \"-show_entries\",\n \"stream=duration\", \"-of\", \"csv=p=0\", p]).decode().strip().split(\"\\n\")[0])\ndurs = [duration(c) for c in clips]\nparts, v, a, total = [], \"[0:v]\", \"[0:a]\", durs[0]\nfor k in range(1, len(clips)):\n off = total - d\n parts.append(f\"{v}[{k}:v]xfade=transition={transition}:duration={d}:offset={off:.3f}[v{k}]\")\n parts.append(f\"{a}[{k}:a]acrossfade=d={d}[a{k}]\")\n v, a, total = f\"[v{k}]\", f\"[a{k}]\", total + durs[k] - d\nargs = [ffmpeg, \"-y\"]\nfor c in clips:\n args += [\"-i\", c]\nargs += [\"-filter_complex\", \";\".join(parts) + f\";{v}format=yuv420p[v]\", \"-map\", \"[v]\", \"-map\", a,\n \"-c:v\", \"libx264\", \"-crf\", \"16\", \"-c:a\", \"aac\", \"-b:a\", \"192k\", out]\nsubprocess.run(args, check=True)\n"
|
|
705
|
+
}
|
|
706
|
+
],
|
|
707
|
+
"needs": {
|
|
708
|
+
"filters": [
|
|
709
|
+
"xfade",
|
|
710
|
+
"acrossfade"
|
|
711
|
+
]
|
|
712
|
+
},
|
|
713
|
+
"gotchas": [
|
|
714
|
+
"Every clip must have the same size, fps, pixel format and timebase, or xfade fails: normalise them first.",
|
|
715
|
+
"The script probes each clip's real video duration; the container's can differ by a frame or two.",
|
|
716
|
+
"Every clip needs an audio track."
|
|
717
|
+
]
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
"name": "overlay-alpha",
|
|
721
|
+
"description": "Lay an animated overlay with transparency (a title, lower third or sticker, VP9 .webm with alpha) over a video.",
|
|
722
|
+
"params": {
|
|
723
|
+
"in": {
|
|
724
|
+
"type": "file",
|
|
725
|
+
"description": "The video to work on.",
|
|
726
|
+
"required": true
|
|
727
|
+
},
|
|
728
|
+
"overlay": {
|
|
729
|
+
"type": "file",
|
|
730
|
+
"description": "The overlay: a VP9 .webm with alpha.",
|
|
731
|
+
"required": true
|
|
732
|
+
},
|
|
733
|
+
"out": {
|
|
734
|
+
"type": "output",
|
|
735
|
+
"description": "Where the result is written.",
|
|
736
|
+
"required": true
|
|
737
|
+
},
|
|
738
|
+
"x": {
|
|
739
|
+
"type": "integer",
|
|
740
|
+
"description": "Left edge of the overlay in pixels.",
|
|
741
|
+
"default": 0
|
|
742
|
+
},
|
|
743
|
+
"y": {
|
|
744
|
+
"type": "integer",
|
|
745
|
+
"description": "Top edge of the overlay in pixels.",
|
|
746
|
+
"default": 0
|
|
747
|
+
},
|
|
748
|
+
"start": {
|
|
749
|
+
"type": "number",
|
|
750
|
+
"description": "Second the overlay appears.",
|
|
751
|
+
"default": 0
|
|
752
|
+
},
|
|
753
|
+
"end": {
|
|
754
|
+
"type": "number",
|
|
755
|
+
"description": "Second the overlay disappears.",
|
|
756
|
+
"default": 86400
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
"steps": [
|
|
760
|
+
{
|
|
761
|
+
"program": "ffmpeg",
|
|
762
|
+
"args": [
|
|
763
|
+
"-y",
|
|
764
|
+
"-i",
|
|
765
|
+
"{in}",
|
|
766
|
+
"-c:v",
|
|
767
|
+
"libvpx-vp9",
|
|
768
|
+
"-i",
|
|
769
|
+
"{overlay}",
|
|
770
|
+
"-filter_complex",
|
|
771
|
+
"[0:v][1:v]overlay=x={x}:y={y}:format=auto:eof_action=pass:enable='between(t,{start},{end})',format=yuv420p[v]",
|
|
772
|
+
"-map",
|
|
773
|
+
"[v]",
|
|
774
|
+
"-map",
|
|
775
|
+
"0:a?",
|
|
776
|
+
"-c:a",
|
|
777
|
+
"copy",
|
|
778
|
+
"{out}"
|
|
779
|
+
]
|
|
780
|
+
}
|
|
781
|
+
],
|
|
782
|
+
"needs": {
|
|
783
|
+
"filters": [
|
|
784
|
+
"overlay"
|
|
785
|
+
]
|
|
786
|
+
},
|
|
787
|
+
"gotchas": [
|
|
788
|
+
"The libvpx decoder is forced on the overlay: ffmpeg's own vp9 decoder silently drops the alpha.",
|
|
789
|
+
"On 9:16, keep overlays out of the top-right and bottom platform areas."
|
|
790
|
+
]
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
"name": "background-replace",
|
|
794
|
+
"description": "Put a new background behind a person using a matte (from media-matte): fixed matte range, 1 px feather, a slightly blurred background.",
|
|
795
|
+
"params": {
|
|
796
|
+
"fg": {
|
|
797
|
+
"type": "file",
|
|
798
|
+
"description": "The person: the matte tool's foreground video, or the original take.",
|
|
799
|
+
"required": true
|
|
800
|
+
},
|
|
801
|
+
"matte": {
|
|
802
|
+
"type": "file",
|
|
803
|
+
"description": "The matte video (white = the person), same frame count and fps as fg.",
|
|
804
|
+
"required": true
|
|
805
|
+
},
|
|
806
|
+
"background": {
|
|
807
|
+
"type": "file",
|
|
808
|
+
"description": "The new background, a still image or a video (looped).",
|
|
809
|
+
"required": true
|
|
810
|
+
},
|
|
811
|
+
"audio": {
|
|
812
|
+
"type": "file",
|
|
813
|
+
"description": "The original take, for its sound.",
|
|
814
|
+
"required": true
|
|
815
|
+
},
|
|
816
|
+
"out": {
|
|
817
|
+
"type": "output",
|
|
818
|
+
"description": "Where the result is written.",
|
|
819
|
+
"required": true
|
|
820
|
+
},
|
|
821
|
+
"width": {
|
|
822
|
+
"type": "integer",
|
|
823
|
+
"description": "Output width in pixels.",
|
|
824
|
+
"default": 1080
|
|
825
|
+
},
|
|
826
|
+
"height": {
|
|
827
|
+
"type": "integer",
|
|
828
|
+
"description": "Output height in pixels.",
|
|
829
|
+
"default": 1920
|
|
830
|
+
},
|
|
831
|
+
"blur": {
|
|
832
|
+
"type": "number",
|
|
833
|
+
"description": "Background blur (gaussian sigma): a little fake depth of field.",
|
|
834
|
+
"default": 6
|
|
835
|
+
}
|
|
836
|
+
},
|
|
837
|
+
"steps": [
|
|
838
|
+
{
|
|
839
|
+
"program": "ffmpeg",
|
|
840
|
+
"args": [
|
|
841
|
+
"-y",
|
|
842
|
+
"-i",
|
|
843
|
+
"{fg}",
|
|
844
|
+
"-i",
|
|
845
|
+
"{matte}",
|
|
846
|
+
"-stream_loop",
|
|
847
|
+
"-1",
|
|
848
|
+
"-i",
|
|
849
|
+
"{background}",
|
|
850
|
+
"-i",
|
|
851
|
+
"{audio}",
|
|
852
|
+
"-filter_complex",
|
|
853
|
+
"[1:v]format=gray,scale={width}:{height},colorlevels=rimin=0.04:rimax=0.96,boxblur=1:1[m];[0:v]scale={width}:{height},format=rgba[f];[f][m]alphamerge[fa];[2:v]scale={width}:{height}:force_original_aspect_ratio=increase,crop={width}:{height},gblur=sigma={blur},eq=brightness=-0.03[bg];[bg][fa]overlay=shortest=1:format=auto,format=yuv420p[v]",
|
|
854
|
+
"-map",
|
|
855
|
+
"[v]",
|
|
856
|
+
"-map",
|
|
857
|
+
"3:a?",
|
|
858
|
+
"-c:v",
|
|
859
|
+
"libx264",
|
|
860
|
+
"-crf",
|
|
861
|
+
"16",
|
|
862
|
+
"-c:a",
|
|
863
|
+
"aac",
|
|
864
|
+
"-b:a",
|
|
865
|
+
"192k",
|
|
866
|
+
"{out}"
|
|
867
|
+
]
|
|
868
|
+
}
|
|
869
|
+
],
|
|
870
|
+
"needs": {
|
|
871
|
+
"filters": [
|
|
872
|
+
"alphamerge",
|
|
873
|
+
"colorlevels",
|
|
874
|
+
"gblur",
|
|
875
|
+
"overlay"
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
"gotchas": [
|
|
879
|
+
"A matte stored as yuv420p is limited range and never reaches pure black or white: colorlevels restores both, or the edge looks fake.",
|
|
880
|
+
"Match the background's colour temperature and brightness to the person; a sharp, bright stock background behind a softly lit person reads as fake.",
|
|
881
|
+
"Foreground and matte must come from the same source, with the same frame count and fps.",
|
|
882
|
+
"fg and matte must already have the output's shape (reframe first): they are scaled, not cropped."
|
|
883
|
+
]
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"name": "carousel-slideshow",
|
|
887
|
+
"description": "Turn carousel images into a video with a slow zoom on each (Ken Burns), with optional music.",
|
|
888
|
+
"params": {
|
|
889
|
+
"images": {
|
|
890
|
+
"type": "files",
|
|
891
|
+
"description": "The slides, in order.",
|
|
892
|
+
"required": true
|
|
893
|
+
},
|
|
894
|
+
"out": {
|
|
895
|
+
"type": "output",
|
|
896
|
+
"description": "Where the result is written.",
|
|
897
|
+
"required": true
|
|
898
|
+
},
|
|
899
|
+
"seconds": {
|
|
900
|
+
"type": "number",
|
|
901
|
+
"description": "Seconds per slide.",
|
|
902
|
+
"default": 3
|
|
903
|
+
},
|
|
904
|
+
"size": {
|
|
905
|
+
"type": "enum",
|
|
906
|
+
"description": "Output size.",
|
|
907
|
+
"default": "1080x1350",
|
|
908
|
+
"options": [
|
|
909
|
+
"1080x1350",
|
|
910
|
+
"1080x1080",
|
|
911
|
+
"1080x1920"
|
|
912
|
+
]
|
|
913
|
+
},
|
|
914
|
+
"music": {
|
|
915
|
+
"type": "file",
|
|
916
|
+
"description": "A music file, or none for a silent video.",
|
|
917
|
+
"default": "none"
|
|
918
|
+
}
|
|
919
|
+
},
|
|
920
|
+
"steps": [
|
|
921
|
+
{
|
|
922
|
+
"program": "python",
|
|
923
|
+
"args": [
|
|
924
|
+
"{script:slideshow.py}",
|
|
925
|
+
"{bin:ffmpeg}",
|
|
926
|
+
"{workdir}",
|
|
927
|
+
"{out}",
|
|
928
|
+
"{seconds}",
|
|
929
|
+
"{size}",
|
|
930
|
+
"{music}",
|
|
931
|
+
"{images}"
|
|
932
|
+
]
|
|
933
|
+
}
|
|
934
|
+
],
|
|
935
|
+
"scripts": [
|
|
936
|
+
{
|
|
937
|
+
"name": "slideshow.py",
|
|
938
|
+
"sha256": "aeb9cf2300193feedec7da0397506eaf7f7e5f286e294f33ebbc35233b5068b3",
|
|
939
|
+
"source": "#!/usr/bin/env python3\n# slideshow.py FFMPEG WORKDIR OUT SECONDS SIZE MUSIC IMAGE1 [IMAGE...]\n# A Ken Burns slideshow from carousel images (upscaled 4x first so zoompan does not jitter).\n# MUSIC is a file, or \"none\" for a silent video.\nimport os, subprocess, sys\nffmpeg, work, out, sec, size, music = sys.argv[1], sys.argv[2], sys.argv[3], float(sys.argv[4]), sys.argv[5], sys.argv[6]\nimages = sys.argv[7:]\nif not images:\n sys.exit(\"slideshow: give at least one image\")\nfps = 30\nframes = int(fps * sec)\nw = int(size.split(\"x\")[0])\nsegs = []\nfor i, img in enumerate(images):\n seg = os.path.join(work, f\"seg_{i:03d}.mp4\")\n vf = (f\"scale={w * 4}:-2,zoompan=z='min(zoom+0.0007,1.10)':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'\"\n f\":d={frames}:s={size}:fps={fps},format=yuv420p\")\n subprocess.run([ffmpeg, \"-y\", \"-loop\", \"1\", \"-i\", img, \"-vf\", vf, \"-frames:v\", str(frames), \"-c:v\", \"libx264\", \"-crf\", \"16\", seg], check=True)\n segs.append(seg)\nlst = os.path.join(work, \"slides.txt\")\nwith open(lst, \"w\") as f:\n f.writelines(f\"file '{os.path.abspath(s)}'\\n\" for s in segs)\ntotal = len(images) * sec\nargs = [ffmpeg, \"-y\", \"-f\", \"concat\", \"-safe\", \"0\", \"-i\", lst]\nif music != \"none\":\n args += [\"-i\", music, \"-filter_complex\", f\"[1:a]afade=t=out:st={max(total - 1.5, 0):.2f}:d=1.5[a]\", \"-map\", \"0:v\", \"-map\", \"[a]\",\n \"-shortest\", \"-c:a\", \"aac\", \"-b:a\", \"192k\"]\nargs += [\"-c:v\", \"copy\", \"-movflags\", \"+faststart\", out]\nsubprocess.run(args, check=True)\n"
|
|
940
|
+
}
|
|
941
|
+
],
|
|
942
|
+
"needs": {
|
|
943
|
+
"filters": [
|
|
944
|
+
"zoompan",
|
|
945
|
+
"afade"
|
|
946
|
+
]
|
|
947
|
+
},
|
|
948
|
+
"gotchas": [
|
|
949
|
+
"zoompan rounds to whole pixels and jitters: the script upscales each image 4x first.",
|
|
950
|
+
"Slides should already have the output's aspect ratio."
|
|
951
|
+
]
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
"name": "gif-export",
|
|
955
|
+
"description": "Export a short clip as a GIF with its own palette (clean, no banding).",
|
|
956
|
+
"params": {
|
|
957
|
+
"in": {
|
|
958
|
+
"type": "file",
|
|
959
|
+
"description": "The video to work on.",
|
|
960
|
+
"required": true
|
|
961
|
+
},
|
|
962
|
+
"out": {
|
|
963
|
+
"type": "output",
|
|
964
|
+
"description": "Where the result is written.",
|
|
965
|
+
"required": true
|
|
966
|
+
},
|
|
967
|
+
"fps": {
|
|
968
|
+
"type": "integer",
|
|
969
|
+
"description": "Frames per second.",
|
|
970
|
+
"default": 15
|
|
971
|
+
},
|
|
972
|
+
"width": {
|
|
973
|
+
"type": "integer",
|
|
974
|
+
"description": "Width in pixels.",
|
|
975
|
+
"default": 720
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
"steps": [
|
|
979
|
+
{
|
|
980
|
+
"program": "ffmpeg",
|
|
981
|
+
"args": [
|
|
982
|
+
"-y",
|
|
983
|
+
"-i",
|
|
984
|
+
"{in}",
|
|
985
|
+
"-vf",
|
|
986
|
+
"fps={fps},scale={width}:-1:flags=lanczos,split[a][b];[a]palettegen=max_colors=128:stats_mode=diff[p];[b][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle",
|
|
987
|
+
"-loop",
|
|
988
|
+
"0",
|
|
989
|
+
"{out}"
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
],
|
|
993
|
+
"needs": {
|
|
994
|
+
"filters": [
|
|
995
|
+
"palettegen",
|
|
996
|
+
"paletteuse"
|
|
997
|
+
]
|
|
998
|
+
},
|
|
999
|
+
"gotchas": [
|
|
1000
|
+
"Keep GIFs short and small: size grows fast with width and fps."
|
|
1001
|
+
]
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
"name": "webp-export",
|
|
1005
|
+
"description": "Export a short clip as an animated WebP (smaller than a GIF).",
|
|
1006
|
+
"params": {
|
|
1007
|
+
"in": {
|
|
1008
|
+
"type": "file",
|
|
1009
|
+
"description": "The video to work on.",
|
|
1010
|
+
"required": true
|
|
1011
|
+
},
|
|
1012
|
+
"out": {
|
|
1013
|
+
"type": "output",
|
|
1014
|
+
"description": "Where the result is written.",
|
|
1015
|
+
"required": true
|
|
1016
|
+
},
|
|
1017
|
+
"fps": {
|
|
1018
|
+
"type": "integer",
|
|
1019
|
+
"description": "Frames per second.",
|
|
1020
|
+
"default": 20
|
|
1021
|
+
},
|
|
1022
|
+
"width": {
|
|
1023
|
+
"type": "integer",
|
|
1024
|
+
"description": "Width in pixels.",
|
|
1025
|
+
"default": 720
|
|
1026
|
+
}
|
|
1027
|
+
},
|
|
1028
|
+
"steps": [
|
|
1029
|
+
{
|
|
1030
|
+
"program": "ffmpeg",
|
|
1031
|
+
"args": [
|
|
1032
|
+
"-y",
|
|
1033
|
+
"-i",
|
|
1034
|
+
"{in}",
|
|
1035
|
+
"-vf",
|
|
1036
|
+
"fps={fps},scale={width}:-1:flags=lanczos",
|
|
1037
|
+
"-c:v",
|
|
1038
|
+
"libwebp_anim",
|
|
1039
|
+
"-lossless",
|
|
1040
|
+
"0",
|
|
1041
|
+
"-q:v",
|
|
1042
|
+
"70",
|
|
1043
|
+
"-loop",
|
|
1044
|
+
"0",
|
|
1045
|
+
"{out}"
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
],
|
|
1049
|
+
"needs": {
|
|
1050
|
+
"encoders": [
|
|
1051
|
+
"libwebp_anim"
|
|
1052
|
+
]
|
|
1053
|
+
},
|
|
1054
|
+
"gotchas": [
|
|
1055
|
+
"Needs ffmpeg built with libwebp (check ffmpeg -encoders)."
|
|
1056
|
+
]
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
"name": "keyframes",
|
|
1060
|
+
"description": "Pull every keyframe of a video as JPEGs (fast; good for picking a thumbnail).",
|
|
1061
|
+
"params": {
|
|
1062
|
+
"in": {
|
|
1063
|
+
"type": "file",
|
|
1064
|
+
"description": "The video to work on.",
|
|
1065
|
+
"required": true
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
"steps": [
|
|
1069
|
+
{
|
|
1070
|
+
"program": "ffmpeg",
|
|
1071
|
+
"args": [
|
|
1072
|
+
"-skip_frame",
|
|
1073
|
+
"nokey",
|
|
1074
|
+
"-i",
|
|
1075
|
+
"{in}",
|
|
1076
|
+
"-fps_mode",
|
|
1077
|
+
"vfr",
|
|
1078
|
+
"-q:v",
|
|
1079
|
+
"3",
|
|
1080
|
+
"{workdir}/key_%04d.jpg"
|
|
1081
|
+
]
|
|
1082
|
+
}
|
|
1083
|
+
],
|
|
1084
|
+
"gotchas": [
|
|
1085
|
+
"The frames land in the run's folder as key_0001.jpg, key_0002.jpg…",
|
|
1086
|
+
"-vsync is deprecated: -fps_mode is used."
|
|
1087
|
+
]
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
"name": "contact-sheet",
|
|
1091
|
+
"description": "One image showing a grid of frames sampled across the video.",
|
|
1092
|
+
"params": {
|
|
1093
|
+
"in": {
|
|
1094
|
+
"type": "file",
|
|
1095
|
+
"description": "The video to work on.",
|
|
1096
|
+
"required": true
|
|
1097
|
+
},
|
|
1098
|
+
"out": {
|
|
1099
|
+
"type": "output",
|
|
1100
|
+
"description": "Where the result is written.",
|
|
1101
|
+
"required": true
|
|
1102
|
+
},
|
|
1103
|
+
"interval": {
|
|
1104
|
+
"type": "number",
|
|
1105
|
+
"description": "Seconds between sampled frames.",
|
|
1106
|
+
"default": 10
|
|
1107
|
+
},
|
|
1108
|
+
"columns": {
|
|
1109
|
+
"type": "integer",
|
|
1110
|
+
"description": "Frames per row.",
|
|
1111
|
+
"default": 5
|
|
1112
|
+
},
|
|
1113
|
+
"rows": {
|
|
1114
|
+
"type": "integer",
|
|
1115
|
+
"description": "Rows.",
|
|
1116
|
+
"default": 4
|
|
1117
|
+
}
|
|
1118
|
+
},
|
|
1119
|
+
"steps": [
|
|
1120
|
+
{
|
|
1121
|
+
"program": "ffmpeg",
|
|
1122
|
+
"args": [
|
|
1123
|
+
"-y",
|
|
1124
|
+
"-i",
|
|
1125
|
+
"{in}",
|
|
1126
|
+
"-vf",
|
|
1127
|
+
"fps=1/{interval},scale=320:-2,tile={columns}x{rows}:padding=8:margin=8:color=white",
|
|
1128
|
+
"-frames:v",
|
|
1129
|
+
"1",
|
|
1130
|
+
"{out}"
|
|
1131
|
+
]
|
|
1132
|
+
}
|
|
1133
|
+
],
|
|
1134
|
+
"needs": {
|
|
1135
|
+
"filters": [
|
|
1136
|
+
"tile"
|
|
1137
|
+
]
|
|
1138
|
+
},
|
|
1139
|
+
"gotchas": [
|
|
1140
|
+
"Pick the interval from the length: a 10-minute video with 20 tiles wants 30 s."
|
|
1141
|
+
]
|
|
1142
|
+
},
|
|
1143
|
+
{
|
|
1144
|
+
"name": "audio-extract",
|
|
1145
|
+
"description": "Extract the sound as 16 kHz mono WAV, the input transcription wants.",
|
|
1146
|
+
"params": {
|
|
1147
|
+
"in": {
|
|
1148
|
+
"type": "file",
|
|
1149
|
+
"description": "The video to work on.",
|
|
1150
|
+
"required": true
|
|
1151
|
+
},
|
|
1152
|
+
"out": {
|
|
1153
|
+
"type": "output",
|
|
1154
|
+
"description": "Where the result is written.",
|
|
1155
|
+
"required": true
|
|
1156
|
+
}
|
|
1157
|
+
},
|
|
1158
|
+
"steps": [
|
|
1159
|
+
{
|
|
1160
|
+
"program": "ffmpeg",
|
|
1161
|
+
"args": [
|
|
1162
|
+
"-y",
|
|
1163
|
+
"-i",
|
|
1164
|
+
"{in}",
|
|
1165
|
+
"-vn",
|
|
1166
|
+
"-ac",
|
|
1167
|
+
"1",
|
|
1168
|
+
"-ar",
|
|
1169
|
+
"16000",
|
|
1170
|
+
"-c:a",
|
|
1171
|
+
"pcm_s16le",
|
|
1172
|
+
"{out}"
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
],
|
|
1176
|
+
"gotchas": [
|
|
1177
|
+
"Do not normalise loudness here: whisper does not need it."
|
|
1178
|
+
]
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
"name": "export-reels",
|
|
1182
|
+
"description": "Final export for Instagram Reels, TikTok and YouTube Shorts (1080x1920, 30 fps).",
|
|
1183
|
+
"params": {
|
|
1184
|
+
"in": {
|
|
1185
|
+
"type": "file",
|
|
1186
|
+
"description": "The video to work on.",
|
|
1187
|
+
"required": true
|
|
1188
|
+
},
|
|
1189
|
+
"out": {
|
|
1190
|
+
"type": "output",
|
|
1191
|
+
"description": "Where the result is written.",
|
|
1192
|
+
"required": true
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
"steps": [
|
|
1196
|
+
{
|
|
1197
|
+
"program": "ffmpeg",
|
|
1198
|
+
"args": [
|
|
1199
|
+
"-y",
|
|
1200
|
+
"-i",
|
|
1201
|
+
"{in}",
|
|
1202
|
+
"-c:v",
|
|
1203
|
+
"libx264",
|
|
1204
|
+
"-profile:v",
|
|
1205
|
+
"high",
|
|
1206
|
+
"-pix_fmt",
|
|
1207
|
+
"yuv420p",
|
|
1208
|
+
"-preset",
|
|
1209
|
+
"slow",
|
|
1210
|
+
"-color_primaries",
|
|
1211
|
+
"bt709",
|
|
1212
|
+
"-color_trc",
|
|
1213
|
+
"bt709",
|
|
1214
|
+
"-colorspace",
|
|
1215
|
+
"bt709",
|
|
1216
|
+
"-r",
|
|
1217
|
+
"30",
|
|
1218
|
+
"-g",
|
|
1219
|
+
"60",
|
|
1220
|
+
"-crf",
|
|
1221
|
+
"19",
|
|
1222
|
+
"-maxrate",
|
|
1223
|
+
"15M",
|
|
1224
|
+
"-bufsize",
|
|
1225
|
+
"30M",
|
|
1226
|
+
"-c:a",
|
|
1227
|
+
"aac",
|
|
1228
|
+
"-ar",
|
|
1229
|
+
"48000",
|
|
1230
|
+
"-ac",
|
|
1231
|
+
"2",
|
|
1232
|
+
"-b:a",
|
|
1233
|
+
"192k",
|
|
1234
|
+
"-movflags",
|
|
1235
|
+
"+faststart",
|
|
1236
|
+
"{out}"
|
|
1237
|
+
]
|
|
1238
|
+
}
|
|
1239
|
+
],
|
|
1240
|
+
"gotchas": [
|
|
1241
|
+
"A bitrate above the platform's own ladder gains nothing: the platform transcodes again.",
|
|
1242
|
+
"Keep the source frame rate unless the platform caps it: 25 fps footage forced to 30 fps judders.",
|
|
1243
|
+
"Instagram and TikTok publish no primary spec: 1080x1920 H.264 + AAC at 30 fps is what third-party guides agree on."
|
|
1244
|
+
]
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
"name": "export-youtube-1080",
|
|
1248
|
+
"description": "Final export for YouTube at 1080p (keeps the source frame rate).",
|
|
1249
|
+
"params": {
|
|
1250
|
+
"in": {
|
|
1251
|
+
"type": "file",
|
|
1252
|
+
"description": "The video to work on.",
|
|
1253
|
+
"required": true
|
|
1254
|
+
},
|
|
1255
|
+
"out": {
|
|
1256
|
+
"type": "output",
|
|
1257
|
+
"description": "Where the result is written.",
|
|
1258
|
+
"required": true
|
|
1259
|
+
}
|
|
1260
|
+
},
|
|
1261
|
+
"steps": [
|
|
1262
|
+
{
|
|
1263
|
+
"program": "ffmpeg",
|
|
1264
|
+
"args": [
|
|
1265
|
+
"-y",
|
|
1266
|
+
"-i",
|
|
1267
|
+
"{in}",
|
|
1268
|
+
"-c:v",
|
|
1269
|
+
"libx264",
|
|
1270
|
+
"-profile:v",
|
|
1271
|
+
"high",
|
|
1272
|
+
"-pix_fmt",
|
|
1273
|
+
"yuv420p",
|
|
1274
|
+
"-preset",
|
|
1275
|
+
"slow",
|
|
1276
|
+
"-color_primaries",
|
|
1277
|
+
"bt709",
|
|
1278
|
+
"-color_trc",
|
|
1279
|
+
"bt709",
|
|
1280
|
+
"-colorspace",
|
|
1281
|
+
"bt709",
|
|
1282
|
+
"-bf",
|
|
1283
|
+
"2",
|
|
1284
|
+
"-g",
|
|
1285
|
+
"15",
|
|
1286
|
+
"-crf",
|
|
1287
|
+
"18",
|
|
1288
|
+
"-maxrate",
|
|
1289
|
+
"10M",
|
|
1290
|
+
"-bufsize",
|
|
1291
|
+
"20M",
|
|
1292
|
+
"-c:a",
|
|
1293
|
+
"aac",
|
|
1294
|
+
"-ar",
|
|
1295
|
+
"48000",
|
|
1296
|
+
"-ac",
|
|
1297
|
+
"2",
|
|
1298
|
+
"-b:a",
|
|
1299
|
+
"384k",
|
|
1300
|
+
"-movflags",
|
|
1301
|
+
"+faststart",
|
|
1302
|
+
"{out}"
|
|
1303
|
+
]
|
|
1304
|
+
}
|
|
1305
|
+
],
|
|
1306
|
+
"gotchas": [
|
|
1307
|
+
"A bitrate above the platform's own ladder gains nothing: the platform transcodes again.",
|
|
1308
|
+
"Keep the source frame rate unless the platform caps it: 25 fps footage forced to 30 fps judders.",
|
|
1309
|
+
"For 60 fps footage, YouTube's guidance wants a GOP of 30 and about 15 Mbps."
|
|
1310
|
+
]
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
"name": "export-youtube-4k",
|
|
1314
|
+
"description": "Final export for YouTube at 4K (3840x2160).",
|
|
1315
|
+
"params": {
|
|
1316
|
+
"in": {
|
|
1317
|
+
"type": "file",
|
|
1318
|
+
"description": "The video to work on.",
|
|
1319
|
+
"required": true
|
|
1320
|
+
},
|
|
1321
|
+
"out": {
|
|
1322
|
+
"type": "output",
|
|
1323
|
+
"description": "Where the result is written.",
|
|
1324
|
+
"required": true
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
"steps": [
|
|
1328
|
+
{
|
|
1329
|
+
"program": "ffmpeg",
|
|
1330
|
+
"args": [
|
|
1331
|
+
"-y",
|
|
1332
|
+
"-i",
|
|
1333
|
+
"{in}",
|
|
1334
|
+
"-c:v",
|
|
1335
|
+
"libx264",
|
|
1336
|
+
"-profile:v",
|
|
1337
|
+
"high",
|
|
1338
|
+
"-pix_fmt",
|
|
1339
|
+
"yuv420p",
|
|
1340
|
+
"-preset",
|
|
1341
|
+
"slow",
|
|
1342
|
+
"-color_primaries",
|
|
1343
|
+
"bt709",
|
|
1344
|
+
"-color_trc",
|
|
1345
|
+
"bt709",
|
|
1346
|
+
"-colorspace",
|
|
1347
|
+
"bt709",
|
|
1348
|
+
"-bf",
|
|
1349
|
+
"2",
|
|
1350
|
+
"-g",
|
|
1351
|
+
"15",
|
|
1352
|
+
"-crf",
|
|
1353
|
+
"18",
|
|
1354
|
+
"-maxrate",
|
|
1355
|
+
"45M",
|
|
1356
|
+
"-bufsize",
|
|
1357
|
+
"90M",
|
|
1358
|
+
"-c:a",
|
|
1359
|
+
"aac",
|
|
1360
|
+
"-ar",
|
|
1361
|
+
"48000",
|
|
1362
|
+
"-ac",
|
|
1363
|
+
"2",
|
|
1364
|
+
"-b:a",
|
|
1365
|
+
"384k",
|
|
1366
|
+
"-movflags",
|
|
1367
|
+
"+faststart",
|
|
1368
|
+
"{out}"
|
|
1369
|
+
]
|
|
1370
|
+
}
|
|
1371
|
+
],
|
|
1372
|
+
"gotchas": [
|
|
1373
|
+
"A bitrate above the platform's own ladder gains nothing: the platform transcodes again.",
|
|
1374
|
+
"Keep the source frame rate unless the platform caps it: 25 fps footage forced to 30 fps judders.",
|
|
1375
|
+
"The source must already be 3840x2160."
|
|
1376
|
+
]
|
|
1377
|
+
},
|
|
1378
|
+
{
|
|
1379
|
+
"name": "export-linkedin",
|
|
1380
|
+
"description": "Final export for LinkedIn (30 fps at most).",
|
|
1381
|
+
"params": {
|
|
1382
|
+
"in": {
|
|
1383
|
+
"type": "file",
|
|
1384
|
+
"description": "The video to work on.",
|
|
1385
|
+
"required": true
|
|
1386
|
+
},
|
|
1387
|
+
"out": {
|
|
1388
|
+
"type": "output",
|
|
1389
|
+
"description": "Where the result is written.",
|
|
1390
|
+
"required": true
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
"steps": [
|
|
1394
|
+
{
|
|
1395
|
+
"program": "ffmpeg",
|
|
1396
|
+
"args": [
|
|
1397
|
+
"-y",
|
|
1398
|
+
"-i",
|
|
1399
|
+
"{in}",
|
|
1400
|
+
"-c:v",
|
|
1401
|
+
"libx264",
|
|
1402
|
+
"-profile:v",
|
|
1403
|
+
"high",
|
|
1404
|
+
"-pix_fmt",
|
|
1405
|
+
"yuv420p",
|
|
1406
|
+
"-preset",
|
|
1407
|
+
"slow",
|
|
1408
|
+
"-color_primaries",
|
|
1409
|
+
"bt709",
|
|
1410
|
+
"-color_trc",
|
|
1411
|
+
"bt709",
|
|
1412
|
+
"-colorspace",
|
|
1413
|
+
"bt709",
|
|
1414
|
+
"-r",
|
|
1415
|
+
"30",
|
|
1416
|
+
"-g",
|
|
1417
|
+
"60",
|
|
1418
|
+
"-crf",
|
|
1419
|
+
"20",
|
|
1420
|
+
"-maxrate",
|
|
1421
|
+
"10M",
|
|
1422
|
+
"-bufsize",
|
|
1423
|
+
"20M",
|
|
1424
|
+
"-c:a",
|
|
1425
|
+
"aac",
|
|
1426
|
+
"-ar",
|
|
1427
|
+
"48000",
|
|
1428
|
+
"-ac",
|
|
1429
|
+
"2",
|
|
1430
|
+
"-b:a",
|
|
1431
|
+
"192k",
|
|
1432
|
+
"-movflags",
|
|
1433
|
+
"+faststart",
|
|
1434
|
+
"{out}"
|
|
1435
|
+
]
|
|
1436
|
+
}
|
|
1437
|
+
],
|
|
1438
|
+
"gotchas": [
|
|
1439
|
+
"A bitrate above the platform's own ladder gains nothing: the platform transcodes again.",
|
|
1440
|
+
"Keep the source frame rate unless the platform caps it: 25 fps footage forced to 30 fps judders.",
|
|
1441
|
+
"LinkedIn caps video at 30 fps."
|
|
1442
|
+
]
|
|
1443
|
+
}
|
|
1444
|
+
],
|
|
1445
|
+
"skills": [
|
|
1446
|
+
{
|
|
1447
|
+
"name": "run-ffmpeg-recipe",
|
|
1448
|
+
"kind": "instruction",
|
|
1449
|
+
"scope": "pod",
|
|
1450
|
+
"description": "How to run one of this capability's ffmpeg recipes on the computer that has it: check the tool, fill the params, run the steps with the pinned ffmpeg.",
|
|
1451
|
+
"code": "# Run an ffmpeg recipe on this computer\n\nThis capability is ffmpeg, installed and checked on a computer, plus a library of named recipes (spec.recipes). Use a recipe instead of writing an ffmpeg command: each one carries the settings that avoid the usual mistakes (colour range, loudness, safe zones, pixel format).\n\n1. Check the tool is here: `synap tools verify media-ffmpeg`. If it is not installed, ask the person before installing (`synap tools install media-ffmpeg`).\n2. Pick the recipe by name. Read its `gotchas` before you run it.\n3. Fill its `params`: every required one, and change a default only for a reason you can say.\n4. Run its `steps` in order, in one scratch folder (`{workdir}`), with the ffmpeg this capability pinned (`install.<os>.bins`), never whichever ffmpeg is first on PATH. A `python` step runs the recipe's helper script, written to disk only if its sha256 matches.\n5. If the recipe lists `needs`, check them first: `ffmpeg -hide_banner -filters` must show each filter, `ffmpeg -hide_banner -encoders` each encoder.\n\nWork in intermediates at high quality (`-crf 12 -preset veryfast` or ProRes) and encode for a platform once, at the end, with an `export-*` recipe.\n\nA typical Reel from a landscape talking-head take: audio-extract, then transcribe (media-transcribe); silence-cut, then transcribe again; reframe-crop; lut-grade; captions-burn-in; loudness-normalize; export-reels.\n"
|
|
1452
|
+
}
|
|
1453
|
+
],
|
|
1454
|
+
"provides": []
|
|
1455
|
+
}
|
|
1456
|
+
}
|