automovie 0.3.4 → 0.4.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/README.md +40 -139
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +6 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.d.ts +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map +1 -1
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js +8 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +3 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +12 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -1
- package/lib/AutoMovieCaptureBackend.d.ts +4 -6
- package/lib/AutoMovieCaptureHost.d.ts +73 -53
- package/lib/AutoMovieCaptureHost.js +89 -56
- package/lib/AutoMovieCaptureHost.js.map +1 -1
- package/lib/AutoMovieCommand.d.ts +69 -20
- package/lib/AutoMovieFfmpegStaticPath.d.ts +6 -0
- package/lib/AutoMovieFfmpegStaticPath.js +3 -0
- package/lib/AutoMovieFfmpegStaticPath.js.map +1 -0
- package/lib/AutoMovieMp4Boxes.d.ts +78 -0
- package/lib/AutoMovieMp4Boxes.js +227 -0
- package/lib/AutoMovieMp4Boxes.js.map +1 -0
- package/lib/AutoMovieRenderOutputReservation.d.ts +18 -0
- package/lib/AutoMovieRenderOutputReservation.js +118 -0
- package/lib/AutoMovieRenderOutputReservation.js.map +1 -0
- package/lib/IAutoMovieChromium.d.ts +13 -57
- package/lib/IAutoMovieDeliveryAudioTrack.d.ts +17 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js +3 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/IAutoMovieDeliveryProfileFinding.d.ts +21 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js +3 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js.map +1 -0
- package/lib/IAutoMovieFfmpegSources.d.ts +11 -0
- package/lib/IAutoMovieFfmpegSources.js +3 -0
- package/lib/IAutoMovieFfmpegSources.js.map +1 -0
- package/lib/IAutoMovieReviewObservation.d.ts +66 -0
- package/lib/IAutoMovieReviewObservation.js +3 -0
- package/lib/IAutoMovieReviewObservation.js.map +1 -0
- package/lib/IAutoMovieVerification.d.ts +163 -0
- package/lib/IAutoMovieVerification.js +3 -0
- package/lib/IAutoMovieVerification.js.map +1 -0
- package/lib/auditAutoMovieAlphaSamples.d.ts +23 -0
- package/lib/auditAutoMovieAlphaSamples.js +183 -0
- package/lib/auditAutoMovieAlphaSamples.js.map +1 -0
- package/lib/auditAutoMovieDeliveryProfile.d.ts +33 -0
- package/lib/auditAutoMovieDeliveryProfile.js +93 -0
- package/lib/auditAutoMovieDeliveryProfile.js.map +1 -0
- package/lib/captureAutoMovie.d.ts +23 -11
- package/lib/captureAutoMovie.js +102 -18
- package/lib/captureAutoMovie.js.map +1 -1
- package/lib/createAutoMovieDeliveryAudioLog.d.ts +31 -0
- package/lib/createAutoMovieDeliveryAudioLog.js +110 -0
- package/lib/createAutoMovieDeliveryAudioLog.js.map +1 -0
- package/lib/createAutoMovieDeliveryAudioScan.d.ts +39 -0
- package/lib/createAutoMovieDeliveryAudioScan.js +125 -0
- package/lib/createAutoMovieDeliveryAudioScan.js.map +1 -0
- package/lib/createAutoMovieVerificationInputScope.d.ts +19 -0
- package/lib/createAutoMovieVerificationInputScope.js +147 -0
- package/lib/createAutoMovieVerificationInputScope.js.map +1 -0
- package/lib/createAutoMovieVerificationMediaHash.d.ts +5 -0
- package/lib/createAutoMovieVerificationMediaHash.js +61 -0
- package/lib/createAutoMovieVerificationMediaHash.js.map +1 -0
- package/lib/decodeAutoMovieDeliveryAudio.d.ts +24 -0
- package/lib/decodeAutoMovieDeliveryAudio.js +77 -0
- package/lib/decodeAutoMovieDeliveryAudio.js.map +1 -0
- package/lib/deriveAutoMovieProjectName.d.ts +14 -11
- package/lib/deriveAutoMovieProjectName.js +14 -11
- package/lib/deriveAutoMovieProjectName.js.map +1 -1
- package/lib/findAutoMovieFreePort.d.ts +5 -10
- package/lib/findAutoMovieFreePort.js +5 -10
- package/lib/findAutoMovieFreePort.js.map +1 -1
- package/lib/formatAutoMovieInspectUrl.d.ts +6 -10
- package/lib/formatAutoMovieInspectUrl.js +6 -10
- package/lib/formatAutoMovieInspectUrl.js.map +1 -1
- package/lib/hashAutoMovieFile.d.ts +5 -0
- package/lib/hashAutoMovieFile.js +16 -0
- package/lib/hashAutoMovieFile.js.map +1 -0
- package/lib/importAutoMovieVerificationEntry.d.mts +2 -0
- package/lib/importAutoMovieVerificationEntry.mjs +6 -0
- package/lib/importAutoMovieVerificationEntry.mjs.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/lib/inspectAutoMovie.d.ts +15 -9
- package/lib/inspectAutoMovie.js +25 -9
- package/lib/inspectAutoMovie.js.map +1 -1
- package/lib/inspectAutoMovieVerificationCapture.d.ts +15 -0
- package/lib/inspectAutoMovieVerificationCapture.js +221 -0
- package/lib/inspectAutoMovieVerificationCapture.js.map +1 -0
- package/lib/inspectAutoMovieVerificationDelivery.d.ts +13 -0
- package/lib/inspectAutoMovieVerificationDelivery.js +247 -0
- package/lib/inspectAutoMovieVerificationDelivery.js.map +1 -0
- package/lib/inspectAutoMovieVerificationReview.d.ts +11 -0
- package/lib/inspectAutoMovieVerificationReview.js +141 -0
- package/lib/inspectAutoMovieVerificationReview.js.map +1 -0
- package/lib/launchAutoMovieChromium.d.ts +9 -11
- package/lib/launchAutoMovieChromium.js +10 -11
- package/lib/launchAutoMovieChromium.js.map +1 -1
- package/lib/listAutoMovieReleaseFindings.d.ts +9 -0
- package/lib/listAutoMovieReleaseFindings.js +58 -0
- package/lib/listAutoMovieReleaseFindings.js.map +1 -0
- package/lib/loadAutoMovieProductionModule.d.ts +11 -10
- package/lib/loadAutoMovieProductionModule.js +18 -10
- package/lib/loadAutoMovieProductionModule.js.map +1 -1
- package/lib/loadAutoMovieVerificationModule.d.ts +6 -0
- package/lib/loadAutoMovieVerificationModule.js +246 -0
- package/lib/loadAutoMovieVerificationModule.js.map +1 -0
- package/lib/planAutoMovieChromiumLaunch.d.ts +7 -13
- package/lib/planAutoMovieChromiumLaunch.js +7 -13
- package/lib/planAutoMovieChromiumLaunch.js.map +1 -1
- package/lib/planAutoMovieDeliveryAudioDecode.d.ts +10 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js +29 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/planAutoMovieDeliveryDecode.js +57 -0
- package/lib/planAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryInput.d.ts +11 -0
- package/lib/planAutoMovieDeliveryInput.js +26 -0
- package/lib/planAutoMovieDeliveryInput.js.map +1 -0
- package/lib/planAutoMovieModulePageViteConfig.d.ts +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js.map +1 -1
- package/lib/promptAutoMovieProjectName.d.ts +6 -10
- package/lib/promptAutoMovieProjectName.js +6 -10
- package/lib/promptAutoMovieProjectName.js.map +1 -1
- package/lib/publishAutoMovieRenderAttempt.d.ts +32 -0
- package/lib/publishAutoMovieRenderAttempt.js +91 -0
- package/lib/publishAutoMovieRenderAttempt.js.map +1 -0
- package/lib/readAutoMovieAddArguments.d.ts +10 -11
- package/lib/readAutoMovieAddArguments.js +10 -11
- package/lib/readAutoMovieAddArguments.js.map +1 -1
- package/lib/readAutoMovieCaptureHostOptions.d.ts +19 -17
- package/lib/readAutoMovieCaptureHostOptions.js +16 -17
- package/lib/readAutoMovieCaptureHostOptions.js.map +1 -1
- package/lib/readAutoMovieCommandArguments.d.ts +6 -9
- package/lib/readAutoMovieCommandArguments.js +9 -10
- package/lib/readAutoMovieCommandArguments.js.map +1 -1
- package/lib/readAutoMovieCreateArguments.d.ts +7 -11
- package/lib/readAutoMovieCreateArguments.js +7 -11
- package/lib/readAutoMovieCreateArguments.js.map +1 -1
- package/lib/readAutoMovieDeliveryAudioTrack.d.ts +21 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js +104 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/readAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/readAutoMovieDeliveryDecode.js +209 -0
- package/lib/readAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/readAutoMovieDeliveryProbe.d.ts +35 -0
- package/lib/readAutoMovieDeliveryProbe.js +363 -0
- package/lib/readAutoMovieDeliveryProbe.js.map +1 -0
- package/lib/readAutoMovieErrorCode.d.ts +9 -0
- package/lib/readAutoMovieErrorCode.js +18 -0
- package/lib/readAutoMovieErrorCode.js.map +1 -0
- package/lib/readAutoMovieInspectHostOptions.d.ts +15 -16
- package/lib/readAutoMovieInspectHostOptions.js +11 -15
- package/lib/readAutoMovieInspectHostOptions.js.map +1 -1
- package/lib/readAutoMovieNameOption.d.ts +4 -10
- package/lib/readAutoMovieNameOption.js +4 -10
- package/lib/readAutoMovieNameOption.js.map +1 -1
- package/lib/readAutoMoviePageTimeout.d.ts +13 -0
- package/lib/readAutoMoviePageTimeout.js +21 -0
- package/lib/readAutoMoviePageTimeout.js.map +1 -0
- package/lib/readAutoMovieRenderOptions.d.ts +24 -16
- package/lib/readAutoMovieRenderOptions.js +23 -16
- package/lib/readAutoMovieRenderOptions.js.map +1 -1
- package/lib/readAutoMovieReviewObservation.d.ts +6 -0
- package/lib/readAutoMovieReviewObservation.js +108 -0
- package/lib/readAutoMovieReviewObservation.js.map +1 -0
- package/lib/readAutoMovieReviewOptions.d.ts +32 -24
- package/lib/readAutoMovieReviewOptions.js +82 -18
- package/lib/readAutoMovieReviewOptions.js.map +1 -1
- package/lib/readAutoMovieRevision.d.ts +3 -9
- package/lib/readAutoMovieRevision.js +3 -9
- package/lib/readAutoMovieRevision.js.map +1 -1
- package/lib/readAutoMovieVerifyOptions.d.ts +17 -0
- package/lib/readAutoMovieVerifyOptions.js +45 -0
- package/lib/readAutoMovieVerifyOptions.js.map +1 -0
- package/lib/readAutoMovieVideoProbe.d.ts +6 -10
- package/lib/readAutoMovieVideoProbe.js +20 -13
- package/lib/readAutoMovieVideoProbe.js.map +1 -1
- package/lib/recordAutoMoviePlayback.d.ts +18 -11
- package/lib/recordAutoMoviePlayback.js +26 -13
- package/lib/recordAutoMoviePlayback.js.map +1 -1
- package/lib/renderAutoMovie.d.ts +16 -10
- package/lib/renderAutoMovie.js +31 -14
- package/lib/renderAutoMovie.js.map +1 -1
- package/lib/renderAutoMovieScaffoldNextSteps.d.ts +10 -10
- package/lib/renderAutoMovieScaffoldNextSteps.js +10 -10
- package/lib/renderAutoMovieVideo.d.ts +53 -15
- package/lib/renderAutoMovieVideo.js +290 -45
- package/lib/renderAutoMovieVideo.js.map +1 -1
- package/lib/resolveAutoMovieFfmpeg.d.ts +12 -15
- package/lib/resolveAutoMovieFfmpeg.js +12 -17
- package/lib/resolveAutoMovieFfmpeg.js.map +1 -1
- package/lib/reviewAutoMovie.d.ts +10 -10
- package/lib/reviewAutoMovie.js +15 -10
- package/lib/reviewAutoMovie.js.map +1 -1
- package/lib/reviewAutoMovieFile.d.ts +21 -0
- package/lib/reviewAutoMovieFile.js +378 -0
- package/lib/reviewAutoMovieFile.js.map +1 -0
- package/lib/run.d.ts +32 -18
- package/lib/run.js +67 -23
- package/lib/run.js.map +1 -1
- package/lib/runAutoMovieDeliveryAudioDecode.d.ts +18 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js +28 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/runAutoMovieDeliveryDecode.js +42 -0
- package/lib/runAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.d.ts +28 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js +77 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js.map +1 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.d.ts +20 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js +56 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js.map +1 -0
- package/lib/runAutoMovieFfmpeg.d.ts +15 -10
- package/lib/runAutoMovieFfmpeg.js +36 -13
- package/lib/runAutoMovieFfmpeg.js.map +1 -1
- package/lib/runAutoMovieVerification.d.ts +28 -0
- package/lib/runAutoMovieVerification.js +393 -0
- package/lib/runAutoMovieVerification.js.map +1 -0
- package/lib/sameAutoMovieReviewFile.d.ts +2 -0
- package/lib/sameAutoMovieReviewFile.js +57 -0
- package/lib/sameAutoMovieReviewFile.js.map +1 -0
- package/lib/selectAutoMovieProjectName.d.ts +8 -11
- package/lib/selectAutoMovieProjectName.js +8 -11
- package/lib/selectAutoMovieProjectName.js.map +1 -1
- package/lib/serveAutoMovieDrawPage.d.ts +14 -11
- package/lib/serveAutoMovieDrawPage.js +14 -11
- package/lib/serveAutoMovieDrawPage.js.map +1 -1
- package/lib/serveAutoMovieInspectorPage.d.ts +4 -8
- package/lib/serveAutoMovieInspectorPage.js +3 -9
- package/lib/serveAutoMovieInspectorPage.js.map +1 -1
- package/lib/verifyAutoMovie.d.ts +19 -0
- package/lib/verifyAutoMovie.js +44 -0
- package/lib/verifyAutoMovie.js.map +1 -0
- package/lib/writeAutoMovieModulePage.d.ts +17 -12
- package/lib/writeAutoMovieModulePage.js +13 -11
- package/lib/writeAutoMovieModulePage.js.map +1 -1
- package/lib/writeAutoMovieVerificationReceipt.d.ts +2 -0
- package/lib/writeAutoMovieVerificationReceipt.js +75 -0
- package/lib/writeAutoMovieVerificationReceipt.js.map +1 -0
- package/package.json +8 -8
- package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +6 -2
- package/src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts +3 -1
- package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +5 -2
- package/src/AUTOMOVIE_RENDER_OPTIONS.ts +8 -2
- package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +12 -1
- package/src/AutoMovieCaptureBackend.ts +4 -6
- package/src/AutoMovieCaptureHost.ts +122 -68
- package/src/AutoMovieCommand.ts +71 -20
- package/src/AutoMovieFfmpegStaticPath.ts +7 -0
- package/src/AutoMovieMp4Boxes.ts +263 -0
- package/src/AutoMovieRenderOutputReservation.ts +97 -0
- package/src/IAutoMovieChromium.ts +13 -57
- package/src/IAutoMovieDeliveryAudioTrack.ts +19 -0
- package/src/IAutoMovieDeliveryProfileFinding.ts +24 -0
- package/src/IAutoMovieFfmpegSources.ts +13 -0
- package/src/IAutoMovieReviewObservation.ts +59 -0
- package/src/IAutoMovieVerification.ts +207 -0
- package/src/auditAutoMovieAlphaSamples.ts +201 -0
- package/src/auditAutoMovieDeliveryProfile.ts +125 -0
- package/src/captureAutoMovie.ts +137 -28
- package/src/createAutoMovieDeliveryAudioLog.ts +141 -0
- package/src/createAutoMovieDeliveryAudioScan.ts +150 -0
- package/src/createAutoMovieVerificationInputScope.ts +156 -0
- package/src/createAutoMovieVerificationMediaHash.ts +32 -0
- package/src/decodeAutoMovieDeliveryAudio.ts +95 -0
- package/src/deriveAutoMovieProjectName.ts +14 -11
- package/src/findAutoMovieFreePort.ts +5 -10
- package/src/formatAutoMovieInspectUrl.ts +6 -10
- package/src/hashAutoMovieFile.ts +12 -0
- package/src/importAutoMovieVerificationEntry.mts +6 -0
- package/src/index.ts +9 -0
- package/src/inspectAutoMovie.ts +28 -11
- package/src/inspectAutoMovieVerificationCapture.ts +292 -0
- package/src/inspectAutoMovieVerificationDelivery.ts +301 -0
- package/src/inspectAutoMovieVerificationReview.ts +130 -0
- package/src/launchAutoMovieChromium.ts +14 -12
- package/src/listAutoMovieReleaseFindings.ts +87 -0
- package/src/loadAutoMovieProductionModule.ts +22 -15
- package/src/loadAutoMovieVerificationModule.ts +278 -0
- package/src/planAutoMovieChromiumLaunch.ts +7 -13
- package/src/planAutoMovieDeliveryAudioDecode.ts +26 -0
- package/src/planAutoMovieDeliveryDecode.ts +66 -0
- package/src/planAutoMovieDeliveryInput.ts +25 -0
- package/src/planAutoMovieModulePageViteConfig.ts +13 -10
- package/src/promptAutoMovieProjectName.ts +6 -10
- package/src/publishAutoMovieRenderAttempt.ts +89 -0
- package/src/readAutoMovieAddArguments.ts +10 -11
- package/src/readAutoMovieCaptureHostOptions.ts +22 -17
- package/src/readAutoMovieCommandArguments.ts +8 -10
- package/src/readAutoMovieCreateArguments.ts +7 -11
- package/src/readAutoMovieDeliveryAudioTrack.ts +137 -0
- package/src/readAutoMovieDeliveryDecode.ts +269 -0
- package/src/readAutoMovieDeliveryProbe.ts +499 -0
- package/src/readAutoMovieErrorCode.ts +13 -0
- package/src/readAutoMovieInspectHostOptions.ts +15 -16
- package/src/readAutoMovieNameOption.ts +4 -10
- package/src/readAutoMoviePageTimeout.ts +19 -0
- package/src/readAutoMovieRenderOptions.ts +34 -16
- package/src/readAutoMovieReviewObservation.ts +146 -0
- package/src/readAutoMovieReviewOptions.ts +133 -28
- package/src/readAutoMovieRevision.ts +3 -9
- package/src/readAutoMovieVerifyOptions.ts +50 -0
- package/src/readAutoMovieVideoProbe.ts +24 -13
- package/src/recordAutoMoviePlayback.ts +26 -13
- package/src/renderAutoMovie.ts +38 -17
- package/src/renderAutoMovieScaffoldNextSteps.ts +10 -10
- package/src/renderAutoMovieVideo.ts +474 -85
- package/src/resolveAutoMovieFfmpeg.ts +17 -24
- package/src/reviewAutoMovie.ts +21 -16
- package/src/reviewAutoMovieFile.ts +479 -0
- package/src/run.ts +75 -25
- package/src/runAutoMovieDeliveryAudioDecode.ts +45 -0
- package/src/runAutoMovieDeliveryDecode.ts +63 -0
- package/src/runAutoMovieDeliveryReferenceDecode.ts +107 -0
- package/src/runAutoMovieDeliverySourceAudioDecode.ts +71 -0
- package/src/runAutoMovieFfmpeg.ts +48 -14
- package/src/runAutoMovieVerification.ts +487 -0
- package/src/sameAutoMovieReviewFile.ts +23 -0
- package/src/selectAutoMovieProjectName.ts +8 -11
- package/src/serveAutoMovieDrawPage.ts +16 -12
- package/src/serveAutoMovieInspectorPage.ts +6 -9
- package/src/verifyAutoMovie.ts +67 -0
- package/src/writeAutoMovieModulePage.ts +17 -12
- package/src/writeAutoMovieVerificationReceipt.ts +51 -0
package/src/run.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { renderAutoMovie } from "./renderAutoMovie";
|
|
|
17
17
|
import { renderAutoMovieScaffoldNextSteps } from "./renderAutoMovieScaffoldNextSteps";
|
|
18
18
|
import { reviewAutoMovie } from "./reviewAutoMovie";
|
|
19
19
|
import { selectAutoMovieProjectName } from "./selectAutoMovieProjectName";
|
|
20
|
+
import { verifyAutoMovie } from "./verifyAutoMovie";
|
|
20
21
|
|
|
21
22
|
const USAGE: string = `automovie: scaffold an automovie project, and capture, render and review it
|
|
22
23
|
|
|
@@ -26,8 +27,11 @@ Usage:
|
|
|
26
27
|
automovie capture --module <file> [--props <json>] [--backend software|gpu] [--out <dir>] [<request>]
|
|
27
28
|
automovie capture --file <video> [--out <dir>] [<request>]
|
|
28
29
|
automovie inspect --module <file> [--props <json>] [--port <n>] [<request>]
|
|
30
|
+
automovie verify [--module <file>] [--subject <id>] [--only <check>] [--run] [--require <stage>] [--json]
|
|
29
31
|
automovie render --module <file> [--subject <name>] [--props <json>] [--out <dir>] [--backend software|gpu]
|
|
30
32
|
automovie review --url <inspector address> --seconds <s> [--out <dir>]
|
|
33
|
+
automovie review --file <video> (--at <s> | --from <s> --to <s>) --note <text> [--out <dir>]
|
|
34
|
+
automovie review --mark <review.json> [--file <video>] [--out <dir>]
|
|
31
35
|
|
|
32
36
|
Commands:
|
|
33
37
|
create A single production, or with --workspace a pnpm workspace
|
|
@@ -42,6 +46,8 @@ Commands:
|
|
|
42
46
|
subjects a module offers and print its address, whose query
|
|
43
47
|
is the request. Needs @automovie/render, @automovie/viewer,
|
|
44
48
|
react, react-dom and vite there; Ctrl+C stops it.
|
|
49
|
+
verify Read selected production observations or run their declared
|
|
50
|
+
checks. --require gates an adopted stage.
|
|
45
51
|
render In a production, draw every frame of one subject through the
|
|
46
52
|
draw page in headless Chromium and encode film.mp4 with
|
|
47
53
|
render-report.json. Needs what capture needs, and FFmpeg.
|
|
@@ -61,11 +67,18 @@ Options:
|
|
|
61
67
|
called with; default null.
|
|
62
68
|
--file capture: an encoded video file instead of a subject.
|
|
63
69
|
--backend capture, render: software (SwiftShader, the default) or gpu.
|
|
70
|
+
--timeout-ms capture, render: budget per browser navigation, subject
|
|
71
|
+
preparation or draw call (default 120000 ms).
|
|
64
72
|
--out capture: the folder; default media/capture/<subject>.
|
|
65
73
|
render: default media/automovie/<subject>/videos.
|
|
66
74
|
review: default media/automovie/review.
|
|
67
75
|
--url review: the running inspector page's address.
|
|
68
|
-
--seconds review: wall-clock seconds of playback recorded.
|
|
76
|
+
--seconds review: wall-clock seconds of Inspector playback recorded.
|
|
77
|
+
--at review: point in film seconds, or select --from and --to.
|
|
78
|
+
--mark review: reopen exact source bytes or rebind with --file and a new time.
|
|
79
|
+
--reviewer review: with --decision accepted|needs-repair and --viewed still|playback|listening,
|
|
80
|
+
explicitly record the named reviewer's decision. Use --at for a still,
|
|
81
|
+
or --from and --to for playback or listening.
|
|
69
82
|
<request> capture, inspect: --subject, --at, --from, --to, --rate, --events,
|
|
70
83
|
--views, --passes, --marks, --label, --round, --compare and
|
|
71
84
|
every other key of the capture request grammar; render takes
|
|
@@ -75,30 +88,44 @@ Options:
|
|
|
75
88
|
`;
|
|
76
89
|
|
|
77
90
|
/**
|
|
78
|
-
* The `automovie` CLI entry. `argv` is the full process vector; its first two
|
|
91
|
+
* The `automovie` CLI entry. `argv` is the full process vector; its first two
|
|
92
|
+
* positions (executable and script) are skipped.
|
|
79
93
|
*
|
|
80
|
-
* - `help` and `version` write to stdout; the version is read from this package's
|
|
81
|
-
*
|
|
82
|
-
* - `
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
94
|
+
* - `help` and `version` write to stdout; the version is read from this package's
|
|
95
|
+
* `package.json`.
|
|
96
|
+
* - `create` writes a single production, or with `--workspace` a workspace root,
|
|
97
|
+
* into the directory resolved against the working directory. The name is the
|
|
98
|
+
* typed `--name`, else derived from the target's basename; for the working
|
|
99
|
+
* directory itself the terminal is asked, offering `automovie-examples`,
|
|
100
|
+
* which is used without asking when no terminal is attached.
|
|
101
|
+
* - `add` fills missing scaffold catalog entries in the working directory's
|
|
102
|
+
* `pnpm-workspace.yaml` and writes a production into
|
|
103
|
+
* `movies/<family>/<directory>`. Its name is `--name` or the npm-safe name
|
|
104
|
+
* derived from the directory segment.
|
|
105
|
+
* - `capture` runs `captureAutoMovie` in the working directory as the production,
|
|
106
|
+
* resolving to its status: 1 when a cell was not drawn.
|
|
107
|
+
* - `inspect` runs `inspectAutoMovie` in the working directory, serving the
|
|
108
|
+
* inspector page until the process is interrupted.
|
|
109
|
+
* - `render` runs `renderAutoMovie` in the working directory as the production,
|
|
110
|
+
* resolving to 0 once the video is written.
|
|
111
|
+
* - `review` runs `reviewAutoMovie`, resolving to 1 when the recorded page
|
|
112
|
+
* reported a script error.
|
|
87
113
|
*
|
|
88
|
-
* `create` and `add` take their files from `createAutoMovieScaffold` and refuse
|
|
114
|
+
* `create` and `add` take their files from `createAutoMovieScaffold` and refuse
|
|
115
|
+
* a non-empty target without `--force`, which writes over same-path files and
|
|
116
|
+
* keeps every other file. On success they list the written files relative to
|
|
117
|
+
* the target, then the next steps. A failed write stops there and leaves the
|
|
118
|
+
* files already written.
|
|
89
119
|
*
|
|
90
|
-
* Resolves to the process exit code, 0 after queuing the requested stdout text
|
|
120
|
+
* Resolves to the process exit code, 0 after queuing the requested stdout text
|
|
121
|
+
* or 1 after queuing a caught error's message and distinct `cause` objects'
|
|
122
|
+
* messages without stacks. A repeated cause ends the chain. Reading or
|
|
123
|
+
* stringifying an unusual thrown value, or writing stderr, can itself throw.
|
|
124
|
+
* The executable assigns the result to `process.exitCode` so queued output can
|
|
125
|
+
* drain.
|
|
91
126
|
*
|
|
92
127
|
* @param argv The full process vector.
|
|
93
128
|
* @returns The exit code.
|
|
94
|
-
*
|
|
95
|
-
* @evidence contracts/development/implementation.md#principled-implementation Parsing finishes before the scaffold is created, the whole file map exists before the first write, and path.resolve binds every target to the current working directory. describeError follows distinct cause values with a set to terminate cycles, but assumes their message access and string conversion do not throw.
|
|
96
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure This dispatcher delegates admission, name choice, the prompt and closing text to CLI owners and the file map to the template package, keeping only the write. Only bin.ts invokes it at module load, so importing run does not execute a request.
|
|
97
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts `add` checks only the working directory for `pnpm-workspace.yaml` and never searches ancestors. The catch reports failures without stacks and never retries a write or rolls back files.
|
|
98
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment gives argv ownership, every command's effect, name and target choice, retained file effects, and the returned status.
|
|
99
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms For n files, creation reads the scaffold once and each file is written once with its directory ensured; listing scans the written paths once. Failure formatting additionally walks the distinct cause chain.
|
|
100
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Every command takes fresh filesystem observations and reads the installed scaffold anew.
|
|
101
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The file map and listing text scale with scaffold size; the cause set scales with chain length without a fixed cap. The prompt closes its terminal interface before returning. This dispatcher owns no descriptor; queued stdout and stderr bytes belong to the process streams.
|
|
102
129
|
*/
|
|
103
130
|
export async function run(argv: readonly string[]): Promise<number> {
|
|
104
131
|
try {
|
|
@@ -124,6 +151,12 @@ export async function run(argv: readonly string[]): Promise<number> {
|
|
|
124
151
|
args: command.args,
|
|
125
152
|
root: process.cwd(),
|
|
126
153
|
});
|
|
154
|
+
if (command.command === "verify")
|
|
155
|
+
return await verifyAutoMovie({
|
|
156
|
+
args: command.args,
|
|
157
|
+
root: process.cwd(),
|
|
158
|
+
env: process.env,
|
|
159
|
+
});
|
|
127
160
|
if (command.command === "render")
|
|
128
161
|
return await renderAutoMovie({
|
|
129
162
|
args: command.args,
|
|
@@ -176,7 +209,9 @@ export async function run(argv: readonly string[]): Promise<number> {
|
|
|
176
209
|
}
|
|
177
210
|
|
|
178
211
|
/**
|
|
179
|
-
* Write one created installation into `directory`, then list the written files
|
|
212
|
+
* Write one created installation into `directory`, then list the written files
|
|
213
|
+
* and the next steps. A non-empty directory is refused unless `force` is set,
|
|
214
|
+
* which writes over same-path files and keeps every other file.
|
|
180
215
|
*/
|
|
181
216
|
function write(
|
|
182
217
|
directory: string,
|
|
@@ -208,7 +243,10 @@ function write(
|
|
|
208
243
|
);
|
|
209
244
|
}
|
|
210
245
|
|
|
211
|
-
/**
|
|
246
|
+
/**
|
|
247
|
+
* Replace an incomplete catalog atomically. A concurrent updater or editor
|
|
248
|
+
* leaves this invocation free to retry.
|
|
249
|
+
*/
|
|
212
250
|
function completeCatalogs(file: string): void {
|
|
213
251
|
const target: string = fs.realpathSync(file);
|
|
214
252
|
const source: string = fs.readFileSync(target, "utf8");
|
|
@@ -242,17 +280,29 @@ function completeCatalogs(file: string): void {
|
|
|
242
280
|
}
|
|
243
281
|
|
|
244
282
|
/**
|
|
245
|
-
* This package's version, read at runtime from the sibling `package.json`
|
|
283
|
+
* This package's version, read at runtime from the sibling `package.json`
|
|
284
|
+
* (`require`, not an `import`, so it stays outside `rootDir`). `__dirname`
|
|
285
|
+
* resolves to `src` under ttsx and `lib` when published; the file sits one
|
|
286
|
+
* level up in both.
|
|
246
287
|
*/
|
|
247
288
|
function packageVersion(): string {
|
|
248
|
-
const manifest:
|
|
289
|
+
const manifest: IAutoMovieCliManifest = require(
|
|
249
290
|
path.join(__dirname, "..", "package.json"),
|
|
250
|
-
)
|
|
291
|
+
);
|
|
251
292
|
return manifest.version;
|
|
252
293
|
}
|
|
253
294
|
|
|
295
|
+
/** The field of this package's `package.json` the command reads. */
|
|
296
|
+
interface IAutoMovieCliManifest {
|
|
297
|
+
/** The package's version, as `npm` publishes it. */
|
|
298
|
+
version: string;
|
|
299
|
+
}
|
|
300
|
+
|
|
254
301
|
/**
|
|
255
|
-
* One stderr block: the error's message, then each distinct cause value's
|
|
302
|
+
* One stderr block: the error's message, then each distinct cause value's
|
|
303
|
+
* message on its own `caused by:` line. Values outside `Error` are stringified
|
|
304
|
+
* and end the chain. Repeated object identity or primitive value stops
|
|
305
|
+
* traversal; getters and string conversion can throw.
|
|
256
306
|
*/
|
|
257
307
|
function describeError(error: unknown): string {
|
|
258
308
|
const lines: string[] = [];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieDeliveryContentAudit,
|
|
3
|
+
IAutoMovieLoudnessMeter,
|
|
4
|
+
} from "@automovie/interface";
|
|
5
|
+
|
|
6
|
+
import { decodeAutoMovieDeliveryAudio } from "./decodeAutoMovieDeliveryAudio";
|
|
7
|
+
import { planAutoMovieDeliveryAudioDecode } from "./planAutoMovieDeliveryAudioDecode";
|
|
8
|
+
import { readAutoMovieDeliveryAudioTrack } from "./readAutoMovieDeliveryAudioTrack";
|
|
9
|
+
import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Audits audio from the same encoded artifact as the video decode. Uses
|
|
13
|
+
* streamed PCM for content, the decoder's native sample clock for coverage and
|
|
14
|
+
* the container's presented duration to separate codec padding.
|
|
15
|
+
*
|
|
16
|
+
* @param binary The FFmpeg executable already resolved by the delivery host.
|
|
17
|
+
* @param path The encoded artifact to decode without modification.
|
|
18
|
+
* @param streamIndex The primary audio stream observed in the input listing.
|
|
19
|
+
* @param thresholds The audio silence threshold and minimum duration.
|
|
20
|
+
* @param run The established FFmpeg process owner with separate output
|
|
21
|
+
* consumers.
|
|
22
|
+
* @param meter Creates the render's loudness meter, when the decoded loudness
|
|
23
|
+
* and true peak are measured.
|
|
24
|
+
* @returns Audio evidence or a reason decoded content is uncovered.
|
|
25
|
+
*/
|
|
26
|
+
export async function runAutoMovieDeliveryAudioDecode(
|
|
27
|
+
binary: string,
|
|
28
|
+
path: string,
|
|
29
|
+
streamIndex: number,
|
|
30
|
+
thresholds: IAutoMovieDeliveryContentAudit.IThresholds["silence"],
|
|
31
|
+
run: typeof runAutoMovieFfmpeg,
|
|
32
|
+
meter?: (channels: 1 | 2) => IAutoMovieLoudnessMeter,
|
|
33
|
+
): Promise<IAutoMovieDeliveryContentAudit.Stream> {
|
|
34
|
+
const track = await readAutoMovieDeliveryAudioTrack(path, streamIndex);
|
|
35
|
+
if (track.status === "uncovered") return track;
|
|
36
|
+
return decodeAutoMovieDeliveryAudio(
|
|
37
|
+
binary,
|
|
38
|
+
planAutoMovieDeliveryAudioDecode(path),
|
|
39
|
+
streamIndex,
|
|
40
|
+
thresholds,
|
|
41
|
+
run,
|
|
42
|
+
track,
|
|
43
|
+
meter,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieDeliveryContentAudit,
|
|
3
|
+
IAutoMovieLoudnessMeter,
|
|
4
|
+
} from "@automovie/interface";
|
|
5
|
+
|
|
6
|
+
import { planAutoMovieDeliveryDecode } from "./planAutoMovieDeliveryDecode";
|
|
7
|
+
import { readAutoMovieDeliveryDecode } from "./readAutoMovieDeliveryDecode";
|
|
8
|
+
import { runAutoMovieDeliveryAudioDecode } from "./runAutoMovieDeliveryAudioDecode";
|
|
9
|
+
import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
|
|
10
|
+
|
|
11
|
+
type Audit = IAutoMovieDeliveryContentAudit.IProps;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Decodes one encoded delivery to obtain native timing and content evidence.
|
|
15
|
+
* The primary video decode also inventories the source. Audio is decoded only
|
|
16
|
+
* when the source lists a primary audio stream.
|
|
17
|
+
*
|
|
18
|
+
* @param binary The resolved FFmpeg executable.
|
|
19
|
+
* @param artifact The same delivery artifact whose bytes the host hashes.
|
|
20
|
+
* @param expected The commissioned frame count and rational frame rate.
|
|
21
|
+
* @param thresholds Effective video detector and silence thresholds.
|
|
22
|
+
* @param run Process owner with separate binary and text output channels.
|
|
23
|
+
* @param meter Creates the render's loudness meter, when the decoded audio's
|
|
24
|
+
* loudness and true peak are measured.
|
|
25
|
+
* @returns Native evidence, absence or reasoned uncovered status per stream.
|
|
26
|
+
*/
|
|
27
|
+
export async function runAutoMovieDeliveryDecode(
|
|
28
|
+
binary: string,
|
|
29
|
+
artifact: string,
|
|
30
|
+
expected: Pick<Audit["expected"], "frameCount" | "frameRate">,
|
|
31
|
+
thresholds: Audit["thresholds"],
|
|
32
|
+
run: typeof runAutoMovieFfmpeg = runAutoMovieFfmpeg,
|
|
33
|
+
meter?: (channels: 1 | 2) => IAutoMovieLoudnessMeter,
|
|
34
|
+
): Promise<Audit["streams"]> {
|
|
35
|
+
try {
|
|
36
|
+
const log = await run(
|
|
37
|
+
binary,
|
|
38
|
+
planAutoMovieDeliveryDecode(artifact, expected.frameRate, thresholds),
|
|
39
|
+
);
|
|
40
|
+
const decoded = readAutoMovieDeliveryDecode(log, expected);
|
|
41
|
+
const audio =
|
|
42
|
+
decoded.audioIndex === undefined
|
|
43
|
+
? decoded.audio
|
|
44
|
+
: await runAutoMovieDeliveryAudioDecode(
|
|
45
|
+
binary,
|
|
46
|
+
artifact,
|
|
47
|
+
decoded.audioIndex,
|
|
48
|
+
thresholds.silence,
|
|
49
|
+
run,
|
|
50
|
+
meter,
|
|
51
|
+
);
|
|
52
|
+
return { video: decoded.video, audio };
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
55
|
+
return {
|
|
56
|
+
video: { status: "uncovered", reason },
|
|
57
|
+
audio: {
|
|
58
|
+
status: "uncovered",
|
|
59
|
+
reason: "The delivery input stream listing was incomplete",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { IAutoMovieDeliveryContentAudit } from "@automovie/interface";
|
|
2
|
+
|
|
3
|
+
import { planAutoMovieDeliveryDecode } from "./planAutoMovieDeliveryDecode";
|
|
4
|
+
import { readAutoMovieDeliveryDecode } from "./readAutoMovieDeliveryDecode";
|
|
5
|
+
import { runAutoMovieDeliverySourceAudioDecode } from "./runAutoMovieDeliverySourceAudioDecode";
|
|
6
|
+
import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
|
|
7
|
+
|
|
8
|
+
type Audit = IAutoMovieDeliveryContentAudit.IProps;
|
|
9
|
+
type Stream = IAutoMovieDeliveryContentAudit.Stream;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Measures what the encoder was given, with the same detectors and thresholds
|
|
13
|
+
* as the delivered file: the drawn image sequence and the soundtrack as the
|
|
14
|
+
* encoder pads and cuts it. The audit attributes a delivered black, frozen or
|
|
15
|
+
* silent interval to the drawn source when this reference shows it too.
|
|
16
|
+
*
|
|
17
|
+
* Both inputs are read from the encoder's own argument vector, so the reference
|
|
18
|
+
* is exactly what produced the delivery: the first `-i` with the `-framerate`
|
|
19
|
+
* before it is the picture, a second `-i` is the soundtrack, and the last `-t`
|
|
20
|
+
* is the cut. Call it while the drawn frames still exist.
|
|
21
|
+
*
|
|
22
|
+
* @param binary The FFmpeg executable already resolved by the delivery host.
|
|
23
|
+
* @param encoder The argument vector the delivery encode ran with.
|
|
24
|
+
* @param expected The commissioned frame count and rational frame rate.
|
|
25
|
+
* @param thresholds The effective detector settings of the delivery audit.
|
|
26
|
+
* @param run The established FFmpeg process owner.
|
|
27
|
+
* @returns Reference evidence per medium: decoded, missing when the encoder had
|
|
28
|
+
* no soundtrack, or uncovered with its reason.
|
|
29
|
+
*/
|
|
30
|
+
export async function runAutoMovieDeliveryReferenceDecode(
|
|
31
|
+
binary: string,
|
|
32
|
+
encoder: readonly string[],
|
|
33
|
+
expected: Pick<Audit["expected"], "frameCount" | "frameRate">,
|
|
34
|
+
thresholds: Audit["thresholds"],
|
|
35
|
+
run: typeof runAutoMovieFfmpeg = runAutoMovieFfmpeg,
|
|
36
|
+
): Promise<{ video: Stream; audio: Stream }> {
|
|
37
|
+
const inputs = readEncoderInputs(encoder);
|
|
38
|
+
if (inputs === null) {
|
|
39
|
+
const reason = "The delivery encoder arguments name no picture input";
|
|
40
|
+
return {
|
|
41
|
+
video: { status: "uncovered", reason },
|
|
42
|
+
audio: { status: "uncovered", reason },
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let video: Stream;
|
|
47
|
+
try {
|
|
48
|
+
const log = await run(
|
|
49
|
+
binary,
|
|
50
|
+
planAutoMovieDeliveryDecode(
|
|
51
|
+
inputs.picture,
|
|
52
|
+
expected.frameRate,
|
|
53
|
+
thresholds,
|
|
54
|
+
["-framerate", inputs.frameRate],
|
|
55
|
+
),
|
|
56
|
+
);
|
|
57
|
+
video = readAutoMovieDeliveryDecode(log, expected).video;
|
|
58
|
+
} catch (error) {
|
|
59
|
+
video = {
|
|
60
|
+
status: "uncovered",
|
|
61
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const audio: Stream =
|
|
66
|
+
inputs.soundtrack === null
|
|
67
|
+
? { status: "missing" }
|
|
68
|
+
: inputs.seconds === null
|
|
69
|
+
? {
|
|
70
|
+
status: "uncovered",
|
|
71
|
+
reason: "The delivery encoder arguments name no duration",
|
|
72
|
+
}
|
|
73
|
+
: await runAutoMovieDeliverySourceAudioDecode(
|
|
74
|
+
binary,
|
|
75
|
+
inputs.soundtrack,
|
|
76
|
+
inputs.seconds,
|
|
77
|
+
thresholds.silence,
|
|
78
|
+
run,
|
|
79
|
+
);
|
|
80
|
+
return { video, audio };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Reads the picture input, its frame rate, an optional soundtrack and the cut
|
|
85
|
+
* from an encoder vector.
|
|
86
|
+
*/
|
|
87
|
+
function readEncoderInputs(encoder: readonly string[]): {
|
|
88
|
+
picture: string;
|
|
89
|
+
frameRate: string;
|
|
90
|
+
soundtrack: string | null;
|
|
91
|
+
seconds: string | null;
|
|
92
|
+
} | null {
|
|
93
|
+
const first = encoder.indexOf("-i");
|
|
94
|
+
const rate = encoder.lastIndexOf("-framerate", first);
|
|
95
|
+
const picture = encoder[first + 1];
|
|
96
|
+
const frameRate = encoder[rate + 1];
|
|
97
|
+
if (first < 0 || rate < 0 || picture === undefined || frameRate === undefined)
|
|
98
|
+
return null;
|
|
99
|
+
const second = encoder.indexOf("-i", first + 2);
|
|
100
|
+
const cut = encoder.lastIndexOf("-t");
|
|
101
|
+
return {
|
|
102
|
+
picture,
|
|
103
|
+
frameRate,
|
|
104
|
+
soundtrack: second < 0 ? null : (encoder[second + 1] ?? null),
|
|
105
|
+
seconds: cut < 0 ? null : (encoder[cut + 1] ?? null),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { IAutoMovieDeliveryContentAudit } from "@automovie/interface";
|
|
2
|
+
|
|
3
|
+
import { decodeAutoMovieDeliveryAudio } from "./decodeAutoMovieDeliveryAudio";
|
|
4
|
+
import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
|
|
5
|
+
|
|
6
|
+
/** The delivery encoder's soundtrack rate, in Hz. */
|
|
7
|
+
const SOURCE_SAMPLE_RATE = 48_000;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Audits a soundtrack exactly as the delivery encoder feeds it: resampled to 48
|
|
11
|
+
* kHz stereo, padded with silence and cut at the encoder's own duration,
|
|
12
|
+
* rounded to the nearest sample. The cut is made inside the filter graph, ahead
|
|
13
|
+
* of the frame log, so the log and the PCM see the same samples; an output `-t`
|
|
14
|
+
* would shorten only the PCM. This is the source the encoded audio is compared
|
|
15
|
+
* with. Uncompressed PCM has no codec padding, so every decoded sample is
|
|
16
|
+
* presented.
|
|
17
|
+
*
|
|
18
|
+
* @param binary The FFmpeg executable already resolved by the delivery host.
|
|
19
|
+
* @param soundtrack The soundtrack file the encoder read.
|
|
20
|
+
* @param seconds The encoder's own `-t` argument, unchanged.
|
|
21
|
+
* @param thresholds The audio silence threshold and minimum duration.
|
|
22
|
+
* @param run The established FFmpeg process owner with separate output
|
|
23
|
+
* consumers.
|
|
24
|
+
* @returns Source audio evidence as stream zero, or a reason it is uncovered.
|
|
25
|
+
*/
|
|
26
|
+
export async function runAutoMovieDeliverySourceAudioDecode(
|
|
27
|
+
binary: string,
|
|
28
|
+
soundtrack: string,
|
|
29
|
+
seconds: string,
|
|
30
|
+
thresholds: IAutoMovieDeliveryContentAudit.IThresholds["silence"],
|
|
31
|
+
run: typeof runAutoMovieFfmpeg,
|
|
32
|
+
): Promise<IAutoMovieDeliveryContentAudit.Stream> {
|
|
33
|
+
const samples = Math.round(Number(seconds) * SOURCE_SAMPLE_RATE);
|
|
34
|
+
if (!Number.isSafeInteger(samples) || samples < 1)
|
|
35
|
+
return {
|
|
36
|
+
status: "uncovered",
|
|
37
|
+
reason:
|
|
38
|
+
"The encoder's soundtrack duration is not a positive sample count",
|
|
39
|
+
};
|
|
40
|
+
return decodeAutoMovieDeliveryAudio(
|
|
41
|
+
binary,
|
|
42
|
+
[
|
|
43
|
+
"-hide_banner",
|
|
44
|
+
"-nostdin",
|
|
45
|
+
"-nostats",
|
|
46
|
+
"-xerror",
|
|
47
|
+
"-i",
|
|
48
|
+
soundtrack,
|
|
49
|
+
"-map",
|
|
50
|
+
"0:a:0",
|
|
51
|
+
"-vn",
|
|
52
|
+
"-af",
|
|
53
|
+
[
|
|
54
|
+
"aresample=" + SOURCE_SAMPLE_RATE,
|
|
55
|
+
"aformat=sample_fmts=flt:channel_layouts=stereo",
|
|
56
|
+
"apad=whole_len=" + samples,
|
|
57
|
+
"atrim=end_sample=" + samples,
|
|
58
|
+
"ashowinfo",
|
|
59
|
+
].join(","),
|
|
60
|
+
"-c:a",
|
|
61
|
+
"pcm_f32le",
|
|
62
|
+
"-f",
|
|
63
|
+
"f32le",
|
|
64
|
+
"pipe:1",
|
|
65
|
+
],
|
|
66
|
+
0,
|
|
67
|
+
thresholds,
|
|
68
|
+
run,
|
|
69
|
+
undefined,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -1,43 +1,77 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
|
|
3
|
+
/** Optional consumers for a decoder that produces binary and text evidence. */
|
|
4
|
+
interface IAutoMovieFfmpegOutput {
|
|
5
|
+
stdout?: (chunk: Buffer) => void;
|
|
6
|
+
stderr?: (chunk: string) => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
3
9
|
/** Lines of FFmpeg's error output kept for a failure message. */
|
|
4
10
|
const TAIL: number = 12;
|
|
5
11
|
|
|
6
12
|
/**
|
|
7
|
-
* Run FFmpeg once with the given arguments, resolving with its error output
|
|
13
|
+
* Run FFmpeg once with the given arguments, resolving with its error output
|
|
14
|
+
* when it exits as `accept` allows and rejecting otherwise.
|
|
8
15
|
*
|
|
9
|
-
* FFmpeg writes its log, including a probe of every input, to its error output,
|
|
16
|
+
* FFmpeg writes its log, including a probe of every input, to its error output,
|
|
17
|
+
* so that text is what callers read. By default only exit status 0 is accepted;
|
|
18
|
+
* a probe that names no output exits 1 by design and accepts it. A rejection
|
|
19
|
+
* names the binary, the exit status and the last lines of the log.
|
|
10
20
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Spawn, collect the error output, settle on exit.
|
|
14
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A failed run is never retried, and a failure to start rejects with its cause.
|
|
15
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the log FFmpeg writes.
|
|
16
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each run is its own process.
|
|
17
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The child process ends before the promise settles; its log is held until then.
|
|
21
|
+
* Output consumers, when provided, receive chunks as the child writes them. A
|
|
22
|
+
* consumer failure terminates the child and rejects after it has closed.
|
|
18
23
|
*/
|
|
19
24
|
export function runAutoMovieFfmpeg(
|
|
20
25
|
binary: string,
|
|
21
26
|
args: readonly string[],
|
|
22
27
|
accept: (code: number | null) => boolean = (code: number | null): boolean =>
|
|
23
28
|
code === 0,
|
|
29
|
+
output?: IAutoMovieFfmpegOutput,
|
|
24
30
|
): Promise<string> {
|
|
25
31
|
return new Promise<string>(
|
|
26
32
|
(resolve: (log: string) => void, reject: (error: Error) => void): void => {
|
|
27
33
|
const child: ReturnType<typeof spawn> = spawn(binary, [...args], {
|
|
28
|
-
stdio: [
|
|
34
|
+
stdio: [
|
|
35
|
+
"ignore",
|
|
36
|
+
output?.stdout === undefined ? "ignore" : "pipe",
|
|
37
|
+
"pipe",
|
|
38
|
+
],
|
|
29
39
|
windowsHide: true,
|
|
30
40
|
});
|
|
31
41
|
let log: string = "";
|
|
42
|
+
let refusal: Error | undefined;
|
|
43
|
+
const consume = <Chunk>(
|
|
44
|
+
stream: "stdout" | "stderr",
|
|
45
|
+
reader: ((chunk: Chunk) => void) | undefined,
|
|
46
|
+
chunk: Chunk,
|
|
47
|
+
): void => {
|
|
48
|
+
if (reader === undefined || refusal !== undefined) return;
|
|
49
|
+
try {
|
|
50
|
+
reader(chunk);
|
|
51
|
+
} catch (cause) {
|
|
52
|
+
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
53
|
+
refusal = new Error(
|
|
54
|
+
`FFmpeg ${binary} ${stream} consumer failed: ${reason}`,
|
|
55
|
+
{ cause },
|
|
56
|
+
);
|
|
57
|
+
child.kill();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
child.stdout?.on("data", (chunk: Buffer): void =>
|
|
61
|
+
consume("stdout", output?.stdout, chunk),
|
|
62
|
+
);
|
|
32
63
|
child.stderr!.setEncoding("utf8");
|
|
33
64
|
child.stderr!.on("data", (chunk: string): void => {
|
|
34
65
|
log += chunk;
|
|
66
|
+
consume("stderr", output?.stderr, chunk);
|
|
67
|
+
});
|
|
68
|
+
child.on("error", (error: Error): void => {
|
|
69
|
+
if (refusal === undefined)
|
|
70
|
+
reject(new Error(`FFmpeg ${binary} did not start`, { cause: error }));
|
|
35
71
|
});
|
|
36
|
-
child.on("error", (error: Error): void =>
|
|
37
|
-
reject(new Error(`FFmpeg ${binary} did not start`, { cause: error })),
|
|
38
|
-
);
|
|
39
72
|
child.on("close", (code: number | null): void => {
|
|
40
|
-
if (
|
|
73
|
+
if (refusal !== undefined) reject(refusal);
|
|
74
|
+
else if (accept(code)) resolve(log);
|
|
41
75
|
else
|
|
42
76
|
reject(
|
|
43
77
|
new Error(
|