simple-ffmpegjs 0.1.0 → 0.1.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 CHANGED
@@ -23,8 +23,8 @@ Built for data pipelines: a tiny helper around FFmpeg that makes common edits tr
23
23
  - 🧱 Scales to long scripts via optional multi-pass text batching
24
24
  - 🧩 Ships TypeScript definitions without requiring TS
25
25
  - đŸĒļ No external libraries (other than FFmpeg), no bundled fonts; extremely lightweight
26
- - 🧑‍đŸ’ģ Actively maintained; PRs and issues welcome
27
26
  - đŸ–ŧī¸ Image support with Ken Burns (zoom-in/out, pan-left/right/up/down)
27
+ - 🧑‍đŸ’ģ Actively maintained; PRs and issues welcome
28
28
 
29
29
  ## đŸ“Ļ Install
30
30
 
@@ -32,13 +32,25 @@ Built for data pipelines: a tiny helper around FFmpeg that makes common edits tr
32
32
  npm install simple-ffmpegjs
33
33
  ```
34
34
 
35
+ ### Import syntax
36
+
37
+ ```js
38
+ // CommonJS
39
+ const SIMPLEFFMPEG = require("simple-ffmpegjs");
40
+ ```
41
+
42
+ ```js
43
+ // ESM
44
+ import SIMPLEFFMPEG from "simple-ffmpegjs";
45
+ ```
46
+
35
47
  ## âš™ī¸ Requirements
36
48
 
37
49
  Make sure you have ffmpeg installed on your system:
38
50
 
39
- **Mac**: brew install ffmpeg
51
+ **Mac**: `brew install ffmpeg`
40
52
 
41
- **Ubuntu/Debian**: apt-get install ffmpeg
53
+ **Ubuntu/Debian**: `apt-get install ffmpeg`
42
54
 
43
55
  **Windows**: Download from ffmpeg.org
44
56
 
package/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ module.exports = require("./src/simpleffmpeg.js");
2
+ module.exports.default = module.exports;
package/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import SIMPLEFFMPEG from "./src/simpleffmpeg.js";
2
+ export default SIMPLEFFMPEG;
package/package.json CHANGED
@@ -1,12 +1,24 @@
1
1
  {
2
2
  "name": "simple-ffmpegjs",
3
- "version": "0.1.0",
4
- "main": "index.js",
3
+ "version": "0.1.1",
4
+ "main": "index.cjs",
5
+ "module": "index.mjs",
5
6
  "types": "types/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": {
10
+ "import": "./types/index.d.mts",
11
+ "require": "./types/index.d.ts"
12
+ },
13
+ "import": "./index.mjs",
14
+ "require": "./index.cjs"
15
+ }
16
+ },
6
17
  "files": [
7
18
  "src",
8
19
  "types",
9
- "index.js"
20
+ "index.cjs",
21
+ "index.mjs"
10
22
  ],
11
23
  "keywords": [
12
24
  "ffmpeg",
@@ -33,5 +45,8 @@
33
45
  "email": "braydenblackwell21@gmail.com"
34
46
  },
35
47
  "homepage": "https://github.com/Fats403/simple-ffmpeg#readme",
36
- "description": "Simple Node.js helper around ffmpeg for video composition, transitions, audio mixing, and text rendering."
48
+ "description": "Simple Node.js helper around ffmpeg for video composition, transitions, audio mixing, and text rendering.",
49
+ "engines": {
50
+ "node": ">=16"
51
+ }
37
52
  }
@@ -0,0 +1,132 @@
1
+ declare namespace SIMPLEFFMPEG {
2
+ type ClipType =
3
+ | "video"
4
+ | "audio"
5
+ | "text"
6
+ | "music"
7
+ | "backgroundAudio"
8
+ | "image";
9
+
10
+ interface BaseClip {
11
+ type: ClipType;
12
+ url?: string;
13
+ position: number;
14
+ end: number;
15
+ }
16
+
17
+ interface VideoClip extends BaseClip {
18
+ type: "video";
19
+ url: string;
20
+ cutFrom?: number;
21
+ transition?: { type: string; duration: number };
22
+ }
23
+
24
+ interface AudioClip extends BaseClip {
25
+ type: "audio";
26
+ url: string;
27
+ cutFrom?: number;
28
+ volume?: number;
29
+ }
30
+
31
+ interface BackgroundMusicClip extends BaseClip {
32
+ type: "music" | "backgroundAudio";
33
+ url: string;
34
+ cutFrom?: number;
35
+ volume?: number;
36
+ }
37
+
38
+ interface ImageClip extends BaseClip {
39
+ type: "image";
40
+ url: string;
41
+ kenBurns?:
42
+ | "zoom-in"
43
+ | "zoom-out"
44
+ | "pan-left"
45
+ | "pan-right"
46
+ | "pan-up"
47
+ | "pan-down";
48
+ }
49
+
50
+ type TextMode = "static" | "word-replace" | "word-sequential";
51
+ type TextAnimationType =
52
+ | "none"
53
+ | "fade-in"
54
+ | "fade-in-out"
55
+ | "pop"
56
+ | "pop-bounce";
57
+
58
+ interface TextWordWindow {
59
+ text: string;
60
+ start: number;
61
+ end: number;
62
+ }
63
+
64
+ interface TextClip {
65
+ type: "text";
66
+ text?: string;
67
+ position: number;
68
+ end: number;
69
+ mode?: TextMode;
70
+ words?: TextWordWindow[];
71
+ wordTimestamps?: number[];
72
+
73
+ // Font
74
+ fontFile?: string;
75
+ fontFamily?: string;
76
+ fontSize?: number;
77
+ fontColor?: string;
78
+
79
+ // Position
80
+ centerX?: number;
81
+ centerY?: number;
82
+ x?: number;
83
+ y?: number;
84
+
85
+ // Styling
86
+ borderColor?: string;
87
+ borderWidth?: number;
88
+ shadowColor?: string;
89
+ shadowX?: number;
90
+ shadowY?: number;
91
+ backgroundColor?: string;
92
+ backgroundOpacity?: number;
93
+ padding?: number;
94
+
95
+ // Animation
96
+ animation?: {
97
+ type: TextAnimationType;
98
+ in?: number;
99
+ out?: number;
100
+ };
101
+ }
102
+
103
+ type Clip =
104
+ | VideoClip
105
+ | AudioClip
106
+ | BackgroundMusicClip
107
+ | ImageClip
108
+ | TextClip;
109
+
110
+ interface SIMPLEFFMPEGOptions {
111
+ fps?: number;
112
+ width?: number;
113
+ height?: number;
114
+ validationMode?: "warn" | "strict";
115
+ }
116
+
117
+ interface ExportOptions {
118
+ outputPath?: string;
119
+ textMaxNodesPerPass?: number;
120
+ intermediateVideoCodec?: string;
121
+ intermediateCrf?: number;
122
+ intermediatePreset?: string;
123
+ }
124
+ }
125
+
126
+ declare class SIMPLEFFMPEG {
127
+ constructor(options: SIMPLEFFMPEG.SIMPLEFFMPEGOptions);
128
+ load(clips: SIMPLEFFMPEG.Clip[]): Promise<void[]>;
129
+ export(options: SIMPLEFFMPEG.ExportOptions): Promise<string>;
130
+ }
131
+
132
+ export default SIMPLEFFMPEG;
package/types/index.d.ts CHANGED
@@ -1,128 +1,139 @@
1
- export type ClipType =
2
- | "video"
3
- | "audio"
4
- | "text"
5
- | "music"
6
- | "backgroundAudio"
7
- | "image";
8
-
9
- export interface BaseClip {
10
- type: ClipType;
11
- url?: string;
12
- position: number;
13
- end: number;
1
+ declare namespace SIMPLEFFMPEG {
2
+ type ClipType =
3
+ | "video"
4
+ | "audio"
5
+ | "text"
6
+ | "music"
7
+ | "backgroundAudio"
8
+ | "image";
9
+
10
+ interface BaseClip {
11
+ type: ClipType;
12
+ url?: string;
13
+ position: number;
14
+ end: number;
15
+ }
16
+
17
+ interface VideoClip extends BaseClip {
18
+ type: "video";
19
+ url: string;
20
+ cutFrom?: number;
21
+ transition?: { type: string; duration: number };
22
+ }
23
+
24
+ interface AudioClip extends BaseClip {
25
+ type: "audio";
26
+ url: string;
27
+ cutFrom?: number;
28
+ volume?: number;
29
+ }
30
+
31
+ interface BackgroundMusicClip extends BaseClip {
32
+ type: "music" | "backgroundAudio";
33
+ url: string;
34
+ cutFrom?: number;
35
+ volume?: number;
36
+ }
37
+
38
+ interface ImageClip extends BaseClip {
39
+ type: "image";
40
+ url: string;
41
+ kenBurns?:
42
+ | "zoom-in"
43
+ | "zoom-out"
44
+ | "pan-left"
45
+ | "pan-right"
46
+ | "pan-up"
47
+ | "pan-down";
48
+ }
49
+
50
+ type TextMode = "static" | "word-replace" | "word-sequential";
51
+ type TextAnimationType =
52
+ | "none"
53
+ | "fade-in"
54
+ | "fade-in-out"
55
+ | "pop"
56
+ | "pop-bounce";
57
+
58
+ interface TextWordWindow {
59
+ text: string;
60
+ start: number;
61
+ end: number;
62
+ }
63
+
64
+ interface TextClip {
65
+ type: "text";
66
+ text?: string;
67
+ position: number;
68
+ end: number;
69
+ mode?: TextMode;
70
+ words?: TextWordWindow[];
71
+ wordTimestamps?: number[];
72
+
73
+ // Font
74
+ fontFile?: string;
75
+ fontFamily?: string; // defaults to 'Sans' via fontconfig
76
+ fontSize?: number; // default 48
77
+ fontColor?: string; // default '#FFFFFF'
78
+
79
+ // Position
80
+ centerX?: number;
81
+ centerY?: number;
82
+ x?: number;
83
+ y?: number;
84
+
85
+ // Styling
86
+ borderColor?: string;
87
+ borderWidth?: number;
88
+ shadowColor?: string;
89
+ shadowX?: number;
90
+ shadowY?: number;
91
+ backgroundColor?: string;
92
+ backgroundOpacity?: number;
93
+ padding?: number;
94
+
95
+ // Animation
96
+ animation?: {
97
+ type: TextAnimationType;
98
+ in?: number; // seconds
99
+ out?: number; // seconds
100
+ };
101
+ }
102
+
103
+ type Clip =
104
+ | VideoClip
105
+ | AudioClip
106
+ | BackgroundMusicClip
107
+ | ImageClip
108
+ | TextClip;
109
+
110
+ interface SIMPLEFFMPEGOptions {
111
+ fps?: number;
112
+ width?: number;
113
+ height?: number;
114
+ validationMode?: "warn" | "strict";
115
+ }
116
+
117
+ interface ExportOptions {
118
+ outputPath?: string;
119
+ textMaxNodesPerPass?: number;
120
+ intermediateVideoCodec?: string;
121
+ intermediateCrf?: number;
122
+ intermediatePreset?: string;
123
+ }
14
124
  }
15
125
 
16
- export interface VideoClip extends BaseClip {
17
- type: "video";
18
- url: string;
19
- cutFrom?: number;
20
- transition?: { type: string; duration: number };
126
+ declare class SIMPLEFFMPEG {
127
+ constructor(options: SIMPLEFFMPEG.SIMPLEFFMPEGOptions);
128
+ load(clips: SIMPLEFFMPEG.Clip[]): Promise<void[]>;
129
+ export(options: SIMPLEFFMPEG.ExportOptions): Promise<string>;
21
130
  }
22
131
 
23
- export interface AudioClip extends BaseClip {
24
- type: "audio";
25
- url: string;
26
- cutFrom?: number;
27
- volume?: number;
132
+ /**
133
+ * Synthetic default export type for ESM default-import IntelliSense
134
+ */
135
+ declare namespace _defaultExportType {
136
+ export { SIMPLEFFMPEG as default };
28
137
  }
29
138
 
30
- export interface BackgroundMusicClip extends BaseClip {
31
- type: "music" | "backgroundAudio";
32
- url: string;
33
- cutFrom?: number;
34
- volume?: number;
35
- }
36
-
37
- export interface ImageClip extends BaseClip {
38
- type: "image";
39
- url: string;
40
- kenBurns?:
41
- | "zoom-in"
42
- | "zoom-out"
43
- | "pan-left"
44
- | "pan-right"
45
- | "pan-up"
46
- | "pan-down";
47
- }
48
-
49
- export type TextMode = "static" | "word-replace" | "word-sequential";
50
- export type TextAnimationType =
51
- | "none"
52
- | "fade-in"
53
- | "fade-in-out"
54
- | "pop"
55
- | "pop-bounce";
56
-
57
- export interface TextWordWindow {
58
- text: string;
59
- start: number;
60
- end: number;
61
- }
62
-
63
- export interface TextClip {
64
- type: "text";
65
- text?: string;
66
- position: number;
67
- end: number;
68
- mode?: TextMode;
69
- words?: TextWordWindow[];
70
- wordTimestamps?: number[];
71
-
72
- // Font
73
- fontFile?: string;
74
- fontFamily?: string; // defaults to 'Sans' via fontconfig
75
- fontSize?: number; // default 48
76
- fontColor?: string; // default '#FFFFFF'
77
-
78
- // Position
79
- centerX?: number;
80
- centerY?: number;
81
- x?: number;
82
- y?: number;
83
-
84
- // Styling
85
- borderColor?: string;
86
- borderWidth?: number;
87
- shadowColor?: string;
88
- shadowX?: number;
89
- shadowY?: number;
90
- backgroundColor?: string;
91
- backgroundOpacity?: number;
92
- padding?: number;
93
-
94
- // Animation
95
- animation?: {
96
- type: TextAnimationType;
97
- in?: number; // seconds
98
- out?: number; // seconds
99
- };
100
- }
101
-
102
- export type Clip =
103
- | VideoClip
104
- | AudioClip
105
- | BackgroundMusicClip
106
- | ImageClip
107
- | TextClip;
108
-
109
- export interface SIMPLEFFMPEGOptions {
110
- fps?: number;
111
- width?: number;
112
- height?: number;
113
- validationMode?: "warn" | "strict";
114
- }
115
-
116
- export interface ExportOptions {
117
- outputPath?: string;
118
- textMaxNodesPerPass?: number;
119
- intermediateVideoCodec?: string;
120
- intermediateCrf?: number;
121
- intermediatePreset?: string;
122
- }
123
-
124
- export default class SIMPLEFFMPEG {
125
- constructor(options: SIMPLEFFMPEGOptions);
126
- load(clips: Clip[]): Promise<void[]>;
127
- export(options: ExportOptions): Promise<string>;
128
- }
139
+ export = SIMPLEFFMPEG;
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("./src/simpleffmpeg");