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.
Files changed (45) hide show
  1. package/LICENSE +430 -418
  2. package/README.md +96 -249
  3. package/lib/audio-media.js +5 -2
  4. package/lib/client.js +45 -12
  5. package/lib/drawing-runner.js +6 -4
  6. package/lib/ffmpeg-manager.js +1056 -0
  7. package/lib/index.js +7719 -7396
  8. package/lib/motion/apply.js +4 -3
  9. package/lib/motion/asset-pack.js +394 -335
  10. package/lib/motion/assets.js +4 -3
  11. package/lib/motion/beats.js +3 -2
  12. package/lib/motion/collect.js +3 -1
  13. package/lib/motion/delivery.js +29 -1
  14. package/lib/motion/demo-assets-lock.js +10 -0
  15. package/lib/motion/ffmpeg.js +5 -4
  16. package/lib/motion/jobs.js +5 -1
  17. package/lib/motion/mgstyles/vendor/README.md +28 -0
  18. package/lib/motion/mgstyles/vendor/modules/d3/LICENSE +13 -0
  19. package/lib/motion/mgstyles/vendor/modules/d3/dist/d3.min.js +2 -0
  20. package/lib/motion/mgstyles/vendor/modules/opentype.js/LICENSE +20 -0
  21. package/lib/motion/mgstyles/vendor/modules/opentype.js/dist/opentype.mjs +14460 -0
  22. package/lib/motion/mgstyles/vendor/modules/simplex-noise/LICENSE +21 -0
  23. package/lib/motion/mgstyles/vendor/modules/simplex-noise/dist/esm/simplex-noise.js +466 -0
  24. package/lib/motion/mgstyles/vendor/modules/topojson-client/LICENSE +13 -0
  25. package/lib/motion/mgstyles/vendor/modules/topojson-client/dist/topojson-client.min.js +2 -0
  26. package/lib/motion/preview.js +13 -4
  27. package/lib/motion/render.js +179 -159
  28. package/lib/motion/runtime/package-lock.json +3058 -0
  29. package/lib/motion/runtime/package.json +16 -0
  30. package/lib/motion/style-frames.js +306 -268
  31. package/lib/motion/sync.js +214 -214
  32. package/lib/motion/video-runtime.js +192 -0
  33. package/lib/motion-capture.js +2 -1
  34. package/lib/motion-film-review.js +2 -2
  35. package/lib/motion-project.js +105 -79
  36. package/lib/motion-render-worker.js +174 -144
  37. package/lib/motion-vision.js +3 -2
  38. package/lib/routing/router.js +222 -211
  39. package/lib/routing/vendor/README.md +96 -96
  40. package/lib/routing/vendor/libavoid-routing.js +753 -753
  41. package/lib/routing/vendor/libavoid.min.js +59 -59
  42. package/lib/shotcard-reference.js +2 -2
  43. package/lib/style-kernel.js +16 -6
  44. package/lib/video-export.js +32 -20
  45. package/package.json +17 -12
@@ -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 { ffmpegBinary } from './video-export.js'
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 = ffmpegBinary()) {
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(binary, ['-hide_banner', '-nostdin', '-nostats', ...args], { windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] })
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 child = spawn(binary || ffmpegBinary(), ['-hide_banner', '-nostdin', '-loglevel', 'error',
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'],