@editframe/assets 0.15.0-beta.17 → 0.15.0-beta.5
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/Probe.d.ts +38 -41
- package/dist/Probe.js +8 -29
- package/dist/idempotentTask.js +1 -27
- package/dist/types.json +1 -0
- package/package.json +3 -7
- package/dist/tasks/cacheRemoteAsset.d.ts +0 -1
- package/src/tasks/cacheRemoteAsset.ts +0 -0
- package/types.json +0 -1
package/dist/Probe.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ export declare const AudioStreamSchema: z.ZodObject<{
|
|
|
10
10
|
sample_fmt: z.ZodString;
|
|
11
11
|
sample_rate: z.ZodString;
|
|
12
12
|
channels: z.ZodNumber;
|
|
13
|
-
channel_layout: z.
|
|
13
|
+
channel_layout: z.ZodString;
|
|
14
14
|
bits_per_sample: z.ZodNumber;
|
|
15
15
|
initial_padding: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
r_frame_rate: z.ZodString;
|
|
17
17
|
avg_frame_rate: z.ZodString;
|
|
18
18
|
time_base: z.ZodString;
|
|
19
|
-
start_pts: z.
|
|
20
|
-
start_time: z.
|
|
19
|
+
start_pts: z.ZodNumber;
|
|
20
|
+
start_time: z.ZodNumber;
|
|
21
21
|
duration_ts: z.ZodNumber;
|
|
22
22
|
duration: z.ZodNumber;
|
|
23
23
|
bit_rate: z.ZodString;
|
|
@@ -33,17 +33,17 @@ export declare const AudioStreamSchema: z.ZodObject<{
|
|
|
33
33
|
sample_fmt: string;
|
|
34
34
|
sample_rate: string;
|
|
35
35
|
channels: number;
|
|
36
|
+
channel_layout: string;
|
|
36
37
|
bits_per_sample: number;
|
|
37
38
|
r_frame_rate: string;
|
|
38
39
|
avg_frame_rate: string;
|
|
39
40
|
time_base: string;
|
|
41
|
+
start_pts: number;
|
|
42
|
+
start_time: number;
|
|
40
43
|
duration_ts: number;
|
|
41
44
|
bit_rate: string;
|
|
42
45
|
disposition: Record<string, unknown>;
|
|
43
|
-
channel_layout?: string | undefined;
|
|
44
46
|
initial_padding?: number | undefined;
|
|
45
|
-
start_pts?: number | undefined;
|
|
46
|
-
start_time?: number | undefined;
|
|
47
47
|
}, {
|
|
48
48
|
duration: number;
|
|
49
49
|
index: number;
|
|
@@ -55,17 +55,17 @@ export declare const AudioStreamSchema: z.ZodObject<{
|
|
|
55
55
|
sample_fmt: string;
|
|
56
56
|
sample_rate: string;
|
|
57
57
|
channels: number;
|
|
58
|
+
channel_layout: string;
|
|
58
59
|
bits_per_sample: number;
|
|
59
60
|
r_frame_rate: string;
|
|
60
61
|
avg_frame_rate: string;
|
|
61
62
|
time_base: string;
|
|
63
|
+
start_pts: number;
|
|
64
|
+
start_time: number;
|
|
62
65
|
duration_ts: number;
|
|
63
66
|
bit_rate: string;
|
|
64
67
|
disposition: Record<string, unknown>;
|
|
65
|
-
channel_layout?: string | undefined;
|
|
66
68
|
initial_padding?: number | undefined;
|
|
67
|
-
start_pts?: number | undefined;
|
|
68
|
-
start_time?: number | undefined;
|
|
69
69
|
}>;
|
|
70
70
|
export type AudioStreamSchema = z.infer<typeof AudioStreamSchema>;
|
|
71
71
|
export declare const VideoStreamSchema: z.ZodObject<{
|
|
@@ -154,14 +154,14 @@ declare const StreamSchema: z.ZodDiscriminatedUnion<"codec_type", [z.ZodObject<{
|
|
|
154
154
|
sample_fmt: z.ZodString;
|
|
155
155
|
sample_rate: z.ZodString;
|
|
156
156
|
channels: z.ZodNumber;
|
|
157
|
-
channel_layout: z.
|
|
157
|
+
channel_layout: z.ZodString;
|
|
158
158
|
bits_per_sample: z.ZodNumber;
|
|
159
159
|
initial_padding: z.ZodOptional<z.ZodNumber>;
|
|
160
160
|
r_frame_rate: z.ZodString;
|
|
161
161
|
avg_frame_rate: z.ZodString;
|
|
162
162
|
time_base: z.ZodString;
|
|
163
|
-
start_pts: z.
|
|
164
|
-
start_time: z.
|
|
163
|
+
start_pts: z.ZodNumber;
|
|
164
|
+
start_time: z.ZodNumber;
|
|
165
165
|
duration_ts: z.ZodNumber;
|
|
166
166
|
duration: z.ZodNumber;
|
|
167
167
|
bit_rate: z.ZodString;
|
|
@@ -177,17 +177,17 @@ declare const StreamSchema: z.ZodDiscriminatedUnion<"codec_type", [z.ZodObject<{
|
|
|
177
177
|
sample_fmt: string;
|
|
178
178
|
sample_rate: string;
|
|
179
179
|
channels: number;
|
|
180
|
+
channel_layout: string;
|
|
180
181
|
bits_per_sample: number;
|
|
181
182
|
r_frame_rate: string;
|
|
182
183
|
avg_frame_rate: string;
|
|
183
184
|
time_base: string;
|
|
185
|
+
start_pts: number;
|
|
186
|
+
start_time: number;
|
|
184
187
|
duration_ts: number;
|
|
185
188
|
bit_rate: string;
|
|
186
189
|
disposition: Record<string, unknown>;
|
|
187
|
-
channel_layout?: string | undefined;
|
|
188
190
|
initial_padding?: number | undefined;
|
|
189
|
-
start_pts?: number | undefined;
|
|
190
|
-
start_time?: number | undefined;
|
|
191
191
|
}, {
|
|
192
192
|
duration: number;
|
|
193
193
|
index: number;
|
|
@@ -199,17 +199,17 @@ declare const StreamSchema: z.ZodDiscriminatedUnion<"codec_type", [z.ZodObject<{
|
|
|
199
199
|
sample_fmt: string;
|
|
200
200
|
sample_rate: string;
|
|
201
201
|
channels: number;
|
|
202
|
+
channel_layout: string;
|
|
202
203
|
bits_per_sample: number;
|
|
203
204
|
r_frame_rate: string;
|
|
204
205
|
avg_frame_rate: string;
|
|
205
206
|
time_base: string;
|
|
207
|
+
start_pts: number;
|
|
208
|
+
start_time: number;
|
|
206
209
|
duration_ts: number;
|
|
207
210
|
bit_rate: string;
|
|
208
211
|
disposition: Record<string, unknown>;
|
|
209
|
-
channel_layout?: string | undefined;
|
|
210
212
|
initial_padding?: number | undefined;
|
|
211
|
-
start_pts?: number | undefined;
|
|
212
|
-
start_time?: number | undefined;
|
|
213
213
|
}>, z.ZodObject<{
|
|
214
214
|
index: z.ZodNumber;
|
|
215
215
|
codec_name: z.ZodString;
|
|
@@ -295,14 +295,14 @@ declare const ProbeSchema: z.ZodObject<{
|
|
|
295
295
|
sample_fmt: z.ZodString;
|
|
296
296
|
sample_rate: z.ZodString;
|
|
297
297
|
channels: z.ZodNumber;
|
|
298
|
-
channel_layout: z.
|
|
298
|
+
channel_layout: z.ZodString;
|
|
299
299
|
bits_per_sample: z.ZodNumber;
|
|
300
300
|
initial_padding: z.ZodOptional<z.ZodNumber>;
|
|
301
301
|
r_frame_rate: z.ZodString;
|
|
302
302
|
avg_frame_rate: z.ZodString;
|
|
303
303
|
time_base: z.ZodString;
|
|
304
|
-
start_pts: z.
|
|
305
|
-
start_time: z.
|
|
304
|
+
start_pts: z.ZodNumber;
|
|
305
|
+
start_time: z.ZodNumber;
|
|
306
306
|
duration_ts: z.ZodNumber;
|
|
307
307
|
duration: z.ZodNumber;
|
|
308
308
|
bit_rate: z.ZodString;
|
|
@@ -318,17 +318,17 @@ declare const ProbeSchema: z.ZodObject<{
|
|
|
318
318
|
sample_fmt: string;
|
|
319
319
|
sample_rate: string;
|
|
320
320
|
channels: number;
|
|
321
|
+
channel_layout: string;
|
|
321
322
|
bits_per_sample: number;
|
|
322
323
|
r_frame_rate: string;
|
|
323
324
|
avg_frame_rate: string;
|
|
324
325
|
time_base: string;
|
|
326
|
+
start_pts: number;
|
|
327
|
+
start_time: number;
|
|
325
328
|
duration_ts: number;
|
|
326
329
|
bit_rate: string;
|
|
327
330
|
disposition: Record<string, unknown>;
|
|
328
|
-
channel_layout?: string | undefined;
|
|
329
331
|
initial_padding?: number | undefined;
|
|
330
|
-
start_pts?: number | undefined;
|
|
331
|
-
start_time?: number | undefined;
|
|
332
332
|
}, {
|
|
333
333
|
duration: number;
|
|
334
334
|
index: number;
|
|
@@ -340,17 +340,17 @@ declare const ProbeSchema: z.ZodObject<{
|
|
|
340
340
|
sample_fmt: string;
|
|
341
341
|
sample_rate: string;
|
|
342
342
|
channels: number;
|
|
343
|
+
channel_layout: string;
|
|
343
344
|
bits_per_sample: number;
|
|
344
345
|
r_frame_rate: string;
|
|
345
346
|
avg_frame_rate: string;
|
|
346
347
|
time_base: string;
|
|
348
|
+
start_pts: number;
|
|
349
|
+
start_time: number;
|
|
347
350
|
duration_ts: number;
|
|
348
351
|
bit_rate: string;
|
|
349
352
|
disposition: Record<string, unknown>;
|
|
350
|
-
channel_layout?: string | undefined;
|
|
351
353
|
initial_padding?: number | undefined;
|
|
352
|
-
start_pts?: number | undefined;
|
|
353
|
-
start_time?: number | undefined;
|
|
354
354
|
}>, z.ZodObject<{
|
|
355
355
|
index: z.ZodNumber;
|
|
356
356
|
codec_name: z.ZodString;
|
|
@@ -482,17 +482,17 @@ declare const ProbeSchema: z.ZodObject<{
|
|
|
482
482
|
sample_fmt: string;
|
|
483
483
|
sample_rate: string;
|
|
484
484
|
channels: number;
|
|
485
|
+
channel_layout: string;
|
|
485
486
|
bits_per_sample: number;
|
|
486
487
|
r_frame_rate: string;
|
|
487
488
|
avg_frame_rate: string;
|
|
488
489
|
time_base: string;
|
|
490
|
+
start_pts: number;
|
|
491
|
+
start_time: number;
|
|
489
492
|
duration_ts: number;
|
|
490
493
|
bit_rate: string;
|
|
491
494
|
disposition: Record<string, unknown>;
|
|
492
|
-
channel_layout?: string | undefined;
|
|
493
495
|
initial_padding?: number | undefined;
|
|
494
|
-
start_pts?: number | undefined;
|
|
495
|
-
start_time?: number | undefined;
|
|
496
496
|
} | {
|
|
497
497
|
index: number;
|
|
498
498
|
codec_name: string;
|
|
@@ -542,17 +542,17 @@ declare const ProbeSchema: z.ZodObject<{
|
|
|
542
542
|
sample_fmt: string;
|
|
543
543
|
sample_rate: string;
|
|
544
544
|
channels: number;
|
|
545
|
+
channel_layout: string;
|
|
545
546
|
bits_per_sample: number;
|
|
546
547
|
r_frame_rate: string;
|
|
547
548
|
avg_frame_rate: string;
|
|
548
549
|
time_base: string;
|
|
550
|
+
start_pts: number;
|
|
551
|
+
start_time: number;
|
|
549
552
|
duration_ts: number;
|
|
550
553
|
bit_rate: string;
|
|
551
554
|
disposition: Record<string, unknown>;
|
|
552
|
-
channel_layout?: string | undefined;
|
|
553
555
|
initial_padding?: number | undefined;
|
|
554
|
-
start_pts?: number | undefined;
|
|
555
|
-
start_time?: number | undefined;
|
|
556
556
|
} | {
|
|
557
557
|
index: number;
|
|
558
558
|
codec_name: string;
|
|
@@ -638,17 +638,17 @@ export declare class Probe {
|
|
|
638
638
|
sample_fmt: string;
|
|
639
639
|
sample_rate: string;
|
|
640
640
|
channels: number;
|
|
641
|
+
channel_layout: string;
|
|
641
642
|
bits_per_sample: number;
|
|
642
643
|
r_frame_rate: string;
|
|
643
644
|
avg_frame_rate: string;
|
|
644
645
|
time_base: string;
|
|
646
|
+
start_pts: number;
|
|
647
|
+
start_time: number;
|
|
645
648
|
duration_ts: number;
|
|
646
649
|
bit_rate: string;
|
|
647
650
|
disposition: Record<string, unknown>;
|
|
648
|
-
channel_layout?: string | undefined;
|
|
649
651
|
initial_padding?: number | undefined;
|
|
650
|
-
start_pts?: number | undefined;
|
|
651
|
-
start_time?: number | undefined;
|
|
652
652
|
} | {
|
|
653
653
|
index: number;
|
|
654
654
|
codec_name: string;
|
|
@@ -693,13 +693,10 @@ export declare class Probe {
|
|
|
693
693
|
get hasAudio(): boolean;
|
|
694
694
|
get hasVideo(): boolean;
|
|
695
695
|
get isAudioOnly(): boolean;
|
|
696
|
-
get isMp3(): boolean;
|
|
697
696
|
get isVideoOnly(): boolean;
|
|
698
697
|
get mustProcess(): boolean;
|
|
699
|
-
get
|
|
700
|
-
get
|
|
701
|
-
get ffmpegAudioOutputOptions(): string[];
|
|
702
|
-
get ffmpegVideoOutputOptions(): string[];
|
|
698
|
+
get ffmpegAudioOptions(): string[];
|
|
699
|
+
get ffmpegVideoOptions(): string[];
|
|
703
700
|
createConformingReadstream(): Readable;
|
|
704
701
|
}
|
|
705
702
|
export {};
|
package/dist/Probe.js
CHANGED
|
@@ -15,14 +15,14 @@ const AudioStreamSchema = z.object({
|
|
|
15
15
|
sample_fmt: z.string(),
|
|
16
16
|
sample_rate: z.string(),
|
|
17
17
|
channels: z.number(),
|
|
18
|
-
channel_layout: z.string()
|
|
18
|
+
channel_layout: z.string(),
|
|
19
19
|
bits_per_sample: z.number(),
|
|
20
20
|
initial_padding: z.number().optional(),
|
|
21
21
|
r_frame_rate: z.string(),
|
|
22
22
|
avg_frame_rate: z.string(),
|
|
23
23
|
time_base: z.string(),
|
|
24
|
-
start_pts: z.number()
|
|
25
|
-
start_time: z.coerce.number()
|
|
24
|
+
start_pts: z.number(),
|
|
25
|
+
start_time: z.coerce.number(),
|
|
26
26
|
duration_ts: z.number(),
|
|
27
27
|
duration: z.coerce.number(),
|
|
28
28
|
bit_rate: z.string(),
|
|
@@ -188,30 +188,13 @@ class Probe {
|
|
|
188
188
|
get isAudioOnly() {
|
|
189
189
|
return this.audioStreams.length > 0 && this.videoStreams.length === 0;
|
|
190
190
|
}
|
|
191
|
-
get isMp3() {
|
|
192
|
-
return this.audioStreams.some(
|
|
193
|
-
(stream) => stream.codec_name === "mp3"
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
191
|
get isVideoOnly() {
|
|
197
192
|
return this.audioStreams.length === 0 && this.videoStreams.length > 0;
|
|
198
193
|
}
|
|
199
194
|
get mustProcess() {
|
|
200
195
|
return this.mustReencodeAudio || this.mustReencodeVideo || this.mustRemux;
|
|
201
196
|
}
|
|
202
|
-
get
|
|
203
|
-
if (!this.hasAudio) {
|
|
204
|
-
return [];
|
|
205
|
-
}
|
|
206
|
-
if (this.isMp3) {
|
|
207
|
-
return ["-c:a", "mp3"];
|
|
208
|
-
}
|
|
209
|
-
return [];
|
|
210
|
-
}
|
|
211
|
-
get ffmpegVideoInputOptions() {
|
|
212
|
-
return [];
|
|
213
|
-
}
|
|
214
|
-
get ffmpegAudioOutputOptions() {
|
|
197
|
+
get ffmpegAudioOptions() {
|
|
215
198
|
if (!this.hasAudio) {
|
|
216
199
|
return [];
|
|
217
200
|
}
|
|
@@ -220,14 +203,12 @@ class Probe {
|
|
|
220
203
|
"-c:a",
|
|
221
204
|
"aac",
|
|
222
205
|
"-b:a",
|
|
223
|
-
"192k"
|
|
224
|
-
"-ar",
|
|
225
|
-
"48000"
|
|
206
|
+
"192k"
|
|
226
207
|
];
|
|
227
208
|
}
|
|
228
209
|
return ["-c:a", "copy"];
|
|
229
210
|
}
|
|
230
|
-
get
|
|
211
|
+
get ffmpegVideoOptions() {
|
|
231
212
|
if (!this.hasVideo) {
|
|
232
213
|
return [];
|
|
233
214
|
}
|
|
@@ -258,12 +239,10 @@ class Probe {
|
|
|
258
239
|
return createReadStream(this.absolutePath);
|
|
259
240
|
}
|
|
260
241
|
const ffmpegConformanceArgs = [
|
|
261
|
-
...this.ffmpegAudioInputOptions,
|
|
262
|
-
...this.ffmpegVideoInputOptions,
|
|
263
242
|
"-i",
|
|
264
243
|
this.absolutePath,
|
|
265
|
-
...this.
|
|
266
|
-
...this.
|
|
244
|
+
...this.ffmpegAudioOptions,
|
|
245
|
+
...this.ffmpegVideoOptions,
|
|
267
246
|
"-f",
|
|
268
247
|
"mp4",
|
|
269
248
|
"-movflags",
|
package/dist/idempotentTask.js
CHANGED
|
@@ -12,34 +12,8 @@ const idempotentTask = ({
|
|
|
12
12
|
const tasks = {};
|
|
13
13
|
return async (rootDir, absolutePath, ...args) => {
|
|
14
14
|
const log = debug(`ef:${label}`);
|
|
15
|
-
const cacheDirRoot = path.join(rootDir, ".cache");
|
|
16
|
-
await mkdir(cacheDirRoot, { recursive: true });
|
|
17
|
-
log(`Running ef:${label} task for ${absolutePath} in ${rootDir}`);
|
|
18
|
-
if (absolutePath.includes("http")) {
|
|
19
|
-
const safePath = absolutePath.replace(/[^a-zA-Z0-9]/g, "_");
|
|
20
|
-
const cachePath2 = path.join(rootDir, ".cache", `${safePath}.file`);
|
|
21
|
-
if (existsSync(absolutePath)) {
|
|
22
|
-
log(`Already cached ${absolutePath}`);
|
|
23
|
-
} else {
|
|
24
|
-
const response = await fetch(absolutePath);
|
|
25
|
-
const stream = response.body;
|
|
26
|
-
if (response.ok && stream) {
|
|
27
|
-
const writeStream = createWriteStream(cachePath2);
|
|
28
|
-
const readable = Readable.fromWeb(stream);
|
|
29
|
-
readable.pipe(writeStream);
|
|
30
|
-
await new Promise((resolve, reject) => {
|
|
31
|
-
readable.on("error", reject);
|
|
32
|
-
writeStream.on("error", reject);
|
|
33
|
-
writeStream.on("finish", resolve);
|
|
34
|
-
});
|
|
35
|
-
absolutePath = cachePath2;
|
|
36
|
-
} else {
|
|
37
|
-
throw new Error(`Failed to fetch file from URL ${absolutePath}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
15
|
const md5 = await md5FilePath(absolutePath);
|
|
42
|
-
const cacheDir = path.join(
|
|
16
|
+
const cacheDir = path.join(rootDir, ".cache", md5);
|
|
43
17
|
log(`Cache dir: ${cacheDir}`);
|
|
44
18
|
await mkdir(cacheDir, { recursive: true });
|
|
45
19
|
const cachePath = path.join(cacheDir, filename(absolutePath, ...args));
|