cerevox 1.2.5 → 1.3.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/dist/mcp/servers/helper/doubao_voices_full.d.ts +18 -0
- package/dist/mcp/servers/helper/doubao_voices_full.d.ts.map +1 -0
- package/dist/mcp/servers/helper/doubao_voices_full.js +1399 -0
- package/dist/mcp/servers/helper/doubao_voices_full.js.map +1 -0
- package/dist/mcp/servers/prompts/zerocut-guideline.md +31 -31
- package/dist/mcp/servers/zerocut.d.ts.map +1 -1
- package/dist/mcp/servers/zerocut.js +94 -37
- package/dist/mcp/servers/zerocut.js.map +1 -1
- package/dist/utils/videokit.d.ts +46 -23
- package/dist/utils/videokit.d.ts.map +1 -1
- package/dist/utils/videokit.js +299 -16
- package/dist/utils/videokit.js.map +1 -1
- package/dist/utils/videoproject-schema.json +80 -2
- package/package.json +1 -1
package/dist/utils/videokit.d.ts
CHANGED
|
@@ -29,8 +29,9 @@ export interface Effect {
|
|
|
29
29
|
params?: Record<string, unknown>;
|
|
30
30
|
}
|
|
31
31
|
export interface TransitionDef {
|
|
32
|
-
name:
|
|
32
|
+
name: 'xfade' | 'fade' | 'wipeleft' | 'wiperight' | 'wipeup' | 'wipedown' | 'slideleft' | 'slideright' | 'slideup' | 'slidedown' | 'circlecrop' | 'rectcrop' | 'distance' | 'fadeblack' | 'fadewhite' | 'radial' | 'smoothleft' | 'smoothright' | 'smoothup' | 'smoothdown' | 'circleopen' | 'circleclose' | 'vertopen' | 'vertclose' | 'horzopen' | 'horzclose' | 'dissolve' | 'pixelize' | 'diagtl' | 'diagtr' | 'diagbl' | 'diagbr';
|
|
33
33
|
durationMs: number;
|
|
34
|
+
params?: Record<string, unknown>;
|
|
34
35
|
}
|
|
35
36
|
export interface Transform {
|
|
36
37
|
scale?: number;
|
|
@@ -245,24 +246,30 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
245
246
|
params?: Record<string, unknown> | undefined;
|
|
246
247
|
}>, "many">>;
|
|
247
248
|
transitionIn: z.ZodOptional<z.ZodObject<{
|
|
248
|
-
name: z.
|
|
249
|
+
name: z.ZodEnum<["xfade", "fade", "wipeleft", "wiperight", "wipeup", "wipedown", "slideleft", "slideright", "slideup", "slidedown", "circlecrop", "rectcrop", "distance", "fadeblack", "fadewhite", "radial", "smoothleft", "smoothright", "smoothup", "smoothdown", "circleopen", "circleclose", "vertopen", "vertclose", "horzopen", "horzclose", "dissolve", "pixelize", "diagtl", "diagtr", "diagbl", "diagbr"]>;
|
|
249
250
|
durationMs: z.ZodNumber;
|
|
251
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
250
252
|
}, "strip", z.ZodTypeAny, {
|
|
251
|
-
name:
|
|
253
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
252
254
|
durationMs: number;
|
|
255
|
+
params?: Record<string, unknown> | undefined;
|
|
253
256
|
}, {
|
|
254
|
-
name:
|
|
257
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
255
258
|
durationMs: number;
|
|
259
|
+
params?: Record<string, unknown> | undefined;
|
|
256
260
|
}>>;
|
|
257
261
|
transitionOut: z.ZodOptional<z.ZodObject<{
|
|
258
|
-
name: z.
|
|
262
|
+
name: z.ZodEnum<["xfade", "fade", "wipeleft", "wiperight", "wipeup", "wipedown", "slideleft", "slideright", "slideup", "slidedown", "circlecrop", "rectcrop", "distance", "fadeblack", "fadewhite", "radial", "smoothleft", "smoothright", "smoothup", "smoothdown", "circleopen", "circleclose", "vertopen", "vertclose", "horzopen", "horzclose", "dissolve", "pixelize", "diagtl", "diagtr", "diagbl", "diagbr"]>;
|
|
259
263
|
durationMs: z.ZodNumber;
|
|
264
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
260
265
|
}, "strip", z.ZodTypeAny, {
|
|
261
|
-
name:
|
|
266
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
262
267
|
durationMs: number;
|
|
268
|
+
params?: Record<string, unknown> | undefined;
|
|
263
269
|
}, {
|
|
264
|
-
name:
|
|
270
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
265
271
|
durationMs: number;
|
|
272
|
+
params?: Record<string, unknown> | undefined;
|
|
266
273
|
}>>;
|
|
267
274
|
}, "strip", z.ZodTypeAny, {
|
|
268
275
|
id: string;
|
|
@@ -286,12 +293,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
286
293
|
params?: Record<string, unknown> | undefined;
|
|
287
294
|
}[] | undefined;
|
|
288
295
|
transitionIn?: {
|
|
289
|
-
name:
|
|
296
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
290
297
|
durationMs: number;
|
|
298
|
+
params?: Record<string, unknown> | undefined;
|
|
291
299
|
} | undefined;
|
|
292
300
|
transitionOut?: {
|
|
293
|
-
name:
|
|
301
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
294
302
|
durationMs: number;
|
|
303
|
+
params?: Record<string, unknown> | undefined;
|
|
295
304
|
} | undefined;
|
|
296
305
|
}, {
|
|
297
306
|
id: string;
|
|
@@ -315,12 +324,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
315
324
|
params?: Record<string, unknown> | undefined;
|
|
316
325
|
}[] | undefined;
|
|
317
326
|
transitionIn?: {
|
|
318
|
-
name:
|
|
327
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
319
328
|
durationMs: number;
|
|
329
|
+
params?: Record<string, unknown> | undefined;
|
|
320
330
|
} | undefined;
|
|
321
331
|
transitionOut?: {
|
|
322
|
-
name:
|
|
332
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
323
333
|
durationMs: number;
|
|
334
|
+
params?: Record<string, unknown> | undefined;
|
|
324
335
|
} | undefined;
|
|
325
336
|
}>, "many">;
|
|
326
337
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -348,12 +359,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
348
359
|
params?: Record<string, unknown> | undefined;
|
|
349
360
|
}[] | undefined;
|
|
350
361
|
transitionIn?: {
|
|
351
|
-
name:
|
|
362
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
352
363
|
durationMs: number;
|
|
364
|
+
params?: Record<string, unknown> | undefined;
|
|
353
365
|
} | undefined;
|
|
354
366
|
transitionOut?: {
|
|
355
|
-
name:
|
|
367
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
356
368
|
durationMs: number;
|
|
369
|
+
params?: Record<string, unknown> | undefined;
|
|
357
370
|
} | undefined;
|
|
358
371
|
}[];
|
|
359
372
|
muted?: boolean | undefined;
|
|
@@ -383,12 +396,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
383
396
|
params?: Record<string, unknown> | undefined;
|
|
384
397
|
}[] | undefined;
|
|
385
398
|
transitionIn?: {
|
|
386
|
-
name:
|
|
399
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
387
400
|
durationMs: number;
|
|
401
|
+
params?: Record<string, unknown> | undefined;
|
|
388
402
|
} | undefined;
|
|
389
403
|
transitionOut?: {
|
|
390
|
-
name:
|
|
404
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
391
405
|
durationMs: number;
|
|
406
|
+
params?: Record<string, unknown> | undefined;
|
|
392
407
|
} | undefined;
|
|
393
408
|
}[];
|
|
394
409
|
muted?: boolean | undefined;
|
|
@@ -494,12 +509,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
494
509
|
params?: Record<string, unknown> | undefined;
|
|
495
510
|
}[] | undefined;
|
|
496
511
|
transitionIn?: {
|
|
497
|
-
name:
|
|
512
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
498
513
|
durationMs: number;
|
|
514
|
+
params?: Record<string, unknown> | undefined;
|
|
499
515
|
} | undefined;
|
|
500
516
|
transitionOut?: {
|
|
501
|
-
name:
|
|
517
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
502
518
|
durationMs: number;
|
|
519
|
+
params?: Record<string, unknown> | undefined;
|
|
503
520
|
} | undefined;
|
|
504
521
|
}[];
|
|
505
522
|
muted?: boolean | undefined;
|
|
@@ -545,12 +562,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
545
562
|
params?: Record<string, unknown> | undefined;
|
|
546
563
|
}[] | undefined;
|
|
547
564
|
transitionIn?: {
|
|
548
|
-
name:
|
|
565
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
549
566
|
durationMs: number;
|
|
567
|
+
params?: Record<string, unknown> | undefined;
|
|
550
568
|
} | undefined;
|
|
551
569
|
transitionOut?: {
|
|
552
|
-
name:
|
|
570
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
553
571
|
durationMs: number;
|
|
572
|
+
params?: Record<string, unknown> | undefined;
|
|
554
573
|
} | undefined;
|
|
555
574
|
}[];
|
|
556
575
|
muted?: boolean | undefined;
|
|
@@ -739,12 +758,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
739
758
|
params?: Record<string, unknown> | undefined;
|
|
740
759
|
}[] | undefined;
|
|
741
760
|
transitionIn?: {
|
|
742
|
-
name:
|
|
761
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
743
762
|
durationMs: number;
|
|
763
|
+
params?: Record<string, unknown> | undefined;
|
|
744
764
|
} | undefined;
|
|
745
765
|
transitionOut?: {
|
|
746
|
-
name:
|
|
766
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
747
767
|
durationMs: number;
|
|
768
|
+
params?: Record<string, unknown> | undefined;
|
|
748
769
|
} | undefined;
|
|
749
770
|
}[];
|
|
750
771
|
muted?: boolean | undefined;
|
|
@@ -845,12 +866,14 @@ export declare const zVideoProject: z.ZodObject<{
|
|
|
845
866
|
params?: Record<string, unknown> | undefined;
|
|
846
867
|
}[] | undefined;
|
|
847
868
|
transitionIn?: {
|
|
848
|
-
name:
|
|
869
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
849
870
|
durationMs: number;
|
|
871
|
+
params?: Record<string, unknown> | undefined;
|
|
850
872
|
} | undefined;
|
|
851
873
|
transitionOut?: {
|
|
852
|
-
name:
|
|
874
|
+
name: "xfade" | "fade" | "wipeleft" | "wiperight" | "wipeup" | "wipedown" | "slideleft" | "slideright" | "slideup" | "slidedown" | "circlecrop" | "rectcrop" | "distance" | "fadeblack" | "fadewhite" | "radial" | "smoothleft" | "smoothright" | "smoothup" | "smoothdown" | "circleopen" | "circleclose" | "vertopen" | "vertclose" | "horzopen" | "horzclose" | "dissolve" | "pixelize" | "diagtl" | "diagtr" | "diagbl" | "diagbr";
|
|
853
875
|
durationMs: number;
|
|
876
|
+
params?: Record<string, unknown> | undefined;
|
|
854
877
|
} | undefined;
|
|
855
878
|
}[];
|
|
856
879
|
muted?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videokit.d.ts","sourceRoot":"","sources":["../../src/utils/videokit.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AACD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AACpD,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;AAEvD,MAAM,WAAW,MAAM;IACrB,IAAI,EACA,QAAQ,GACR,SAAS,GACT,MAAM,GACN,MAAM,GACN,OAAO,GACP,OAAO,GACP,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,
|
|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CAMpD;AAED,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,UAAU,GACV,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,GACnB,oBAAoB,GACpB,sBAAsB,GACtB,uBAAuB,GACvB,QAAQ,GACR,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,CAAC;AAEb,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,aAAa,GAAE,YAAwB,EACvC,IAAI,CAAC,EAAE;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAAC,MAAM,CAAC,CA8MjB"}
|
package/dist/utils/videokit.js
CHANGED
|
@@ -71,8 +71,42 @@ const zEffect = zod_1.z.object({
|
|
|
71
71
|
params: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
72
72
|
});
|
|
73
73
|
const zTransition = zod_1.z.object({
|
|
74
|
-
name: zod_1.z.
|
|
74
|
+
name: zod_1.z.enum([
|
|
75
|
+
'xfade',
|
|
76
|
+
'fade',
|
|
77
|
+
'wipeleft',
|
|
78
|
+
'wiperight',
|
|
79
|
+
'wipeup',
|
|
80
|
+
'wipedown',
|
|
81
|
+
'slideleft',
|
|
82
|
+
'slideright',
|
|
83
|
+
'slideup',
|
|
84
|
+
'slidedown',
|
|
85
|
+
'circlecrop',
|
|
86
|
+
'rectcrop',
|
|
87
|
+
'distance',
|
|
88
|
+
'fadeblack',
|
|
89
|
+
'fadewhite',
|
|
90
|
+
'radial',
|
|
91
|
+
'smoothleft',
|
|
92
|
+
'smoothright',
|
|
93
|
+
'smoothup',
|
|
94
|
+
'smoothdown',
|
|
95
|
+
'circleopen',
|
|
96
|
+
'circleclose',
|
|
97
|
+
'vertopen',
|
|
98
|
+
'vertclose',
|
|
99
|
+
'horzopen',
|
|
100
|
+
'horzclose',
|
|
101
|
+
'dissolve',
|
|
102
|
+
'pixelize',
|
|
103
|
+
'diagtl',
|
|
104
|
+
'diagtr',
|
|
105
|
+
'diagbl',
|
|
106
|
+
'diagbr',
|
|
107
|
+
]),
|
|
75
108
|
durationMs: zod_1.z.number().int().min(1),
|
|
109
|
+
params: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
76
110
|
});
|
|
77
111
|
const zTransform = zod_1.z.object({
|
|
78
112
|
scale: zod_1.z.number().optional(),
|
|
@@ -266,6 +300,132 @@ function hasLibass(ffmpegBin = 'ffmpeg') {
|
|
|
266
300
|
return false;
|
|
267
301
|
}
|
|
268
302
|
}
|
|
303
|
+
// Helper function to apply video transitions using xfade
|
|
304
|
+
function applyVideoTransitions(track, clipOuts, newLabel, fg, project) {
|
|
305
|
+
if (clipOuts.length <= 1)
|
|
306
|
+
return clipOuts;
|
|
307
|
+
let currentOut = clipOuts[0];
|
|
308
|
+
for (let i = 1; i < clipOuts.length; i++) {
|
|
309
|
+
const currentClip = track.clips[i];
|
|
310
|
+
const prevClip = track.clips[i - 1];
|
|
311
|
+
// Handle compound transitions: both transitionOut and transitionIn can exist
|
|
312
|
+
const hasTransitionOut = prevClip.transitionOut;
|
|
313
|
+
const hasTransitionIn = currentClip.transitionIn;
|
|
314
|
+
if (hasTransitionOut && hasTransitionIn) {
|
|
315
|
+
// Compound transition: apply both effects
|
|
316
|
+
const outDuration = hasTransitionOut.durationMs / 1000;
|
|
317
|
+
const inDuration = hasTransitionIn.durationMs / 1000;
|
|
318
|
+
const maxDuration = Math.max(outDuration, inDuration);
|
|
319
|
+
const clipStartSec = currentClip.startMs / 1000;
|
|
320
|
+
// Calculate offsets for compound transitions
|
|
321
|
+
const outOffset = Math.max(0, clipStartSec - outDuration);
|
|
322
|
+
const inOffset = Math.max(0, clipStartSec - inDuration);
|
|
323
|
+
// Apply transitionOut to previous clip first
|
|
324
|
+
const outLabel = newLabel();
|
|
325
|
+
const outTransition = getXfadeTransition(hasTransitionOut.name);
|
|
326
|
+
// Create a temporary black/transparent frame for transitionOut
|
|
327
|
+
const blackLabel = newLabel();
|
|
328
|
+
const blackFpsLabel = newLabel();
|
|
329
|
+
fg.push(`color=black:size=${project.settings.resolution.width}x${project.settings.resolution.height}:duration=${outDuration}[${blackLabel}]`);
|
|
330
|
+
fg.push(`[${blackLabel}]fps=${project.settings.fps}[${blackFpsLabel}]`);
|
|
331
|
+
fg.push(`${currentOut}[${blackFpsLabel}]xfade=transition=${outTransition}:duration=${outDuration}:offset=${outOffset}[${outLabel}]`);
|
|
332
|
+
// Apply transitionIn to current clip
|
|
333
|
+
const inLabel = newLabel();
|
|
334
|
+
const inTransition = getXfadeTransition(hasTransitionIn.name);
|
|
335
|
+
fg.push(`[${outLabel}]${clipOuts[i]}xfade=transition=${inTransition}:duration=${inDuration}:offset=${inOffset}[${inLabel}]`);
|
|
336
|
+
currentOut = `[${inLabel}]`;
|
|
337
|
+
}
|
|
338
|
+
else if (hasTransitionOut || hasTransitionIn) {
|
|
339
|
+
// Single transition (backward compatibility)
|
|
340
|
+
const transition = hasTransitionIn || hasTransitionOut;
|
|
341
|
+
const duration = transition.durationMs / 1000;
|
|
342
|
+
const offset = hasTransitionIn
|
|
343
|
+
? (currentClip.startMs - currentClip.transitionIn.durationMs) / 1000
|
|
344
|
+
: currentClip.startMs / 1000;
|
|
345
|
+
const l = newLabel();
|
|
346
|
+
const xfadeTransition = getXfadeTransition(transition.name);
|
|
347
|
+
fg.push(`${currentOut}${clipOuts[i]}xfade=transition=${xfadeTransition}:duration=${duration}:offset=${Math.max(0, offset)}[${l}]`);
|
|
348
|
+
currentOut = `[${l}]`;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
// No transition, use concat
|
|
352
|
+
const l = newLabel();
|
|
353
|
+
fg.push(`${currentOut}${clipOuts[i]}concat=n=2:v=1:a=0[${l}]`);
|
|
354
|
+
currentOut = `[${l}]`;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return [currentOut];
|
|
358
|
+
}
|
|
359
|
+
// Helper function to map transition names to xfade types
|
|
360
|
+
function getXfadeTransition(transitionName) {
|
|
361
|
+
switch (transitionName) {
|
|
362
|
+
case 'xfade':
|
|
363
|
+
case 'fade':
|
|
364
|
+
return 'fade';
|
|
365
|
+
case 'wipeleft':
|
|
366
|
+
return 'wipeleft';
|
|
367
|
+
case 'wiperight':
|
|
368
|
+
return 'wiperight';
|
|
369
|
+
case 'wipeup':
|
|
370
|
+
return 'wipeup';
|
|
371
|
+
case 'wipedown':
|
|
372
|
+
return 'wipedown';
|
|
373
|
+
case 'slideleft':
|
|
374
|
+
return 'slideleft';
|
|
375
|
+
case 'slideright':
|
|
376
|
+
return 'slideright';
|
|
377
|
+
case 'slideup':
|
|
378
|
+
return 'slideup';
|
|
379
|
+
case 'slidedown':
|
|
380
|
+
return 'slidedown';
|
|
381
|
+
case 'circlecrop':
|
|
382
|
+
return 'circlecrop';
|
|
383
|
+
case 'rectcrop':
|
|
384
|
+
return 'rectcrop';
|
|
385
|
+
case 'distance':
|
|
386
|
+
return 'distance';
|
|
387
|
+
case 'fadeblack':
|
|
388
|
+
return 'fadeblack';
|
|
389
|
+
case 'fadewhite':
|
|
390
|
+
return 'fadewhite';
|
|
391
|
+
case 'radial':
|
|
392
|
+
return 'radial';
|
|
393
|
+
case 'smoothleft':
|
|
394
|
+
return 'smoothleft';
|
|
395
|
+
case 'smoothright':
|
|
396
|
+
return 'smoothright';
|
|
397
|
+
case 'smoothup':
|
|
398
|
+
return 'smoothup';
|
|
399
|
+
case 'smoothdown':
|
|
400
|
+
return 'smoothdown';
|
|
401
|
+
case 'circleopen':
|
|
402
|
+
return 'circleopen';
|
|
403
|
+
case 'circleclose':
|
|
404
|
+
return 'circleclose';
|
|
405
|
+
case 'vertopen':
|
|
406
|
+
return 'vertopen';
|
|
407
|
+
case 'vertclose':
|
|
408
|
+
return 'vertclose';
|
|
409
|
+
case 'horzopen':
|
|
410
|
+
return 'horzopen';
|
|
411
|
+
case 'horzclose':
|
|
412
|
+
return 'horzclose';
|
|
413
|
+
case 'dissolve':
|
|
414
|
+
return 'dissolve';
|
|
415
|
+
case 'pixelize':
|
|
416
|
+
return 'pixelize';
|
|
417
|
+
case 'diagtl':
|
|
418
|
+
return 'diagtl';
|
|
419
|
+
case 'diagtr':
|
|
420
|
+
return 'diagtr';
|
|
421
|
+
case 'diagbl':
|
|
422
|
+
return 'diagbl';
|
|
423
|
+
case 'diagbr':
|
|
424
|
+
return 'diagbr';
|
|
425
|
+
default:
|
|
426
|
+
return 'fade';
|
|
427
|
+
}
|
|
428
|
+
}
|
|
269
429
|
function compileToFfmpeg(project, opts = {}) {
|
|
270
430
|
const ffmpegBin = opts.ffmpegBin ?? 'ffmpeg';
|
|
271
431
|
const tmpDir = opts.workingDir ?? process.cwd();
|
|
@@ -304,14 +464,27 @@ function compileToFfmpeg(project, opts = {}) {
|
|
|
304
464
|
const idx = inputIndexByAsset[asset.id];
|
|
305
465
|
const sel = track.type === 'audio' ? `[${idx}:a]` : `[${idx}:v]`;
|
|
306
466
|
const start = clip.inMs / 1000;
|
|
307
|
-
|
|
308
|
-
const
|
|
467
|
+
// Extend duration for transitionIn to compensate for overlap
|
|
468
|
+
const dur = (clip.durationMs +
|
|
469
|
+
(clip.transitionIn ? clip.transitionIn.durationMs : 0)) /
|
|
470
|
+
1000;
|
|
471
|
+
// For clips with transitionIn: add static frames at beginning and start earlier
|
|
472
|
+
// For clips without transitionIn: use original startMs
|
|
473
|
+
const hasTransition = clip.transitionIn && track.type === 'video';
|
|
474
|
+
const transitionDuration = hasTransition
|
|
475
|
+
? clip.transitionIn.durationMs / 1000
|
|
476
|
+
: 0;
|
|
477
|
+
const actualStartSec = hasTransition
|
|
478
|
+
? (clip.startMs - clip.transitionIn.durationMs) / 1000
|
|
479
|
+
: clip.startMs / 1000;
|
|
309
480
|
const trim = track.type === 'audio'
|
|
310
481
|
? `atrim=start=${start}:duration=${dur},asetpts=PTS-STARTPTS`
|
|
311
|
-
: `
|
|
482
|
+
: `fps=${project.settings.fps}`;
|
|
312
483
|
const shift = track.type === 'audio'
|
|
313
|
-
? `adelay=${Math.round(
|
|
314
|
-
:
|
|
484
|
+
? `adelay=${Math.round(clip.startMs)}|${Math.round(clip.startMs)}`
|
|
485
|
+
: hasTransition
|
|
486
|
+
? `tpad=start_duration=${transitionDuration}:start_mode=clone`
|
|
487
|
+
: ''; // 没有转场时不应用tpad,时长由concat或timeline处理
|
|
315
488
|
// Effects mapping (partial demo)
|
|
316
489
|
const effects = [];
|
|
317
490
|
if (clip.effects)
|
|
@@ -376,16 +549,38 @@ function compileToFfmpeg(project, opts = {}) {
|
|
|
376
549
|
fg.push(`${sel}${trim}${effects.length ? ',' + effects.join(',') : ''}[${lIn}]`);
|
|
377
550
|
// Scale video clips to project resolution
|
|
378
551
|
if (track.type === 'video') {
|
|
379
|
-
|
|
380
|
-
|
|
552
|
+
const scaleAndPad = `scale=${project.settings.resolution.width}:${project.settings.resolution.height}:force_original_aspect_ratio=decrease,pad=${project.settings.resolution.width}:${project.settings.resolution.height}:(ow-iw)/2:(oh-ih)/2,setsar=1`;
|
|
553
|
+
if (shift) {
|
|
554
|
+
fg.push(`[${lIn}]${scaleAndPad},${shift}[${lOut}]`);
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
fg.push(`[${lIn}]${scaleAndPad}[${lOut}]`);
|
|
558
|
+
}
|
|
381
559
|
}
|
|
382
560
|
else {
|
|
383
|
-
|
|
561
|
+
if (shift) {
|
|
562
|
+
fg.push(`[${lIn}]${shift}[${lOut}]`);
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
// No shift needed, just copy the label
|
|
566
|
+
fg.push(`[${lIn}]acopy[${lOut}]`);
|
|
567
|
+
}
|
|
384
568
|
}
|
|
385
569
|
outs.push(`[${lOut}]`);
|
|
386
570
|
}
|
|
387
|
-
//
|
|
388
|
-
if (outs.length) {
|
|
571
|
+
// Handle transitions for video tracks
|
|
572
|
+
if (track.type === 'video' && outs.length > 1) {
|
|
573
|
+
const transitionedOuts = applyVideoTransitions(track, outs, newLabel, fg, project);
|
|
574
|
+
if (transitionedOuts.length === 1) {
|
|
575
|
+
videoTrackOuts.push(transitionedOuts[0]);
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
const l = newLabel();
|
|
579
|
+
fg.push(`${transitionedOuts.join('')}concat=n=${transitionedOuts.length}:v=1:a=0[${l}]`);
|
|
580
|
+
videoTrackOuts.push(`[${l}]`);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
else if (outs.length) {
|
|
389
584
|
if (track.type === 'audio') {
|
|
390
585
|
const l = newLabel();
|
|
391
586
|
fg.push(`${outs.join('')}amix=inputs=${outs.length}:normalize=0[${l}]`);
|
|
@@ -606,8 +801,99 @@ function compileToFfmpeg(project, opts = {}) {
|
|
|
606
801
|
opts.outFile ||
|
|
607
802
|
`output.${project.export.container}`,
|
|
608
803
|
];
|
|
804
|
+
// Generate formatted command for better readability
|
|
805
|
+
const formatCmd = () => {
|
|
806
|
+
const inputArgs = [];
|
|
807
|
+
let filterComplex = '';
|
|
808
|
+
const outputArgs = [];
|
|
809
|
+
let i = 0;
|
|
810
|
+
while (i < args.length) {
|
|
811
|
+
if (args[i] === '-i') {
|
|
812
|
+
inputArgs.push(`-i ${args[i + 1]}`);
|
|
813
|
+
i += 2;
|
|
814
|
+
}
|
|
815
|
+
else if (args[i] === '-filter_complex') {
|
|
816
|
+
// Format filter_complex content with logical grouping like test-corrected-ffmpeg.sh
|
|
817
|
+
const filterContent = args[i + 1];
|
|
818
|
+
const filters = filterContent
|
|
819
|
+
.split(';')
|
|
820
|
+
.map(filter => filter.trim())
|
|
821
|
+
.filter(filter => filter.length > 0);
|
|
822
|
+
const videoProcessing = [];
|
|
823
|
+
const transitions = [];
|
|
824
|
+
const audioProcessing = [];
|
|
825
|
+
const mixing = [];
|
|
826
|
+
for (const filter of filters) {
|
|
827
|
+
if (/^\[\d+:v\]/.test(filter)) {
|
|
828
|
+
// Video input processing
|
|
829
|
+
videoProcessing.push(` ${filter};`);
|
|
830
|
+
}
|
|
831
|
+
else if (/^\[v\d+\]\[v\d+\]xfade/.test(filter) ||
|
|
832
|
+
/^\[x\d+\]\[v\d+\]xfade/.test(filter)) {
|
|
833
|
+
// Video transitions
|
|
834
|
+
transitions.push(` ${filter};`);
|
|
835
|
+
}
|
|
836
|
+
else if (/^\[\d+:a\]/.test(filter)) {
|
|
837
|
+
// Audio input processing
|
|
838
|
+
audioProcessing.push(` ${filter};`);
|
|
839
|
+
}
|
|
840
|
+
else if (/amix|volume|afade/.test(filter)) {
|
|
841
|
+
// Audio mixing
|
|
842
|
+
mixing.push(` ${filter};`);
|
|
843
|
+
}
|
|
844
|
+
else if (/subtitles/.test(filter)) {
|
|
845
|
+
// Subtitle processing
|
|
846
|
+
mixing.push(` ${filter};`);
|
|
847
|
+
}
|
|
848
|
+
else {
|
|
849
|
+
// Other filters, group with previous category
|
|
850
|
+
if (mixing.length > 0) {
|
|
851
|
+
mixing.push(` ${filter};`);
|
|
852
|
+
}
|
|
853
|
+
else if (audioProcessing.length > 0) {
|
|
854
|
+
audioProcessing.push(` ${filter};`);
|
|
855
|
+
}
|
|
856
|
+
else if (transitions.length > 0) {
|
|
857
|
+
transitions.push(` ${filter};`);
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
videoProcessing.push(` ${filter};`);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
const formattedSections = [];
|
|
865
|
+
if (videoProcessing.length > 0)
|
|
866
|
+
formattedSections.push(videoProcessing.join('\n'));
|
|
867
|
+
if (transitions.length > 0)
|
|
868
|
+
formattedSections.push(transitions.join('\n'));
|
|
869
|
+
if (audioProcessing.length > 0)
|
|
870
|
+
formattedSections.push(audioProcessing.join('\n'));
|
|
871
|
+
if (mixing.length > 0)
|
|
872
|
+
formattedSections.push(mixing.join('\n'));
|
|
873
|
+
const formattedFilter = formattedSections.join('\n').replace(/;$/, ''); // Remove last semicolon
|
|
874
|
+
filterComplex = `-filter_complex "\n${formattedFilter}\n"`;
|
|
875
|
+
i += 2;
|
|
876
|
+
}
|
|
877
|
+
else if (args[i] === '-map') {
|
|
878
|
+
outputArgs.push(`-map ${args[i + 1]}`);
|
|
879
|
+
i += 2;
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
outputArgs.push(args[i]);
|
|
883
|
+
i++;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
const parts = [
|
|
887
|
+
`${ffmpegBin} \\`,
|
|
888
|
+
`${inputArgs.join(' ')} \\`, // Join input args in one line
|
|
889
|
+
...(filterComplex ? [`${filterComplex} \\`] : []),
|
|
890
|
+
outputArgs.join(' '), // Join output args in one line
|
|
891
|
+
];
|
|
892
|
+
return parts.join('\n');
|
|
893
|
+
};
|
|
609
894
|
const cmd = (0, shell_quote_1.quote)([ffmpegBin, ...args]);
|
|
610
|
-
|
|
895
|
+
const formattedCmd = formatCmd();
|
|
896
|
+
return { cmd: formattedCmd, args, filterGraph, extraFiles, ffmpegBin };
|
|
611
897
|
}
|
|
612
898
|
// ===========================
|
|
613
899
|
// 5) Run helper (Node only)
|
|
@@ -779,10 +1065,7 @@ async function compileKenBurnsMotion(imagePath, duration, camera_motion = 'zoom_
|
|
|
779
1065
|
].join(' ');
|
|
780
1066
|
return cmd;
|
|
781
1067
|
}
|
|
782
|
-
// 其他类型使用zoompan
|
|
783
|
-
// 1. 去掉取整 & 用缓动曲线:使用S曲线(ease-in-out)让每帧增量更平滑
|
|
784
|
-
const k = zEnd - zStart; // 总缩放幅度
|
|
785
|
-
const smoothZExpr = `${zStart.toFixed(6)}+${k.toFixed(6)}*pow((on - 1)/${frames - 1},2)*(3 - 2*(on - 1)/${frames - 1})`;
|
|
1068
|
+
// 其他类型使用zoompan滤镜,采用简单优化减少抖动
|
|
786
1069
|
// 去掉floor取整,允许亚像素采样,避免复杂的表达式导致晃动
|
|
787
1070
|
let xExpr = '(iw-iw/zoom)/2';
|
|
788
1071
|
let yExpr = '(ih-ih/zoom)/2';
|