dsh-drawai 0.4.0 → 0.4.2
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/LICENSE +430 -418
- package/README.md +96 -249
- package/lib/audio-media.js +5 -2
- package/lib/client.js +45 -12
- package/lib/drawing-runner.js +6 -4
- package/lib/ffmpeg-manager.js +1056 -0
- package/lib/index.js +7719 -7396
- package/lib/motion/apply.js +4 -3
- package/lib/motion/asset-pack.js +394 -335
- package/lib/motion/assets.js +4 -3
- package/lib/motion/beats.js +3 -2
- package/lib/motion/collect.js +3 -1
- package/lib/motion/delivery.js +29 -1
- package/lib/motion/demo-assets-lock.js +10 -0
- package/lib/motion/ffmpeg.js +5 -4
- package/lib/motion/jobs.js +5 -1
- package/lib/motion/mgstyles/vendor/README.md +28 -0
- package/lib/motion/mgstyles/vendor/modules/d3/LICENSE +13 -0
- package/lib/motion/mgstyles/vendor/modules/d3/dist/d3.min.js +2 -0
- package/lib/motion/mgstyles/vendor/modules/opentype.js/LICENSE +20 -0
- package/lib/motion/mgstyles/vendor/modules/opentype.js/dist/opentype.mjs +14460 -0
- package/lib/motion/mgstyles/vendor/modules/simplex-noise/LICENSE +21 -0
- package/lib/motion/mgstyles/vendor/modules/simplex-noise/dist/esm/simplex-noise.js +466 -0
- package/lib/motion/mgstyles/vendor/modules/topojson-client/LICENSE +13 -0
- package/lib/motion/mgstyles/vendor/modules/topojson-client/dist/topojson-client.min.js +2 -0
- package/lib/motion/preview.js +13 -4
- package/lib/motion/render.js +179 -159
- package/lib/motion/runtime/package-lock.json +3058 -0
- package/lib/motion/runtime/package.json +16 -0
- package/lib/motion/style-frames.js +306 -268
- package/lib/motion/sync.js +214 -214
- package/lib/motion/video-runtime.js +192 -0
- package/lib/motion-capture.js +2 -1
- package/lib/motion-film-review.js +2 -2
- package/lib/motion-project.js +105 -79
- package/lib/motion-render-worker.js +174 -144
- package/lib/motion-vision.js +3 -2
- package/lib/routing/router.js +222 -211
- package/lib/routing/vendor/README.md +96 -96
- package/lib/routing/vendor/libavoid-routing.js +753 -753
- package/lib/routing/vendor/libavoid.min.js +59 -59
- package/lib/shotcard-reference.js +2 -2
- package/lib/style-kernel.js +16 -6
- package/lib/video-export.js +32 -20
- package/package.json +17 -12
package/lib/drawing-runner.js
CHANGED
|
@@ -3,7 +3,7 @@ import { spawn } from 'node:child_process'
|
|
|
3
3
|
import { readFileSync, writeFileSync, copyFileSync, existsSync, mkdirSync, renameSync, mkdtempSync, rmSync, realpathSync } from 'node:fs'
|
|
4
4
|
import { join, relative, isAbsolute } from 'node:path'
|
|
5
5
|
import { createHash } from 'node:crypto'
|
|
6
|
-
import {
|
|
6
|
+
import { ensureFfmpeg } from './ffmpeg-manager.js'
|
|
7
7
|
import { ensureClipPack, writeManifest, clipDirFor, mediaRootFor, frameFileName, STILLS_DIR, stillFileName } from './media.js'
|
|
8
8
|
|
|
9
9
|
function checkMediaDirectory(job, path) {
|
|
@@ -11,9 +11,10 @@ function checkMediaDirectory(job, path) {
|
|
|
11
11
|
if (isAbsolute(rel) || rel.startsWith('..')) throw new Error('媒体目录超出工作区')
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export async function runMediaCommand(args, signal, onProgress, binary
|
|
14
|
+
export async function runMediaCommand(args, signal, onProgress, binary) {
|
|
15
|
+
const executable = binary || await ensureFfmpeg({ signal })
|
|
15
16
|
return new Promise((resolve, reject) => {
|
|
16
|
-
const child = spawn(
|
|
17
|
+
const child = spawn(executable, ['-hide_banner', '-nostdin', '-nostats', ...args], { windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] })
|
|
17
18
|
let stdout = '', stderr = ''
|
|
18
19
|
const abort = () => child.kill()
|
|
19
20
|
signal?.addEventListener('abort', abort, { once: true }); if (signal?.aborted) abort()
|
|
@@ -74,7 +75,8 @@ export function planDrawingVideo(options, info, extract = false) {
|
|
|
74
75
|
async function* rawVideoFrames(job, signal, binary, perf) {
|
|
75
76
|
const decodeDone = perf?.start('decodePipelineWall')
|
|
76
77
|
const { plan } = job, offset = job.done || 0
|
|
77
|
-
const
|
|
78
|
+
const executable = binary || await ensureFfmpeg({ signal })
|
|
79
|
+
const child = spawn(executable, ['-hide_banner', '-nostdin', '-loglevel', 'error',
|
|
78
80
|
'-ss', String(plan.from), ...inputArgs(job.input), '-map', '0:v:0', '-an', '-sn',
|
|
79
81
|
'-filter_threads', '1', '-vf', 'tpad=stop_mode=clone:stop_duration=' + (1 / plan.fps) + ',fps=fps=' + plan.fps + ':start_time=0:round=near,scale=' + plan.w + ':' + plan.h + ':flags=bicubic,setsar=1,format=rgba,trim=start_frame=' + offset + ',setpts=PTS-STARTPTS',
|
|
80
82
|
'-frames:v', String(plan.count - offset), '-fps_mode', 'passthrough', '-threads', '1', '-pix_fmt', 'rgba', '-f', 'rawvideo', 'pipe:1'],
|