dsh-media-converter 1.4.0 → 1.5.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/index.js +4 -2
- package/dist/lib/plan.js +6 -4
- package/dist/lib/platform.js +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import Schema from '@deepseek-ai/schemastery';
|
|
|
27
27
|
import { decodeBase64Payload } from './lib/base64.js';
|
|
28
28
|
import { FORMATS, buildArgs, copyArgs, defaultFormat, hardwareFor, extOf, extractPlan, formatsFor, kindByExt, kindOf, metaArgs, mimeOf, normalizeStderr, normalizeTrim, parseDuration, parseMeta, parseStreams, percentOf, progressSeconds, subtitlePlan, threadArgs, trimArgs, } from './lib/plan.js';
|
|
29
29
|
import { PTC_DEFAULT_RATES, WEIGHTS, blendPtcRate, capacityFor, estimatePtcCost, planPtcGroups, threadsFor, } from './lib/schedule.js';
|
|
30
|
-
import { expandDirs, ffmpegCandidates, imageioPatterns, isInsideDir, revealCommand, safeBaseName, } from './lib/platform.js';
|
|
30
|
+
import { expandDirs, ffmpegCandidates, hardwarePathAllowed, imageioPatterns, isInsideDir, revealCommand, safeBaseName, } from './lib/platform.js';
|
|
31
31
|
export const Config = Schema.object({
|
|
32
32
|
outputDir: Schema.string().default('').volatile(),
|
|
33
33
|
ffmpegPath: Schema.string().default('').volatile(),
|
|
@@ -813,7 +813,9 @@ export function apply(ctx, config) {
|
|
|
813
813
|
if (copy)
|
|
814
814
|
return { ext: format, kind: kindByExt(format), args: copy, copy: true };
|
|
815
815
|
}
|
|
816
|
-
|
|
816
|
+
// videotoolbox is Apple-only; elsewhere the hardware ask silently gets
|
|
817
|
+
// the software plan instead of a doomed ffmpeg command.
|
|
818
|
+
if (body.hardware && hardwarePathAllowed(process.platform)) {
|
|
817
819
|
const hw = hardwareFor(upload.kind, format, upload.size, upload.duration);
|
|
818
820
|
if (hw) {
|
|
819
821
|
return {
|
package/dist/lib/plan.js
CHANGED
|
@@ -206,7 +206,11 @@ export function copyArgs(kind, format, meta) {
|
|
|
206
206
|
return args;
|
|
207
207
|
}
|
|
208
208
|
// Apple VideoToolbox H.264. Only the containers that currently use libx264
|
|
209
|
-
// are eligible; the quality/bitrate estimate is explained in the UI.
|
|
209
|
+
// are eligible; the quality/bitrate estimate is explained in the UI. Frames
|
|
210
|
+
// stay on the GPU end to end: -hwaccel_output_format keeps the decoder's
|
|
211
|
+
// videotoolbox_vld frames, which the encoder accepts directly, and no
|
|
212
|
+
// -pix_fmt is set on purpose — forcing yuv420p would download every frame
|
|
213
|
+
// to the CPU for conversion and defeat the zero-copy path.
|
|
210
214
|
const HW_AUDIO = {
|
|
211
215
|
mp4: ['-c:a', 'aac', '-b:a', '192k', '-movflags', '+faststart'],
|
|
212
216
|
mov: ['-c:a', 'aac', '-b:a', '192k'],
|
|
@@ -221,7 +225,7 @@ export function hardwareFor(kind, format, size, duration) {
|
|
|
221
225
|
const totalKbps = duration > 0 ? (size * 8) / duration / 1000 : 0;
|
|
222
226
|
const videoKbps = Math.min(12000, Math.max(1500, Math.round(totalKbps - 192)));
|
|
223
227
|
return {
|
|
224
|
-
inputArgs: ['-hwaccel', 'videotoolbox'],
|
|
228
|
+
inputArgs: ['-hwaccel', 'videotoolbox', '-hwaccel_output_format', 'videotoolbox'],
|
|
225
229
|
args: [
|
|
226
230
|
'-c:v',
|
|
227
231
|
'h264_videotoolbox',
|
|
@@ -233,8 +237,6 @@ export function hardwareFor(kind, format, size, duration) {
|
|
|
233
237
|
String(videoKbps * 2) + 'k',
|
|
234
238
|
'-allow_sw',
|
|
235
239
|
'1',
|
|
236
|
-
'-pix_fmt',
|
|
237
|
-
'yuv420p',
|
|
238
240
|
...audio,
|
|
239
241
|
],
|
|
240
242
|
};
|
package/dist/lib/platform.js
CHANGED
|
@@ -107,4 +107,9 @@ export function safeBaseName(raw, platform = process.platform) {
|
|
|
107
107
|
stem = '_' + stem;
|
|
108
108
|
return stem;
|
|
109
109
|
}
|
|
110
|
+
// The hardware transcode path speaks videotoolbox, which only exists on
|
|
111
|
+
// Apple platforms; everywhere else the caller gets the software plan.
|
|
112
|
+
export function hardwarePathAllowed(platform) {
|
|
113
|
+
return platform === 'darwin';
|
|
114
|
+
}
|
|
110
115
|
//# sourceMappingURL=platform.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-media-converter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Local media toolbox for DeepSeek Harness: convert, trim, split tracks, export subtitles, compress images, edit metadata, and Base64 — all through local ffmpeg.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|