@sogni-ai/sogni-creative-agent-skill 3.40.1 → 3.42.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/.agents/skills/sogni-creative-agent-skill/SKILL.md +4 -1
- package/.agents/skills/sogni-creative-agent-skill/references/hosted-api.md +11 -2
- package/.agents/skills/sogni-creative-agent-skill/references/models.md +21 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +24 -0
- package/README.md +29 -3
- package/SKILL.md +13 -3
- package/attribution.mjs +3 -0
- package/desktop-extension/README.md +14 -5
- package/desktop-extension/manifest.json +1 -1
- package/desktop-extension/server/index.mjs +0 -0
- package/desktop-extension/server/resolve.mjs +10 -2
- package/generated/creative-agent-runtime.mjs +132 -3
- package/host-launchers/goose.mjs +4 -0
- package/llm.txt +10 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +8 -5
- package/references/hosted-api.md +11 -2
- package/references/models.md +21 -0
- package/scripts/build-mcpb.mjs +44 -0
- package/skill-package.json +1 -1
- package/skills/README.md +1 -1
- package/skills/video_editing.md +4 -1
- package/sogni-agent.mjs +290 -9
- package/version.mjs +1 -1
package/sogni-agent.mjs
CHANGED
|
@@ -1368,6 +1368,164 @@ function resolveRtxVsrDimensions(sourceWidth, sourceHeight, { scale = 2, targetL
|
|
|
1368
1368
|
};
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
|
+
// Promptless FlashVSR video upscaling (--upscale-video). The server probes the
|
|
1372
|
+
// uploaded source and stays authoritative; these public limits let the CLI
|
|
1373
|
+
// explain an unsupported clip before any upload.
|
|
1374
|
+
const FLASHVSR_MODEL_ID = 'flashvsr_v1.1_tiny_long_bf16';
|
|
1375
|
+
const VIDEO_UPSCALE_RESOLUTIONS = [1080, 1440];
|
|
1376
|
+
const VIDEO_UPSCALE_DEFAULT_RESOLUTION = 1440;
|
|
1377
|
+
const VIDEO_UPSCALE_MAX_SOURCE_SHORT_EDGE = 768;
|
|
1378
|
+
// Source area counted in 64-pixel blocks: about 1344x768, or 768x1344 in portrait.
|
|
1379
|
+
const VIDEO_UPSCALE_MAX_SOURCE_BLOCK_PIXELS = 1344 * 768;
|
|
1380
|
+
const VIDEO_UPSCALE_MIN_FPS = 1;
|
|
1381
|
+
const VIDEO_UPSCALE_MAX_FPS = 60;
|
|
1382
|
+
const VIDEO_UPSCALE_MAX_BYTES = 100 * 1024 * 1024;
|
|
1383
|
+
const VIDEO_UPSCALE_MAX_OUTPUT_LONG_EDGE = 2560;
|
|
1384
|
+
const VIDEO_UPSCALE_MAX_OUTPUT_PIXELS = 2560 * 1440;
|
|
1385
|
+
const FLASHVSR_UNAVAILABLE_MESSAGE = 'FlashVSR video upscaling is not available yet. Please try again later.';
|
|
1386
|
+
|
|
1387
|
+
function parseVideoUpscaleResolutionValue(raw, flag) {
|
|
1388
|
+
const value = Number(String(raw ?? '').trim().toLowerCase().replace(/p$/, ''));
|
|
1389
|
+
if (!VIDEO_UPSCALE_RESOLUTIONS.includes(value)) {
|
|
1390
|
+
fatalCliError(`${flag} must be 1080 or 1440.`, {
|
|
1391
|
+
code: 'INVALID_ARGUMENT',
|
|
1392
|
+
details: { flag, value: raw, allowed: VIDEO_UPSCALE_RESOLUTIONS }
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
return value;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
function videoUpscaleOutputFor(sourceWidth, sourceHeight, resolution) {
|
|
1399
|
+
const ratio = resolution / Math.min(sourceWidth, sourceHeight);
|
|
1400
|
+
if (ratio > 2) {
|
|
1401
|
+
return {
|
|
1402
|
+
problem: `${resolution}p needs a source at least ${resolution / 2}px on its short edge; this video is ${sourceWidth}×${sourceHeight}.`
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
if (ratio <= 1) {
|
|
1406
|
+
return { problem: `This ${sourceWidth}×${sourceHeight} video is already ${resolution}p or larger.` };
|
|
1407
|
+
}
|
|
1408
|
+
const width = Math.round((sourceWidth * ratio) / 2) * 2;
|
|
1409
|
+
const height = Math.round((sourceHeight * ratio) / 2) * 2;
|
|
1410
|
+
if (Math.max(width, height) > VIDEO_UPSCALE_MAX_OUTPUT_LONG_EDGE || width * height > VIDEO_UPSCALE_MAX_OUTPUT_PIXELS) {
|
|
1411
|
+
return {
|
|
1412
|
+
problem: `At ${resolution}p this ${sourceWidth}×${sourceHeight} video would be ${width}×${height}, larger than the 2560×1440 upscale output limit.`
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
return { resolution, width, height };
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
// Output geometry matches the server's derivation: the short edge becomes the
|
|
1419
|
+
// target and both edges round to even pixels. Without an explicit resolution,
|
|
1420
|
+
// 1440p is used when the source allows it and 1080p otherwise.
|
|
1421
|
+
function resolveVideoUpscaleOutput(sourceWidth, sourceHeight, requestedResolution = null) {
|
|
1422
|
+
if (Math.min(sourceWidth, sourceHeight) > VIDEO_UPSCALE_MAX_SOURCE_SHORT_EDGE) {
|
|
1423
|
+
fatalCliError(
|
|
1424
|
+
`This video is ${sourceWidth}×${sourceHeight}; video upscaling accepts sources up to ${VIDEO_UPSCALE_MAX_SOURCE_SHORT_EDGE}px on the short edge.`,
|
|
1425
|
+
{ code: 'INVALID_UPSCALE_SOURCE', details: { sourceWidth, sourceHeight } }
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
if (Math.ceil(sourceWidth / 64) * 64 * Math.ceil(sourceHeight / 64) * 64 > VIDEO_UPSCALE_MAX_SOURCE_BLOCK_PIXELS) {
|
|
1429
|
+
fatalCliError(
|
|
1430
|
+
`This video is ${sourceWidth}×${sourceHeight}; video upscaling accepts sources up to about 1344×768 pixels, or 768×1344 in portrait.`,
|
|
1431
|
+
{ code: 'INVALID_UPSCALE_SOURCE', details: { sourceWidth, sourceHeight } }
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
const candidates = requestedResolution ? [requestedResolution] : [VIDEO_UPSCALE_DEFAULT_RESOLUTION, 1080];
|
|
1435
|
+
let lastProblem = '';
|
|
1436
|
+
for (const resolution of candidates) {
|
|
1437
|
+
const output = videoUpscaleOutputFor(sourceWidth, sourceHeight, resolution);
|
|
1438
|
+
if (!output.problem) return output;
|
|
1439
|
+
lastProblem = output.problem;
|
|
1440
|
+
}
|
|
1441
|
+
fatalCliError(lastProblem, {
|
|
1442
|
+
code: 'INVALID_UPSCALE_SIZE',
|
|
1443
|
+
details: { sourceWidth, sourceHeight, requestedResolution },
|
|
1444
|
+
...(requestedResolution === 1440 ? { hint: 'Use --upscale-resolution 1080 for this source.' } : {})
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// Read the exact source geometry, frame count, and frame rate with ffprobe so
|
|
1449
|
+
// the request matches what the server verifies after upload.
|
|
1450
|
+
async function probeVideoUpscaleSource(buffer, sourceLabel) {
|
|
1451
|
+
if (buffer.length > VIDEO_UPSCALE_MAX_BYTES) {
|
|
1452
|
+
fatalCliError('Video upscaling accepts source files up to 100 MB.', {
|
|
1453
|
+
code: 'INVALID_UPSCALE_SOURCE',
|
|
1454
|
+
details: { sizeBytes: buffer.length, maxBytes: VIDEO_UPSCALE_MAX_BYTES }
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
const ffprobePath = getEnv('FFPROBE_PATH') || 'ffprobe';
|
|
1458
|
+
sanitizePath(ffprobePath, 'FFPROBE_PATH');
|
|
1459
|
+
const tempDir = createTrackedTempDir('sogni-video-upscale-probe-');
|
|
1460
|
+
const inputPath = mediaTempInputPath(tempDir, sourceLabel, '.mp4');
|
|
1461
|
+
let result;
|
|
1462
|
+
try {
|
|
1463
|
+
writeFileSync(inputPath, buffer);
|
|
1464
|
+
result = await runCommand(ffprobePath, [
|
|
1465
|
+
'-v', 'error',
|
|
1466
|
+
'-select_streams', 'v:0',
|
|
1467
|
+
'-count_frames',
|
|
1468
|
+
'-show_entries',
|
|
1469
|
+
'stream=width,height,nb_read_frames,avg_frame_rate,r_frame_rate,sample_aspect_ratio,color_transfer:stream_side_data=rotation',
|
|
1470
|
+
'-of', 'json',
|
|
1471
|
+
inputPath,
|
|
1472
|
+
], { captureOutput: true });
|
|
1473
|
+
} finally {
|
|
1474
|
+
try { if (existsSync(inputPath)) unlinkSync(inputPath); } catch {}
|
|
1475
|
+
try { rmdirSync(tempDir); } catch {}
|
|
1476
|
+
}
|
|
1477
|
+
if (result?.error && result.status === null) {
|
|
1478
|
+
const err = new Error('ffprobe is required for --upscale-video.');
|
|
1479
|
+
err.code = 'MISSING_FFPROBE';
|
|
1480
|
+
err.hint = 'Install ffmpeg/ffprobe (e.g. `brew install ffmpeg` / `apt install ffmpeg`) or set FFPROBE_PATH to a working ffprobe binary.';
|
|
1481
|
+
err.details = { ffprobePath };
|
|
1482
|
+
throw err;
|
|
1483
|
+
}
|
|
1484
|
+
let stream = null;
|
|
1485
|
+
try {
|
|
1486
|
+
stream = JSON.parse(result?.stdout || '{}')?.streams?.[0] ?? null;
|
|
1487
|
+
} catch {
|
|
1488
|
+
stream = null;
|
|
1489
|
+
}
|
|
1490
|
+
const width = Number(stream?.width);
|
|
1491
|
+
const height = Number(stream?.height);
|
|
1492
|
+
const frames = Number(stream?.nb_read_frames);
|
|
1493
|
+
const fps = parseFrameRate(stream?.avg_frame_rate);
|
|
1494
|
+
if (result?.status !== 0 || ![width, height, frames].every((value) => Number.isSafeInteger(value) && value > 0) || !fps) {
|
|
1495
|
+
fatalCliError('The source video dimensions, frame count, or frame rate could not be read. Use an MP4 or MOV file of 100 MB or less.', {
|
|
1496
|
+
code: 'INVALID_UPSCALE_SOURCE',
|
|
1497
|
+
details: { source: sourceLabel }
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
if (fps < VIDEO_UPSCALE_MIN_FPS || fps > VIDEO_UPSCALE_MAX_FPS) {
|
|
1501
|
+
fatalCliError(`This video runs at ${Number(fps.toFixed(3))} fps; video upscaling accepts ${VIDEO_UPSCALE_MIN_FPS}-${VIDEO_UPSCALE_MAX_FPS} fps.`, {
|
|
1502
|
+
code: 'INVALID_UPSCALE_SOURCE',
|
|
1503
|
+
details: { fps }
|
|
1504
|
+
});
|
|
1505
|
+
}
|
|
1506
|
+
// The server owns the maximum clip length; submit the exact source count.
|
|
1507
|
+
const rotated = Array.isArray(stream?.side_data_list)
|
|
1508
|
+
&& stream.side_data_list.some((item) => Number(item?.rotation || 0) % 360 !== 0);
|
|
1509
|
+
if (!['1:1', 'N/A', undefined].includes(stream?.sample_aspect_ratio) || rotated) {
|
|
1510
|
+
fatalCliError('Export the video with square pixels and its rotation applied before upscaling.', {
|
|
1511
|
+
code: 'INVALID_UPSCALE_SOURCE'
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
if (['smpte2084', 'arib-std-b67'].includes(stream?.color_transfer ?? '')) {
|
|
1515
|
+
fatalCliError('Convert HDR video to SDR before upscaling.', { code: 'INVALID_UPSCALE_SOURCE' });
|
|
1516
|
+
}
|
|
1517
|
+
return { width, height, frames, fps, sizeBytes: buffer.length };
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
function annotateVideoUpscaleError(error) {
|
|
1521
|
+
const message = String(error?.message || error?.originalError?.message || '');
|
|
1522
|
+
if (error && typeof error === 'object' && message.includes(FLASHVSR_UNAVAILABLE_MESSAGE)) {
|
|
1523
|
+
if (!error.code || error.code === 'PROJECT_ERROR') error.code = 'MODEL_UNAVAILABLE';
|
|
1524
|
+
error.hint = 'FlashVSR upscaling workers are not online yet, so nothing was charged. Try again later.';
|
|
1525
|
+
}
|
|
1526
|
+
return error;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1371
1529
|
// Safety cap for -n/--count: every output is a paid generation, so a typo like
|
|
1372
1530
|
// `-n 1000` (meant `-n 10`) must not launch a thousand-render batch. Raise
|
|
1373
1531
|
// deliberately with SOGNI_MAX_COUNT when a bigger batch is really wanted.
|
|
@@ -2721,6 +2879,8 @@ const options = {
|
|
|
2721
2879
|
upscaleImage: null, // Source image for promptless RTX VSR upscaling
|
|
2722
2880
|
upscaleScale: 2,
|
|
2723
2881
|
upscaleTargetLongestEdge: null,
|
|
2882
|
+
upscaleVideo: null, // Source video for promptless FlashVSR upscaling
|
|
2883
|
+
upscaleResolution: null, // FlashVSR output short edge (1080 | 1440)
|
|
2724
2884
|
looping: false, // Create looping video (i2v only): generate A→B then B→A and concatenate
|
|
2725
2885
|
photobooth: false, // Photobooth mode (InstantID face transfer)
|
|
2726
2886
|
cnStrength: null, // ControlNet strength override
|
|
@@ -2907,6 +3067,8 @@ const cliSet = {
|
|
|
2907
3067
|
upscaleImage: false,
|
|
2908
3068
|
upscaleScale: false,
|
|
2909
3069
|
upscaleTargetLongestEdge: false,
|
|
3070
|
+
upscaleVideo: false,
|
|
3071
|
+
upscaleResolution: false,
|
|
2910
3072
|
looping: false,
|
|
2911
3073
|
photobooth: false,
|
|
2912
3074
|
cnStrength: false,
|
|
@@ -3308,6 +3470,16 @@ for (let i = 0; i < args.length; i++) {
|
|
|
3308
3470
|
RTX_VSR_MAX_DIMENSION
|
|
3309
3471
|
);
|
|
3310
3472
|
cliSet.upscaleTargetLongestEdge = true;
|
|
3473
|
+
} else if (arg === '--upscale-video') {
|
|
3474
|
+
const raw = expandHomePath(requireFlagValue(args, i, arg));
|
|
3475
|
+
i++;
|
|
3476
|
+
options.upscaleVideo = raw;
|
|
3477
|
+
cliSet.upscaleVideo = true;
|
|
3478
|
+
} else if (arg === '--upscale-resolution') {
|
|
3479
|
+
const raw = requireFlagValue(args, i, arg);
|
|
3480
|
+
i++;
|
|
3481
|
+
options.upscaleResolution = parseVideoUpscaleResolutionValue(raw, arg);
|
|
3482
|
+
cliSet.upscaleResolution = true;
|
|
3311
3483
|
} else if (arg === '--photobooth') {
|
|
3312
3484
|
options.photobooth = true;
|
|
3313
3485
|
cliSet.photobooth = true;
|
|
@@ -3943,6 +4115,8 @@ Image Options:
|
|
|
3943
4115
|
--upscale <path|url> Promptless NVIDIA RTX VSR upscale, up to 16K (one source image)
|
|
3944
4116
|
--upscale-scale <n> Enlarge longest edge by 2, 3, or 4 (default: 2)
|
|
3945
4117
|
--target-longest-edge <px> Explicit output longest edge, up to 15360 (overrides scale)
|
|
4118
|
+
--upscale-video <path|url> Promptless FlashVSR upscale of one video to 1080p/1440p (keeps frames, fps, audio)
|
|
4119
|
+
--upscale-resolution <p> Output short edge for --upscale-video: 1080 or 1440 (default: 1440; 1080 below 720p)
|
|
3946
4120
|
|
|
3947
4121
|
Photobooth (Face Transfer):
|
|
3948
4122
|
--photobooth Face transfer mode (InstantID + SDXL Turbo)
|
|
@@ -4183,6 +4357,9 @@ LTX 2.3 rollback-only capabilities:
|
|
|
4183
4357
|
ltx23-22b-fp8_v2v_distilled Video-to-video rollback
|
|
4184
4358
|
ltx23-22b-10eros-v1.4-fp8mixed_i2v Private mature-theme I2V; first and/or last frame; requires --no-filter
|
|
4185
4359
|
|
|
4360
|
+
Video Upscale Model:
|
|
4361
|
+
flashvsr_v1.1_tiny_long_bf16 Promptless FlashVSR upscale to 1080p/1440p (--upscale-video)
|
|
4362
|
+
|
|
4186
4363
|
Music Models:
|
|
4187
4364
|
ace_step_1.5_xl_turbo Default direct music generation
|
|
4188
4365
|
ace_step_1.5_xl_sft Quality variant with stronger lyric handling
|
|
@@ -4635,7 +4812,7 @@ if (options.outputFormat) {
|
|
|
4635
4812
|
details: { outputFormat: options.outputFormat }
|
|
4636
4813
|
});
|
|
4637
4814
|
}
|
|
4638
|
-
} else if (options.video) {
|
|
4815
|
+
} else if (options.video || options.upscaleVideo) {
|
|
4639
4816
|
if (options.outputFormat !== 'mp4') {
|
|
4640
4817
|
fatalCliError('Video output format must be "mp4".', {
|
|
4641
4818
|
code: 'INVALID_ARGUMENT',
|
|
@@ -5144,6 +5321,17 @@ if (options.music) {
|
|
|
5144
5321
|
if (!cliSet.timeout && !timeoutFromConfig && options.timeout === 30000) {
|
|
5145
5322
|
options.timeout = 1800000; // 30 min for queued and long-running video jobs
|
|
5146
5323
|
}
|
|
5324
|
+
} else if (options.upscaleVideo) {
|
|
5325
|
+
if (options.model && options.model !== FLASHVSR_MODEL_ID) {
|
|
5326
|
+
fatalCliError(`--upscale-video requires model ${FLASHVSR_MODEL_ID}.`, {
|
|
5327
|
+
code: 'INVALID_ARGUMENT',
|
|
5328
|
+
details: { model: options.model, requiredModel: FLASHVSR_MODEL_ID }
|
|
5329
|
+
});
|
|
5330
|
+
}
|
|
5331
|
+
options.model = FLASHVSR_MODEL_ID;
|
|
5332
|
+
if (!cliSet.timeout && !timeoutFromConfig && options.timeout === 30000) {
|
|
5333
|
+
options.timeout = 1800000; // 30 min for queued video work
|
|
5334
|
+
}
|
|
5147
5335
|
} else if (options.upscaleImage) {
|
|
5148
5336
|
if (options.model && options.model !== RTX_VSR_MODEL_ID) {
|
|
5149
5337
|
fatalCliError(`--upscale requires model ${RTX_VSR_MODEL_ID}.`, {
|
|
@@ -5268,6 +5456,7 @@ const commandUsesGenerationSeed = !options.apiChat &&
|
|
|
5268
5456
|
!options.sourceReelDir &&
|
|
5269
5457
|
!options.remixAudio &&
|
|
5270
5458
|
!options.upscaleImage &&
|
|
5459
|
+
!options.upscaleVideo &&
|
|
5271
5460
|
!options.listMedia &&
|
|
5272
5461
|
!options.memoryAction &&
|
|
5273
5462
|
!options.personalityAction &&
|
|
@@ -5306,7 +5495,7 @@ const wan3HasMediaInput = isWan3ModelLocal(options.model) && Boolean(
|
|
|
5306
5495
|
|| options.wan3ReferenceFileUrl
|
|
5307
5496
|
|| options.wan3ReferenceLinkUrl
|
|
5308
5497
|
);
|
|
5309
|
-
if (!options.prompt && !wan3HasMediaInput && !options.upscaleImage && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !liveModelUtilityAction && !loraCatalogUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.trimVideo && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
|
|
5498
|
+
if (!options.prompt && !wan3HasMediaInput && !options.upscaleImage && !options.upscaleVideo && !options.apiChat && !apiWorkflowUtilityAction && !apiWorkflowStartAction && !apiModelUtilityAction && !liveModelUtilityAction && !loraCatalogUtilityAction && !apiReplayUtilityAction && !contractUtilityAction && !storyboardPlanUtilityAction && !options.estimateVideoCost && !options.multiAngle && !options.showBalance && !options.showVersion && !options.doctor && !options.extractLastFrame && !options.extractFirstFrame && !options.extractFrameAt && !options.trimVideo && !options.verifyVideo && !options.concatVideos && !options.sourceReelDir && !options.remixAudio && !options.listMedia && !options.memoryAction && !options.personalityAction && !personaUtilityAction) {
|
|
5310
5499
|
fatalCliError('No prompt provided. Use --help for usage.', { code: 'INVALID_ARGUMENT' });
|
|
5311
5500
|
}
|
|
5312
5501
|
|
|
@@ -5349,6 +5538,38 @@ if (!options.upscaleImage && (cliSet.upscaleScale || cliSet.upscaleTargetLongest
|
|
|
5349
5538
|
});
|
|
5350
5539
|
}
|
|
5351
5540
|
|
|
5541
|
+
if (options.upscaleVideo) {
|
|
5542
|
+
if (options.prompt) {
|
|
5543
|
+
fatalCliError('--upscale-video is promptless and does not accept a prompt.', { code: 'INVALID_ARGUMENT' });
|
|
5544
|
+
}
|
|
5545
|
+
if (
|
|
5546
|
+
options.upscaleImage || options.video || options.music || options.photobooth || options.multiAngle
|
|
5547
|
+
|| options.contextImages.length > 0 || options.refImage || options.refImageEnd || options.refAudio
|
|
5548
|
+
|| options.refAudios.length > 0 || options.refVideo || options.refVideos.length > 0 || options.refMask
|
|
5549
|
+
) {
|
|
5550
|
+
fatalCliError('--upscale-video cannot be combined with --upscale, --video, --music, photobooth, --multi-angle, --ref, --ref-end, --ref-audio, --ref-video, --mask, or -c/--context.', {
|
|
5551
|
+
code: 'INVALID_ARGUMENT'
|
|
5552
|
+
});
|
|
5553
|
+
}
|
|
5554
|
+
if (options.count !== 1) {
|
|
5555
|
+
fatalCliError('--upscale-video produces exactly one output; omit -n/--count or set it to 1.', {
|
|
5556
|
+
code: 'INVALID_ARGUMENT',
|
|
5557
|
+
details: { count: options.count }
|
|
5558
|
+
});
|
|
5559
|
+
}
|
|
5560
|
+
if (cliSet.width || cliSet.height || cliSet.fps || cliSet.duration || cliSet.frames) {
|
|
5561
|
+
fatalCliError('--upscale-video keeps the source frames, frame rate, and aspect ratio; choose the output with --upscale-resolution 1080 or 1440.', {
|
|
5562
|
+
code: 'INVALID_ARGUMENT'
|
|
5563
|
+
});
|
|
5564
|
+
}
|
|
5565
|
+
}
|
|
5566
|
+
|
|
5567
|
+
if (!options.upscaleVideo && cliSet.upscaleResolution) {
|
|
5568
|
+
fatalCliError('--upscale-resolution requires --upscale-video <path|url>.', {
|
|
5569
|
+
code: 'INVALID_ARGUMENT'
|
|
5570
|
+
});
|
|
5571
|
+
}
|
|
5572
|
+
|
|
5352
5573
|
if (options.legacyWan3TaskType !== null) {
|
|
5353
5574
|
fatalCliError(
|
|
5354
5575
|
'--wan3-task-type has been removed because Wan 3 has no provider edit/extend task mode. Use --workflow r2v with --ref-video for loose conditioning, or select a video-to-video model for editing.',
|
|
@@ -12280,7 +12501,7 @@ async function main() {
|
|
|
12280
12501
|
|
|
12281
12502
|
// Video catalog data is loaded before model-aware dimension planning.
|
|
12282
12503
|
// Other media types retain the connected-stage lookup used previously.
|
|
12283
|
-
if (!options.video) {
|
|
12504
|
+
if (!options.video && !options.upscaleVideo) {
|
|
12284
12505
|
await loadLiveModelDefaults(options.model);
|
|
12285
12506
|
}
|
|
12286
12507
|
await ensureSufficientVideoBalance(client, log);
|
|
@@ -12359,13 +12580,13 @@ async function main() {
|
|
|
12359
12580
|
client.on(ClientEvent.JOB_COMPLETED, (data) => {
|
|
12360
12581
|
const jobData = data.job?.data || {};
|
|
12361
12582
|
results.push({
|
|
12362
|
-
resultUrl: data.resultUrl || (options.music ? data.audioUrl : options.video ? data.videoUrl : data.imageUrl),
|
|
12583
|
+
resultUrl: data.resultUrl || (options.music ? data.audioUrl : (options.video || options.upscaleVideo) ? data.videoUrl : data.imageUrl),
|
|
12363
12584
|
seed: jobData.seed,
|
|
12364
12585
|
jobIndex: data.jobIndex,
|
|
12365
12586
|
projectId: data.projectId
|
|
12366
12587
|
});
|
|
12367
12588
|
completedJobs++;
|
|
12368
|
-
log(`${options.music ? 'Music' : options.video ? 'Video' : 'Image'} ${completedJobs}/${options.count} completed`);
|
|
12589
|
+
log(`${options.music ? 'Music' : (options.video || options.upscaleVideo) ? 'Video' : 'Image'} ${completedJobs}/${options.count} completed`);
|
|
12369
12590
|
|
|
12370
12591
|
if (completedJobs >= options.count) {
|
|
12371
12592
|
clearTimeout(timeout);
|
|
@@ -12396,7 +12617,7 @@ async function main() {
|
|
|
12396
12617
|
});
|
|
12397
12618
|
|
|
12398
12619
|
// Progress for longer-running media jobs.
|
|
12399
|
-
if (options.video || options.music) {
|
|
12620
|
+
if (options.video || options.music || options.upscaleVideo) {
|
|
12400
12621
|
client.on(ClientEvent.PROJECT_PROGRESS, (data) => {
|
|
12401
12622
|
if (data.percentage && data.percentage > 0) {
|
|
12402
12623
|
log(`Progress: ${Math.round(data.percentage)}%`);
|
|
@@ -13081,6 +13302,49 @@ async function main() {
|
|
|
13081
13302
|
if (audioResult?.error || audioResult?.message) {
|
|
13082
13303
|
throw buildProjectResultError(audioResult);
|
|
13083
13304
|
}
|
|
13305
|
+
} else if (options.upscaleVideo) {
|
|
13306
|
+
log(`Upscaling video with ${FLASHVSR_MODEL_ID}...`);
|
|
13307
|
+
const sourceBuffer = await fetchMediaBuffer(options.upscaleVideo);
|
|
13308
|
+
const source = await probeVideoUpscaleSource(sourceBuffer, options.upscaleVideo);
|
|
13309
|
+
const target = resolveVideoUpscaleOutput(source.width, source.height, options.upscaleResolution);
|
|
13310
|
+
options.width = target.width;
|
|
13311
|
+
options.height = target.height;
|
|
13312
|
+
options.frames = source.frames;
|
|
13313
|
+
options.fps = source.fps;
|
|
13314
|
+
options.outputFormat = 'mp4';
|
|
13315
|
+
options._videoUpscale = { source, resolution: target.resolution };
|
|
13316
|
+
log(
|
|
13317
|
+
`Source ${source.width}x${source.height}, ${source.frames} frames at ${Number(source.fps.toFixed(3))} fps; ` +
|
|
13318
|
+
`output ${target.width}x${target.height} (${target.resolution}p), every frame and the audio kept.`
|
|
13319
|
+
);
|
|
13320
|
+
|
|
13321
|
+
// The exact frame count and rate satisfy the SDK's FlashVSR validation;
|
|
13322
|
+
// the server re-probes the upload and adopts its verified size, so the
|
|
13323
|
+
// output width/height are not sent.
|
|
13324
|
+
const upscaleVideoConfig = {
|
|
13325
|
+
modelId: FLASHVSR_MODEL_ID,
|
|
13326
|
+
positivePrompt: '',
|
|
13327
|
+
numberOfMedia: 1,
|
|
13328
|
+
referenceVideo: sourceBuffer,
|
|
13329
|
+
upscaleResolution: target.resolution,
|
|
13330
|
+
frames: source.frames,
|
|
13331
|
+
fps: source.fps,
|
|
13332
|
+
tokenType: options.tokenType || 'spark',
|
|
13333
|
+
waitForCompletion: false,
|
|
13334
|
+
autoResizeVideoAssets: false
|
|
13335
|
+
};
|
|
13336
|
+
|
|
13337
|
+
let upscaleVideoResult;
|
|
13338
|
+
try {
|
|
13339
|
+
upscaleVideoResult = trackProjectResult(
|
|
13340
|
+
await client.createVideoProject(withBillingMode(upscaleVideoConfig))
|
|
13341
|
+
);
|
|
13342
|
+
} catch (error) {
|
|
13343
|
+
throw annotateVideoUpscaleError(error);
|
|
13344
|
+
}
|
|
13345
|
+
if (upscaleVideoResult?.error || upscaleVideoResult?.message) {
|
|
13346
|
+
throw annotateVideoUpscaleError(buildProjectResultError(upscaleVideoResult));
|
|
13347
|
+
}
|
|
13084
13348
|
} else if (options.upscaleImage) {
|
|
13085
13349
|
log(`Upscaling with ${RTX_VSR_MODEL_ID}...`);
|
|
13086
13350
|
const sourceBuffer = await fetchMediaBuffer(options.upscaleImage);
|
|
@@ -13334,7 +13598,7 @@ async function main() {
|
|
|
13334
13598
|
const seeds = results.map(r => r.seed ?? options.seed);
|
|
13335
13599
|
const renderInfo = {
|
|
13336
13600
|
timestamp: new Date().toISOString(),
|
|
13337
|
-
type: options.music ? 'music' : options.video ? 'video' : 'image',
|
|
13601
|
+
type: options.music ? 'music' : (options.video || options.upscaleVideo) ? 'video' : 'image',
|
|
13338
13602
|
prompt: options.prompt,
|
|
13339
13603
|
model: options.model,
|
|
13340
13604
|
width: options.music ? null : options.width,
|
|
@@ -13380,6 +13644,14 @@ async function main() {
|
|
|
13380
13644
|
renderInfo.shift = options.musicShift;
|
|
13381
13645
|
}
|
|
13382
13646
|
}
|
|
13647
|
+
if (options.upscaleVideo && options._videoUpscale) {
|
|
13648
|
+
renderInfo.upscaleResolution = options._videoUpscale.resolution;
|
|
13649
|
+
renderInfo.fps = options.fps;
|
|
13650
|
+
renderInfo.frames = options.frames;
|
|
13651
|
+
renderInfo.sourceVideo = options.upscaleVideo;
|
|
13652
|
+
renderInfo.sourceWidth = options._videoUpscale.source.width;
|
|
13653
|
+
renderInfo.sourceHeight = options._videoUpscale.source.height;
|
|
13654
|
+
}
|
|
13383
13655
|
if (options.video) {
|
|
13384
13656
|
renderInfo.workflow = options.videoWorkflow;
|
|
13385
13657
|
renderInfo.fps = options.fps;
|
|
@@ -13558,7 +13830,7 @@ async function main() {
|
|
|
13558
13830
|
await buildConcatVideoFromClips(options.output, [clip1Path, clip2Path]);
|
|
13559
13831
|
log(`Saved looping video to ${options.output}`);
|
|
13560
13832
|
} else {
|
|
13561
|
-
writeOutputFileSafe(options.output, buffer, options.video ? 'video' : options.music ? 'audio' : 'image');
|
|
13833
|
+
writeOutputFileSafe(options.output, buffer, (options.video || options.upscaleVideo) ? 'video' : options.music ? 'audio' : 'image');
|
|
13562
13834
|
log(`Saved to ${options.output}`);
|
|
13563
13835
|
}
|
|
13564
13836
|
}
|
|
@@ -13567,7 +13839,7 @@ async function main() {
|
|
|
13567
13839
|
if (options.json) {
|
|
13568
13840
|
const output = {
|
|
13569
13841
|
success: true,
|
|
13570
|
-
type: options.music ? 'music' : options.video ? 'video' : 'image',
|
|
13842
|
+
type: options.music ? 'music' : (options.video || options.upscaleVideo) ? 'video' : 'image',
|
|
13571
13843
|
prompt: options.prompt,
|
|
13572
13844
|
model: options.model,
|
|
13573
13845
|
width: options.music ? null : options.width,
|
|
@@ -13611,6 +13883,13 @@ async function main() {
|
|
|
13611
13883
|
output.shift = options.musicShift;
|
|
13612
13884
|
}
|
|
13613
13885
|
}
|
|
13886
|
+
if (options.upscaleVideo && options._videoUpscale) {
|
|
13887
|
+
output.upscaleResolution = options._videoUpscale.resolution;
|
|
13888
|
+
output.fps = options.fps;
|
|
13889
|
+
output.frames = options.frames;
|
|
13890
|
+
output.sourceWidth = options._videoUpscale.source.width;
|
|
13891
|
+
output.sourceHeight = options._videoUpscale.source.height;
|
|
13892
|
+
}
|
|
13614
13893
|
if (options.video) {
|
|
13615
13894
|
output.workflow = options.videoWorkflow;
|
|
13616
13895
|
output.fps = options.fps;
|
|
@@ -13686,6 +13965,8 @@ async function main() {
|
|
|
13686
13965
|
}
|
|
13687
13966
|
|
|
13688
13967
|
} catch (error) {
|
|
13968
|
+
// A FlashVSR refusal can also arrive as a project event after submission.
|
|
13969
|
+
if (options.upscaleVideo) annotateVideoUpscaleError(error);
|
|
13689
13970
|
// Token auto-fallback: if using auto mode and got insufficient balance, retry with the other token
|
|
13690
13971
|
const isBalanceError = isStructuredInsufficientBalanceError(error);
|
|
13691
13972
|
if (_allowAutoTokenFallback && isBalanceError && options.tokenType === 'spark') {
|
package/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '3.
|
|
1
|
+
export const PACKAGE_VERSION = '3.42.0';
|