simple-ffmpegjs 0.3.6 → 0.4.1
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 +244 -137
- package/package.json +1 -1
- package/src/core/gaps.js +5 -31
- package/src/core/resolve.js +1 -1
- package/src/core/validation.js +339 -77
- package/src/ffmpeg/audio_builder.js +3 -1
- package/src/ffmpeg/bgm_builder.js +23 -5
- package/src/ffmpeg/effect_builder.js +220 -0
- package/src/ffmpeg/video_builder.js +20 -37
- package/src/lib/gradient.js +257 -0
- package/src/loaders.js +46 -1
- package/src/schema/formatter.js +2 -0
- package/src/schema/index.js +4 -0
- package/src/schema/modules/color.js +54 -0
- package/src/schema/modules/effect.js +124 -0
- package/src/simpleffmpeg.js +61 -92
- package/types/index.d.mts +110 -5
- package/types/index.d.ts +126 -5
package/types/index.d.ts
CHANGED
|
@@ -51,7 +51,9 @@ declare namespace SIMPLEFFMPEG {
|
|
|
51
51
|
| "music"
|
|
52
52
|
| "backgroundAudio"
|
|
53
53
|
| "image"
|
|
54
|
-
| "subtitle"
|
|
54
|
+
| "subtitle"
|
|
55
|
+
| "color"
|
|
56
|
+
| "effect";
|
|
55
57
|
|
|
56
58
|
interface BaseClip {
|
|
57
59
|
type: ClipType;
|
|
@@ -220,11 +222,130 @@ declare namespace SIMPLEFFMPEG {
|
|
|
220
222
|
opacity?: number;
|
|
221
223
|
}
|
|
222
224
|
|
|
225
|
+
/** Gradient specification for color clips */
|
|
226
|
+
interface GradientSpec {
|
|
227
|
+
type: "linear-gradient" | "radial-gradient";
|
|
228
|
+
/** Array of color strings (at least 2). Evenly distributed across the gradient. */
|
|
229
|
+
colors: string[];
|
|
230
|
+
/** For linear gradients: "vertical" (default), "horizontal", or angle in degrees */
|
|
231
|
+
direction?: "vertical" | "horizontal" | number;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Color clip — solid color or gradient for filling gaps, transitions, etc. */
|
|
235
|
+
interface ColorClip {
|
|
236
|
+
type: "color";
|
|
237
|
+
/** Flat color string (e.g. "black", "#FF0000") or gradient specification */
|
|
238
|
+
color: string | GradientSpec;
|
|
239
|
+
/** Start time on timeline in seconds. Omit to auto-sequence after previous visual clip. */
|
|
240
|
+
position?: number;
|
|
241
|
+
/** End time on timeline in seconds. Mutually exclusive with duration. */
|
|
242
|
+
end?: number;
|
|
243
|
+
/** Duration in seconds (alternative to end). end = position + duration. */
|
|
244
|
+
duration?: number;
|
|
245
|
+
/** Transition effect from the previous visual clip */
|
|
246
|
+
transition?: { type: string; duration: number };
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
type EffectName =
|
|
250
|
+
| "vignette"
|
|
251
|
+
| "filmGrain"
|
|
252
|
+
| "gaussianBlur"
|
|
253
|
+
| "colorAdjust"
|
|
254
|
+
| "sepia"
|
|
255
|
+
| "blackAndWhite"
|
|
256
|
+
| "sharpen"
|
|
257
|
+
| "chromaticAberration"
|
|
258
|
+
| "letterbox";
|
|
259
|
+
|
|
260
|
+
interface EffectParamsBase {
|
|
261
|
+
/** Base blend amount from 0 to 1 (default: 1) */
|
|
262
|
+
amount?: number;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
interface VignetteEffectParams extends EffectParamsBase {
|
|
266
|
+
/** Vignette angle in radians (default: PI/5) */
|
|
267
|
+
angle?: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface FilmGrainEffectParams extends EffectParamsBase {
|
|
271
|
+
/** Noise intensity 0-1 (default: 0.35). Independent from blend amount. */
|
|
272
|
+
strength?: number;
|
|
273
|
+
/** Temporal grain changes every frame (default: true) */
|
|
274
|
+
temporal?: boolean;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
interface GaussianBlurEffectParams extends EffectParamsBase {
|
|
278
|
+
/** Gaussian blur sigma (default derived from amount) */
|
|
279
|
+
sigma?: number;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
interface ColorAdjustEffectParams extends EffectParamsBase {
|
|
283
|
+
brightness?: number;
|
|
284
|
+
contrast?: number;
|
|
285
|
+
saturation?: number;
|
|
286
|
+
gamma?: number;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
interface SepiaEffectParams extends EffectParamsBase {}
|
|
290
|
+
|
|
291
|
+
interface BlackAndWhiteEffectParams extends EffectParamsBase {
|
|
292
|
+
/** Optional contrast boost (default: 1, range 0-3) */
|
|
293
|
+
contrast?: number;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
interface SharpenEffectParams extends EffectParamsBase {
|
|
297
|
+
/** Unsharp amount (default: 1.0, range 0-3) */
|
|
298
|
+
strength?: number;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
interface ChromaticAberrationEffectParams extends EffectParamsBase {
|
|
302
|
+
/** Horizontal pixel offset for R/B channels (default: 4, range 0-20) */
|
|
303
|
+
shift?: number;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
interface LetterboxEffectParams extends EffectParamsBase {
|
|
307
|
+
/** Bar height as fraction of frame height (default: 0.12, range 0-0.5) */
|
|
308
|
+
size?: number;
|
|
309
|
+
/** Bar color (default: "black") */
|
|
310
|
+
color?: string;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
type EffectParams =
|
|
314
|
+
| VignetteEffectParams
|
|
315
|
+
| FilmGrainEffectParams
|
|
316
|
+
| GaussianBlurEffectParams
|
|
317
|
+
| ColorAdjustEffectParams
|
|
318
|
+
| SepiaEffectParams
|
|
319
|
+
| BlackAndWhiteEffectParams
|
|
320
|
+
| SharpenEffectParams
|
|
321
|
+
| ChromaticAberrationEffectParams
|
|
322
|
+
| LetterboxEffectParams;
|
|
323
|
+
|
|
324
|
+
/** Effect clip — timed overlay adjustment layer over composed video */
|
|
325
|
+
interface EffectClip {
|
|
326
|
+
type: "effect";
|
|
327
|
+
effect: EffectName;
|
|
328
|
+
/** Start time on timeline in seconds. Required for effect clips. */
|
|
329
|
+
position: number;
|
|
330
|
+
/** End time on timeline in seconds. Mutually exclusive with duration. */
|
|
331
|
+
end?: number;
|
|
332
|
+
/** Duration in seconds (alternative to end). end = position + duration. */
|
|
333
|
+
duration?: number;
|
|
334
|
+
/** Ramp-in duration in seconds */
|
|
335
|
+
fadeIn?: number;
|
|
336
|
+
/** Ramp-out duration in seconds */
|
|
337
|
+
fadeOut?: number;
|
|
338
|
+
/** Effect-specific params */
|
|
339
|
+
params: EffectParams;
|
|
340
|
+
}
|
|
341
|
+
|
|
223
342
|
type Clip =
|
|
224
343
|
| VideoClip
|
|
225
344
|
| AudioClip
|
|
226
345
|
| BackgroundMusicClip
|
|
227
346
|
| ImageClip
|
|
347
|
+
| ColorClip
|
|
348
|
+
| EffectClip
|
|
228
349
|
| TextClip
|
|
229
350
|
| SubtitleClip;
|
|
230
351
|
|
|
@@ -297,8 +418,6 @@ declare namespace SIMPLEFFMPEG {
|
|
|
297
418
|
interface ValidateOptions {
|
|
298
419
|
/** Skip file existence checks (useful for AI generating configs before files exist) */
|
|
299
420
|
skipFileChecks?: boolean;
|
|
300
|
-
/** Gap handling mode - affects timeline gap validation. Any valid FFmpeg color, or "none"/false to disable. */
|
|
301
|
-
fillGaps?: "none" | string | boolean;
|
|
302
421
|
/** Project width - used to validate Ken Burns images are large enough */
|
|
303
422
|
width?: number;
|
|
304
423
|
/** Project height - used to validate Ken Burns images are large enough */
|
|
@@ -318,8 +437,8 @@ declare namespace SIMPLEFFMPEG {
|
|
|
318
437
|
height?: number;
|
|
319
438
|
/** Validation mode: 'warn' logs warnings, 'strict' throws on warnings (default: 'warn') */
|
|
320
439
|
validationMode?: "warn" | "strict";
|
|
321
|
-
/**
|
|
322
|
-
|
|
440
|
+
/** Default font file path (.ttf, .otf) applied to all text clips. Individual clips can override this with their own fontFile. */
|
|
441
|
+
fontFile?: string;
|
|
323
442
|
}
|
|
324
443
|
|
|
325
444
|
/** Log entry passed to onLog callback */
|
|
@@ -657,6 +776,8 @@ declare namespace SIMPLEFFMPEG {
|
|
|
657
776
|
| "video"
|
|
658
777
|
| "audio"
|
|
659
778
|
| "image"
|
|
779
|
+
| "color"
|
|
780
|
+
| "effect"
|
|
660
781
|
| "text"
|
|
661
782
|
| "subtitle"
|
|
662
783
|
| "music";
|