simple-ffmpegjs 0.5.2 → 0.5.3
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 +3 -1
- package/package.json +10 -3
- package/src/core/media_info.js +5 -5
- package/src/core/rotation.js +4 -4
- package/src/core/validation.js +228 -170
- package/src/ffmpeg/audio_builder.js +1 -1
- package/src/ffmpeg/bgm_builder.js +5 -5
- package/src/ffmpeg/command_builder.js +6 -6
- package/src/ffmpeg/effect_builder.js +11 -11
- package/src/ffmpeg/standalone_audio_builder.js +75 -0
- package/src/ffmpeg/strings.js +4 -17
- package/src/ffmpeg/subtitle_builder.js +6 -14
- package/src/ffmpeg/text_passes.js +33 -8
- package/src/ffmpeg/text_renderer.js +17 -17
- package/src/ffmpeg/video_builder.js +6 -4
- package/src/ffmpeg/watermark_builder.js +1 -1
- package/src/lib/utils.js +4 -4
- package/src/loaders.js +8 -8
- package/src/schema/formatter.js +15 -15
- package/src/schema/index.js +4 -4
- package/src/schema/modules/music.js +1 -1
- package/src/simpleffmpeg.js +166 -167
- package/types/index.d.ts +20 -0
package/README.md
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/simple-ffmpegjs"><img src="https://img.shields.io/npm/v/simple-ffmpegjs.svg" alt="npm version"></a>
|
|
7
|
+
<a href="https://github.com/Fats403/simple-ffmpeg/actions/workflows/ci.yml"><img src="https://github.com/Fats403/simple-ffmpeg/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
7
8
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
|
|
8
|
-
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%
|
|
9
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg" alt="Node.js ≥20"></a>
|
|
10
|
+
<a href="https://codecov.io/gh/Fats403/simple-ffmpegjs"><img src="https://codecov.io/gh/Fats403/simple-ffmpegjs/branch/main/graph/badge.svg" alt="Coverage"></a>
|
|
9
11
|
</p>
|
|
10
12
|
|
|
11
13
|
<p align="center">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-ffmpegjs",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Declarative video composition for Node.js — define clips, transitions, text, and audio as simple objects, and let FFmpeg handle the rest.",
|
|
5
5
|
"author": "Brayden Blackwell <braydenblackwell21@gmail.com> (https://github.com/Fats403)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,13 +33,16 @@
|
|
|
33
33
|
],
|
|
34
34
|
"sideEffects": false,
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
36
|
+
"node": ">=20"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"test": "vitest run",
|
|
40
40
|
"test:watch": "vitest",
|
|
41
41
|
"test:unit": "vitest run tests/unit",
|
|
42
|
-
"test:integration": "vitest run tests/integration"
|
|
42
|
+
"test:integration": "vitest run tests/integration",
|
|
43
|
+
"test:coverage": "vitest run --coverage",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"lint:fix": "eslint . --fix"
|
|
43
46
|
},
|
|
44
47
|
"keywords": [
|
|
45
48
|
"ffmpeg",
|
|
@@ -73,6 +76,10 @@
|
|
|
73
76
|
"nodejs"
|
|
74
77
|
],
|
|
75
78
|
"devDependencies": {
|
|
79
|
+
"@eslint/js": "^10.0.1",
|
|
80
|
+
"@stylistic/eslint-plugin": "^5.9.0",
|
|
81
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
82
|
+
"eslint": "^10.0.2",
|
|
76
83
|
"vitest": "^3.0.0"
|
|
77
84
|
}
|
|
78
85
|
}
|
package/src/core/media_info.js
CHANGED
|
@@ -114,7 +114,7 @@ async function probeMedia(filePath) {
|
|
|
114
114
|
} catch (error) {
|
|
115
115
|
throw new MediaNotFoundError(
|
|
116
116
|
`Failed to probe "${filePath}": ${error.message}`,
|
|
117
|
-
{ path: filePath }
|
|
117
|
+
{ path: filePath },
|
|
118
118
|
);
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -124,14 +124,14 @@ async function probeMedia(filePath) {
|
|
|
124
124
|
} catch (parseError) {
|
|
125
125
|
throw new MediaNotFoundError(
|
|
126
126
|
`Invalid JSON response from ffprobe for "${filePath}": ${parseError.message}`,
|
|
127
|
-
{ path: filePath }
|
|
127
|
+
{ path: filePath },
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
if (!metadata || !Array.isArray(metadata.streams)) {
|
|
132
132
|
throw new MediaNotFoundError(
|
|
133
133
|
`Invalid metadata structure for "${filePath}": missing or invalid 'streams' array`,
|
|
134
|
-
{ path: filePath }
|
|
134
|
+
{ path: filePath },
|
|
135
135
|
);
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -147,8 +147,8 @@ async function probeMedia(filePath) {
|
|
|
147
147
|
const duration = Number.isFinite(formatDuration)
|
|
148
148
|
? formatDuration
|
|
149
149
|
: Number.isFinite(streamDuration)
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
? streamDuration
|
|
151
|
+
: null;
|
|
152
152
|
|
|
153
153
|
// ── FPS ─────────────────────────────────────────────────────────────────
|
|
154
154
|
// Prefer avg_frame_rate, fall back to r_frame_rate
|
package/src/core/rotation.js
CHANGED
|
@@ -51,7 +51,7 @@ function unrotateVideo(inputUrl, options = {}) {
|
|
|
51
51
|
new FFmpegError(`ffmpeg process error: ${error.message}`, {
|
|
52
52
|
stderr,
|
|
53
53
|
command: `ffmpeg ${args.join(" ")}`,
|
|
54
|
-
})
|
|
54
|
+
}),
|
|
55
55
|
);
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -65,8 +65,8 @@ function unrotateVideo(inputUrl, options = {}) {
|
|
|
65
65
|
{
|
|
66
66
|
stderr,
|
|
67
67
|
command: `ffmpeg ${args.join(" ")}`,
|
|
68
|
-
}
|
|
69
|
-
)
|
|
68
|
+
},
|
|
69
|
+
),
|
|
70
70
|
);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
@@ -81,7 +81,7 @@ function unrotateVideo(inputUrl, options = {}) {
|
|
|
81
81
|
stderr,
|
|
82
82
|
command: `ffmpeg ${args.join(" ")}`,
|
|
83
83
|
exitCode: code,
|
|
84
|
-
})
|
|
84
|
+
}),
|
|
85
85
|
);
|
|
86
86
|
return;
|
|
87
87
|
}
|