@gentbajko/slopify 4.4.0 → 4.5.1
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/edge/http/projects.js +7 -3
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/main.js +12 -3
- package/dist/patch-notes/4.5.0.md +20 -0
- package/dist/patch-notes/4.5.1.md +11 -0
- package/dist/patch-notes/index.json +12 -0
- package/dist/slices/admission/schema.js +3 -1
- package/dist/slices/rebuild/activity.js +37 -4
- package/dist/slices/rebuild/recipe-edit.js +8 -1
- package/dist/slices/rebuild/runtime-export.js +4 -3
- package/dist/slices/video/edit-settings.js +17 -0
- package/dist/slices/video/encoder-probe.js +124 -0
- package/dist/slices/video/encoding.js +143 -91
- package/dist/slices/video/ffmpeg.js +4 -2
- package/dist/slices/video/slideshow.js +32 -8
- package/dist/tutorials/Create-Video-and-Style.md +13 -0
- package/dist/tutorials/Settings-Reference.md +2 -0
- package/dist/tutorials/Video-Editing.md +4 -0
- package/dist/web/assets/index-C0n0zeuZ.js +460 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-CA_I2trg.js +0 -460
|
@@ -13,7 +13,7 @@ import { channelById, projectChannels, setProjectChannel } from "../../slices/ch
|
|
|
13
13
|
import { withProjectControl } from "../../slices/control/lock.js";
|
|
14
14
|
import { stagesWithEta } from "../../slices/eta/view.js";
|
|
15
15
|
import { sampleProjectIds } from "../../slices/onboarding/sample.js";
|
|
16
|
-
import { videoActivity } from "../../slices/rebuild/activity.js";
|
|
16
|
+
import { imagesActivity, videoActivity } from "../../slices/rebuild/activity.js";
|
|
17
17
|
import { projectHolds } from "../../slices/reviews/holds.js";
|
|
18
18
|
import { adoptBaseline } from "../../slices/revisions/adopt.js";
|
|
19
19
|
import { currentRevisionId } from "../../slices/revisions/repo.js";
|
|
@@ -143,9 +143,13 @@ export function projectRoutes(deps) {
|
|
|
143
143
|
...(stopped ? { stopped: true } : {}),
|
|
144
144
|
},
|
|
145
145
|
stages: stagesWithEta(deps.db, stagesOf(deps.db, project.id), project.config, deps.clock.now()).map((stage) => {
|
|
146
|
-
if (stage.
|
|
146
|
+
if (stage.state !== "running")
|
|
147
147
|
return stage;
|
|
148
|
-
const activity =
|
|
148
|
+
const activity = stage.kind === "video"
|
|
149
|
+
? videoActivity(deps.db, project.id)
|
|
150
|
+
: stage.kind === "images"
|
|
151
|
+
? imagesActivity(deps.db, project.id)
|
|
152
|
+
: undefined;
|
|
149
153
|
return activity === undefined ? stage : { ...stage, activity };
|
|
150
154
|
}),
|
|
151
155
|
outputs: outputsOf(deps.db, project.id),
|
|
Binary file
|
|
Binary file
|
package/dist/main.js
CHANGED
|
@@ -119,7 +119,8 @@ import { storedUnknownAcks } from "./slices/template-studio/save.js";
|
|
|
119
119
|
import { notReadySentence, runnableTemplate, templateGate, } from "./slices/template-studio/schedule-gate.js";
|
|
120
120
|
import { createPriceCache } from "./slices/template-studio/service.js";
|
|
121
121
|
import { createTrashPurge } from "./slices/trash/service.js";
|
|
122
|
-
import { createNvencProbe,
|
|
122
|
+
import { createNvencProbe, createSvtAv1Probe } from "./slices/video/encoder-probe.js";
|
|
123
|
+
import { noNvenc, noSvtAv1, renderMachine } from "./slices/video/encoding.js";
|
|
123
124
|
import { probeDurationMs, runFfmpegAt } from "./slices/video/ffmpeg.js";
|
|
124
125
|
import { createRenderGate } from "./slices/video/render-gate.js";
|
|
125
126
|
import { watchActivation } from "./updater/candidate.js";
|
|
@@ -262,6 +263,13 @@ export async function boot(config, options = {}) {
|
|
|
262
263
|
exec: ffmpegOutput,
|
|
263
264
|
log,
|
|
264
265
|
});
|
|
266
|
+
// A project's Video codec AV1 on the processor: the bundled ffmpeg has no SVT-AV1, so the
|
|
267
|
+
// computer's own is asked, once, when a render first needs it.
|
|
268
|
+
const svtav1 = createSvtAv1Probe({
|
|
269
|
+
candidates: [ffmpeg, "ffmpeg", "/usr/bin/ffmpeg"],
|
|
270
|
+
exec: ffmpegOutput,
|
|
271
|
+
log,
|
|
272
|
+
});
|
|
265
273
|
// Settings → Production defaults → Render priority for the ffmpeg work outside a project's
|
|
266
274
|
// render (Template Studio's samples, designs' drawing, posts' pictures), read as each starts.
|
|
267
275
|
const renderPriority = () => readSettings({ db: runtimeDb, log }).renderPriority;
|
|
@@ -353,6 +361,7 @@ export async function boot(config, options = {}) {
|
|
|
353
361
|
catalogue,
|
|
354
362
|
ffmpeg,
|
|
355
363
|
nvenc,
|
|
364
|
+
svtav1,
|
|
356
365
|
audioPreviews,
|
|
357
366
|
});
|
|
358
367
|
const updateDb = db;
|
|
@@ -1071,7 +1080,7 @@ export async function boot(config, options = {}) {
|
|
|
1071
1080
|
throw error;
|
|
1072
1081
|
}
|
|
1073
1082
|
}
|
|
1074
|
-
export function wireRunner({ onFinished, audioPreviews, db, paths, clock, ids, log, hub, telemetry, flusher, registry, catalogue, ffmpeg, nvenc = async () => ({ available: false, reason: noNvenc }),
|
|
1083
|
+
export function wireRunner({ onFinished, audioPreviews, db, paths, clock, ids, log, hub, telemetry, flusher, registry, catalogue, ffmpeg, nvenc = async () => ({ available: false, reason: noNvenc }), svtav1 = async () => ({ available: false, reason: noSvtAv1 }),
|
|
1075
1084
|
// Settings → Production defaults → Subtitle timing model, read as each alignment starts.
|
|
1076
1085
|
alignSubtitles: aligner = alignSubtitlesWith(() => readSettings({ db, log }).subtitleModel),
|
|
1077
1086
|
// Settings → Production defaults → Videos rendered at once, read as each render asks for its
|
|
@@ -1093,7 +1102,7 @@ renderGate = createRenderGate(() => readSettings({ db, log }).videoRenderConcurr
|
|
|
1093
1102
|
ffmpeg,
|
|
1094
1103
|
alignSubtitles: aligner,
|
|
1095
1104
|
// Settings → Production defaults → Rendering, read as each render starts.
|
|
1096
|
-
renderMachine: (projectId) => renderMachine({ settings: readSettings({ db, log }), nvenc, log, projectId }),
|
|
1105
|
+
renderMachine: (projectId, codec) => renderMachine({ settings: readSettings({ db, log }), nvenc, svtav1, codec, log, projectId }),
|
|
1097
1106
|
// One queue for every render this computer makes, so a second video waits rather than
|
|
1098
1107
|
// taking the processor and memory the first one and the page are using.
|
|
1099
1108
|
renderGate,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Slopify 4.5.0
|
|
2
|
+
|
|
3
|
+
Released 18 November 2026.
|
|
4
|
+
|
|
5
|
+
Long videos now come out AV1 on an NVIDIA graphics card, about half the size of before for the same picture, and every template can choose its own video codec.
|
|
6
|
+
|
|
7
|
+
## Smaller videos: AV1 on the graphics card by default
|
|
8
|
+
|
|
9
|
+
- **The long video is now encoded as AV1 on the NVIDIA card wherever the card can do it,** whatever Settings → Production defaults → Video encoder says. Measured on a real 3-minute stretch of a 1080p video (slow pan and zoom over dense engraving), the card's AV1 file is about 44% of the size of the H.264 one for the same picture (about 94.4 VMAF against it).
|
|
10
|
+
- **Without a card, or on a card that can't encode AV1, nothing changes:** the video is made exactly as before, as H.264 through the Video encoder setting, and nothing is said about it.
|
|
11
|
+
- **If the card's AV1 encode fails mid-render,** the video is made again the old way.
|
|
12
|
+
- **No finished video turns outdated.** A video comes out AV1 the next time it is made for another reason.
|
|
13
|
+
|
|
14
|
+
## Choose a video codec per template
|
|
15
|
+
|
|
16
|
+
- **Video codec is a new setting in the Video section of Create, the template editor and Edit settings:** Automatic (the default: AV1 on the graphics card, else H.264), H.264, HEVC or AV1.
|
|
17
|
+
- **H.264** keeps a video exactly as before, never AV1.
|
|
18
|
+
- **HEVC and AV1** make a much smaller file. AV1 on the processor (SVT-AV1) is about 29% of the H.264 size but renders slower and needs an ffmpeg with SVT-AV1 on the computer; AV1 on the card is about 44%; HEVC on the card about 59%. HEVC on the processor (x265) is not measured yet.
|
|
19
|
+
- **A video is never failed for its codec.** When the chosen codec isn't available, the video is made as H.264 and the project's Video part says so and where to change it.
|
|
20
|
+
- **Only the long video changes.** Shorts and the style preview stay H.264, for the services shorts go to.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Slopify 4.5.1
|
|
2
|
+
|
|
3
|
+
Released 18 November 2026.
|
|
4
|
+
|
|
5
|
+
The Images step now counts its pictures and their checks apart, so a video of 240 pictures no longer reads "259 of 496".
|
|
6
|
+
|
|
7
|
+
## Pictures and checks counted once each
|
|
8
|
+
|
|
9
|
+
- **With the picture check on, the Images row says "234 of 240 pictures · 43 of 240 checked"** on the project page, in the run's step list and under Home's pictures. Before, every picture and every check counted as one step together, so 240 pictures showed as about 496.
|
|
10
|
+
- **The time left still covers both:** the drawing and the checking still to do.
|
|
11
|
+
- **Without the picture check,** the row says only how many pictures are drawn.
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"id": "4.5.1",
|
|
4
|
+
"title": "Slopify 4.5.1",
|
|
5
|
+
"version": "4.5.1",
|
|
6
|
+
"date": "2026-11-18"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"id": "4.5.0",
|
|
10
|
+
"title": "Slopify 4.5.0",
|
|
11
|
+
"version": "4.5.0",
|
|
12
|
+
"date": "2026-11-18"
|
|
13
|
+
},
|
|
2
14
|
{
|
|
3
15
|
"id": "4.4.0",
|
|
4
16
|
"title": "Slopify 4.4.0",
|
|
@@ -12,7 +12,7 @@ import { reviewModes, reviewStages } from "../reviews/model.js";
|
|
|
12
12
|
import { socialSettingsSchema } from "../social/schema.js";
|
|
13
13
|
import { subtitleConfigSchema } from "../subtitles/model.js";
|
|
14
14
|
import { ambientBedSchema } from "../video/ambient-bed-schema.js";
|
|
15
|
-
import { animateModes, atmospheres, colorGrades, cutModes, lookLevels, transitionKinds, } from "../video/edit-settings.js";
|
|
15
|
+
import { animateModes, atmospheres, colorGrades, cutModes, lookLevels, transitionKinds, videoCodecs, } from "../video/edit-settings.js";
|
|
16
16
|
import { voicesSettingsSchema } from "../voices/model.js";
|
|
17
17
|
import { entryModes, formats, motionStyles, referenceSources, runModes, stageSources, } from "./model.js";
|
|
18
18
|
import { defaultEdgeSilenceSeconds, defaultImageSeconds, defaultMotionStyle, defaultZoomPercent, } from "./rules.js";
|
|
@@ -35,6 +35,8 @@ export const videoEditSchema = z.object({
|
|
|
35
35
|
animate: z.enum(animateModes),
|
|
36
36
|
animateEvery: z.number(),
|
|
37
37
|
animateModel: z.string(),
|
|
38
|
+
// Absent is Automatic (`video/edit-settings.ts`).
|
|
39
|
+
codec: z.enum(videoCodecs).optional(),
|
|
38
40
|
});
|
|
39
41
|
// The shape Play posts and the shape `projects.config` holds, in one place: the second
|
|
40
42
|
// is the first plus the rendered prompt texts.
|
|
@@ -11,21 +11,54 @@ function counted(rows, match) {
|
|
|
11
11
|
return undefined;
|
|
12
12
|
return { done: own.filter((row) => row.state === "done").length, total: own.length };
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
// The current version's steps of one stage.
|
|
15
|
+
function stageRows(db, projectId, kind) {
|
|
15
16
|
const head = currentRevisionId(db, projectId);
|
|
16
17
|
if (head === undefined)
|
|
17
18
|
return undefined;
|
|
18
|
-
|
|
19
|
+
return db
|
|
19
20
|
.prepare(`SELECT r.work_key AS key, w.state AS state, w.progress_current AS current, w.progress_total AS total
|
|
20
21
|
FROM revision_work_reservations r JOIN revision_work w ON w.id = r.work_id
|
|
21
|
-
WHERE r.revision_id = ? AND w.project_id = ? AND w.kind =
|
|
22
|
-
.all(head, projectId)
|
|
22
|
+
WHERE r.revision_id = ? AND w.project_id = ? AND w.kind = ?`)
|
|
23
|
+
.all(head, projectId, kind)
|
|
23
24
|
.map((row) => ({
|
|
24
25
|
key: String(row.key),
|
|
25
26
|
state: String(row.state),
|
|
26
27
|
current: typeof row.current === "number" ? row.current : null,
|
|
27
28
|
total: typeof row.total === "number" ? row.total : null,
|
|
28
29
|
}));
|
|
30
|
+
}
|
|
31
|
+
// What a running Images stage is doing. With the picture check on, each picture is a step and
|
|
32
|
+
// its check another, so the stage's own count read "259 of 496" for 240 pictures. Counted
|
|
33
|
+
// apart, each once: "240 of 240 pictures · 33 of 240 checked". Writing the scenes comes
|
|
34
|
+
// before any picture, and keeps the stage's own count.
|
|
35
|
+
export function imagesActivity(db, projectId) {
|
|
36
|
+
const rows = stageRows(db, projectId, "images");
|
|
37
|
+
if (rows === undefined)
|
|
38
|
+
return undefined;
|
|
39
|
+
const tally = (match) => {
|
|
40
|
+
const own = rows.filter((row) => match.test(row.key));
|
|
41
|
+
return { done: own.filter((row) => row.state === "done").length, total: own.length };
|
|
42
|
+
};
|
|
43
|
+
const pictures = tally(/^image:/);
|
|
44
|
+
if (pictures.total === 0)
|
|
45
|
+
return undefined;
|
|
46
|
+
const checks = tally(/^review:image:/);
|
|
47
|
+
const parts = [
|
|
48
|
+
{ noun: "pictures", ...pictures },
|
|
49
|
+
...(checks.total === 0 ? [] : [{ noun: "checked", ...checks }]),
|
|
50
|
+
];
|
|
51
|
+
return {
|
|
52
|
+
label: checks.total === 0 ? "drawing the pictures" : "drawing and checking the pictures",
|
|
53
|
+
done: pictures.done + checks.done,
|
|
54
|
+
total: pictures.total + checks.total,
|
|
55
|
+
parts,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export function videoActivity(db, projectId) {
|
|
59
|
+
const rows = stageRows(db, projectId, "video");
|
|
60
|
+
if (rows === undefined)
|
|
61
|
+
return undefined;
|
|
29
62
|
const running = (key) => rows.find((row) => row.key === key && row.state === "running");
|
|
30
63
|
const percent = (label, row) => {
|
|
31
64
|
const value = percentOf(row);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { fingerprint } from "../../kernel/runner/work.js";
|
|
3
3
|
import { usesYoutubeDescription } from "../admission/rules.js";
|
|
4
|
+
import { usesShortMode } from "../admission/short-mode.js";
|
|
4
5
|
import { headingChapters, topHeadings } from "../video/chapters.js";
|
|
5
6
|
import { chapterOpeningShots, sentenceCutPoints } from "../video/cuts.js";
|
|
6
|
-
import { animatedClipSeconds, animatedImageIndexes, animatePrompt, editNeedsTiming, usesAnimation, usesChapterCards, usesNarrationCuts, videoEditOf, } from "../video/edit-settings.js";
|
|
7
|
+
import { animatedClipSeconds, animatedImageIndexes, animatePrompt, editNeedsTiming, usesAnimation, usesChapterCards, usesNarrationCuts, videoCodecOf, videoEditOf, } from "../video/edit-settings.js";
|
|
7
8
|
import { fps } from "../video/plan.js";
|
|
8
9
|
import { recipe, resourceIdentity, selectedReference, } from "./recipe-model.js";
|
|
9
10
|
// What the Video stage's edit settings add to the plan: the word timing and chapters the
|
|
@@ -36,6 +37,12 @@ export function editPlan(context, exports, youtube, images, cards = []) {
|
|
|
36
37
|
edit.grade !== "none" ||
|
|
37
38
|
edit.atmosphere !== "none")
|
|
38
39
|
values.push(["look-v1", edit.vignette, edit.grain, edit.grade, edit.atmosphere]);
|
|
40
|
+
// Automatic and H.264 add nothing, so a project without a codec keeps its fingerprint: the
|
|
41
|
+
// next time it is made it simply comes out AV1 where the card can. A short-mode project
|
|
42
|
+
// renders as a short, which stays H.264.
|
|
43
|
+
const codec = videoCodecOf(config);
|
|
44
|
+
if ((codec === "hevc" || codec === "av1") && !usesShortMode(config))
|
|
45
|
+
values.push(["codec", codec]);
|
|
39
46
|
if (usesChapterCards(config))
|
|
40
47
|
values.push(["cards-v1", config.subtitles?.fontId ?? "default"]);
|
|
41
48
|
// The brand kit's end screen and title style; nothing when unset, so a project without them
|
|
@@ -10,6 +10,7 @@ import { allocateAsset, discardPreparedAssets, sealAsset } from "../storage/asse
|
|
|
10
10
|
import { outputPath, projectDir, renderCacheDir } from "../storage/layout.js";
|
|
11
11
|
import { audioExportArgs } from "../video/audio-export.js";
|
|
12
12
|
import { withPaths } from "../video/edit-list.js";
|
|
13
|
+
import { videoCodecOf } from "../video/edit-settings.js";
|
|
13
14
|
import { runFfmpeg } from "../video/ffmpeg.js";
|
|
14
15
|
import { planRender } from "../video/plan.js";
|
|
15
16
|
import { openRenderGate } from "../video/render-gate.js";
|
|
@@ -24,8 +25,8 @@ import { lineLevelledAudio } from "./runtime-lines.js";
|
|
|
24
25
|
import { preparedResult, preparedText, publishResult } from "./runtime-publication.js";
|
|
25
26
|
import { pieceAlreadyDone } from "./work-records.js";
|
|
26
27
|
// The machine settings for one render, and the notices it gathers for the project page.
|
|
27
|
-
export async function exportMachine(deps, projectId) {
|
|
28
|
-
const chosen = await deps.renderMachine?.(projectId);
|
|
28
|
+
export async function exportMachine(deps, projectId, codec = "h264") {
|
|
29
|
+
const chosen = await deps.renderMachine?.(projectId, codec);
|
|
29
30
|
const notices = chosen?.notice === undefined ? [] : [chosen.notice];
|
|
30
31
|
return {
|
|
31
32
|
machine: chosen?.machine,
|
|
@@ -134,7 +135,7 @@ export async function executeExportRecipe(deps, context, piece) {
|
|
|
134
135
|
};
|
|
135
136
|
if (!context.maySubmit(piece.id))
|
|
136
137
|
return "held";
|
|
137
|
-
const machine = await exportMachine(deps, context.work.projectId);
|
|
138
|
+
const machine = await exportMachine(deps, context.work.projectId, plan === undefined ? "h264" : videoCodecOf(config));
|
|
138
139
|
const priority = machine.machine?.priority;
|
|
139
140
|
const onProgress = (elapsedMs) => context.emit({
|
|
140
141
|
type: "stage.progress",
|
|
@@ -17,6 +17,12 @@ export const colorGrades = ["none", "warm", "cold", "desaturated", "sepia"];
|
|
|
17
17
|
// Drawn procedurally by ffmpeg's own filters (`look.ts`); no third-party footage.
|
|
18
18
|
export const atmospheres = ["none", "embers", "dust", "fog"];
|
|
19
19
|
export const animateModes = ["off", "chapters", "every"];
|
|
20
|
+
// The finished video's codec. How it is encoded (processor or NVIDIA card) is the computer's
|
|
21
|
+
// choice (`encoding.ts`); this is the project's, since it changes the file. The stored values
|
|
22
|
+
// are the explicit choices; no value at all is Automatic: AV1 on an NVIDIA card that can
|
|
23
|
+
// encode it, else H.264 exactly as before.
|
|
24
|
+
export const videoCodecs = ["h264", "hevc", "av1"];
|
|
25
|
+
export const videoCodecChoices = ["auto", ...videoCodecs];
|
|
20
26
|
export const legacyVideoEdit = {
|
|
21
27
|
cuts: "interval",
|
|
22
28
|
transition: "cut",
|
|
@@ -86,6 +92,16 @@ export const animateModeLabels = {
|
|
|
86
92
|
chapters: "Chapter openers",
|
|
87
93
|
every: "Every Nth image",
|
|
88
94
|
};
|
|
95
|
+
export const videoCodecLabels = {
|
|
96
|
+
auto: "Automatic (AV1 on the graphics card, else H.264)",
|
|
97
|
+
h264: "H.264",
|
|
98
|
+
hevc: "HEVC",
|
|
99
|
+
av1: "AV1",
|
|
100
|
+
};
|
|
101
|
+
export const videoCodecHelp = "Automatic uses AV1 on an NVIDIA card that can encode it, else H.264. H.264 works everywhere. HEVC and AV1 make about half to a third of the file for the same picture; AV1 on the processor needs an ffmpeg with SVT-AV1 and renders slower.";
|
|
102
|
+
export function videoCodecOf(config) {
|
|
103
|
+
return config.videoEdit?.codec ?? "auto";
|
|
104
|
+
}
|
|
89
105
|
// The settings a project renders with: its own, or today's behaviour when it has none.
|
|
90
106
|
export function videoEditOf(config) {
|
|
91
107
|
return config.videoEdit ?? legacyVideoEdit;
|
|
@@ -186,6 +202,7 @@ export function videoEditRows(edit) {
|
|
|
186
202
|
? animateModeLabels.off
|
|
187
203
|
: `${edit.animate === "every" ? `Every ${nth(edit.animateEvery)} image` : animateModeLabels.chapters}${edit.animateModel.trim() === "" ? "" : ` · ${edit.animateModel}`}`,
|
|
188
204
|
],
|
|
205
|
+
["Video codec", videoCodecLabels[edit.codec ?? "auto"]],
|
|
189
206
|
];
|
|
190
207
|
}
|
|
191
208
|
// Which images of the slideshow order (0-based) are animated: every Nth from the first, or
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { errorText } from "../../kernel/errors.js";
|
|
2
|
+
import { videoCodecLabels } from "./edit-settings.js";
|
|
3
|
+
import { codecArgs, noNvenc, noSvtAv1 } from "./encoding.js";
|
|
4
|
+
export const failedNvenc = "No working NVIDIA graphics card was found on this computer.";
|
|
5
|
+
const failedSvtAv1 = "No working ffmpeg with SVT-AV1 (libsvtav1) was found on this computer.";
|
|
6
|
+
// The renders' own settings on a tiny picture: a driver or card that refuses any of them fails
|
|
7
|
+
// here rather than in a render. NVENC refuses anything under about 145 pixels across.
|
|
8
|
+
function testArgs(encode) {
|
|
9
|
+
return [
|
|
10
|
+
"-hide_banner",
|
|
11
|
+
"-nostdin",
|
|
12
|
+
"-loglevel",
|
|
13
|
+
"error",
|
|
14
|
+
"-f",
|
|
15
|
+
"lavfi",
|
|
16
|
+
"-i",
|
|
17
|
+
"color=c=black:s=256x256:r=30:d=0.1",
|
|
18
|
+
"-frames:v",
|
|
19
|
+
"1",
|
|
20
|
+
...codecArgs(encode, "final", undefined),
|
|
21
|
+
"-f",
|
|
22
|
+
"null",
|
|
23
|
+
"-",
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
// The filters a render runs in the computer's ffmpeg besides the encoder.
|
|
27
|
+
const neededFilters = ["zoompan", "perspective", "fillborders", "xfade", "ass"];
|
|
28
|
+
// Which ffmpeg can encode on an NVIDIA card. The bundled ffmpeg first, then the computer's own:
|
|
29
|
+
// unlike everything else, NVENC is the computer's (its driver and its ffmpeg), and only used
|
|
30
|
+
// when chosen in Settings. Asked for HEVC or AV1, the card that passed for H.264 is tested again
|
|
31
|
+
// with that codec's encoder, since older cards have no AV1 and the oldest no HEVC.
|
|
32
|
+
export function createNvencProbe(deps) {
|
|
33
|
+
const answers = new Map();
|
|
34
|
+
const ask = (codec) => {
|
|
35
|
+
let answer = answers.get(codec);
|
|
36
|
+
if (answer === undefined) {
|
|
37
|
+
answer = (codec === "h264"
|
|
38
|
+
? probe(deps, {
|
|
39
|
+
label: "NVENC",
|
|
40
|
+
encoders: ["h264_nvenc"],
|
|
41
|
+
test: (bin) => testArgs({ kind: "nvenc", bin, clipSpeed: "thorough" }),
|
|
42
|
+
none: noNvenc,
|
|
43
|
+
failed: failedNvenc,
|
|
44
|
+
})
|
|
45
|
+
: ask("h264").then((card) => cardCodec(deps, card, codec))).catch((error) => ({
|
|
46
|
+
available: false,
|
|
47
|
+
reason: noNvenc,
|
|
48
|
+
detail: errorText(error),
|
|
49
|
+
}));
|
|
50
|
+
answers.set(codec, answer);
|
|
51
|
+
}
|
|
52
|
+
return answer;
|
|
53
|
+
};
|
|
54
|
+
return (codec = "h264") => ask(codec);
|
|
55
|
+
}
|
|
56
|
+
async function cardCodec(deps, card, codec) {
|
|
57
|
+
if (!card.available)
|
|
58
|
+
return card;
|
|
59
|
+
try {
|
|
60
|
+
await deps.exec(card.bin, testArgs({ kind: "nvenc", bin: card.bin, clipSpeed: "thorough", codec }));
|
|
61
|
+
return card;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const detail = `the ${codec}_nvenc test encode through ${card.bin} failed: ${errorText(error)}`;
|
|
65
|
+
deps.log.write("info", "video.encoder", { detail });
|
|
66
|
+
return {
|
|
67
|
+
available: false,
|
|
68
|
+
reason: `This NVIDIA graphics card can't encode ${videoCodecLabels[codec]}.`,
|
|
69
|
+
detail,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Which ffmpeg encodes AV1 on the processor with SVT-AV1. It also encodes the clips that are
|
|
74
|
+
// decoded again under captions, which stay H.264, so it needs x264 as well.
|
|
75
|
+
export function createSvtAv1Probe(deps) {
|
|
76
|
+
let answer;
|
|
77
|
+
return () => {
|
|
78
|
+
answer ??= probe(deps, {
|
|
79
|
+
label: "SVT-AV1",
|
|
80
|
+
encoders: ["libsvtav1", "libx264"],
|
|
81
|
+
test: (bin) => testArgs({ kind: "svtav1", bin, clipSpeed: "thorough" }),
|
|
82
|
+
none: noSvtAv1,
|
|
83
|
+
failed: failedSvtAv1,
|
|
84
|
+
}).catch((error) => ({
|
|
85
|
+
available: false,
|
|
86
|
+
reason: noSvtAv1,
|
|
87
|
+
detail: errorText(error),
|
|
88
|
+
}));
|
|
89
|
+
return answer;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async function probe(deps, want) {
|
|
93
|
+
const listed = (output, name) => new RegExp(`^\\s*V\\S*\\s+${name}\\s`, "m").test(output);
|
|
94
|
+
let failed;
|
|
95
|
+
for (const bin of new Set(deps.candidates)) {
|
|
96
|
+
const encoders = await deps.exec(bin, ["-hide_banner", "-encoders"]).catch(() => "");
|
|
97
|
+
if (!listed(encoders, want.encoders[0]))
|
|
98
|
+
continue;
|
|
99
|
+
const lacking = want.encoders.slice(1).filter((name) => !listed(encoders, name));
|
|
100
|
+
if (lacking.length > 0) {
|
|
101
|
+
failed = `the ffmpeg at ${bin} has ${want.label} but not the ${lacking.join(", ")} encoder a video needs`;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
const filters = await deps.exec(bin, ["-hide_banner", "-filters"]).catch(() => "");
|
|
105
|
+
const missing = neededFilters.filter((name) => !new RegExp(`^\\s*\\S+\\s+${name}\\s`, "m").test(filters));
|
|
106
|
+
if (missing.length > 0) {
|
|
107
|
+
failed = `the ffmpeg at ${bin} has ${want.label} but not the ${missing.join(", ")} filter a video needs`;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
await deps.exec(bin, want.test(bin));
|
|
112
|
+
deps.log.write("info", "video.encoder", { detail: `${want.label} works through ${bin}` });
|
|
113
|
+
return { available: true, bin };
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
failed = `the ffmpeg at ${bin} lists ${want.label} but its test encode failed: ${errorText(error)}`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (failed !== undefined) {
|
|
120
|
+
deps.log.write("info", "video.encoder", { detail: failed });
|
|
121
|
+
return { available: false, reason: want.failed, detail: failed };
|
|
122
|
+
}
|
|
123
|
+
return { available: false, reason: want.none };
|
|
124
|
+
}
|