fix: delegate multi-line digit selection to visible overlay (#78)

This commit is contained in:
2026-05-24 00:39:23 -07:00
committed by GitHub
parent c02edc90cc
commit da3c971ee6
62 changed files with 1822 additions and 209 deletions
+11 -7
View File
@@ -158,11 +158,12 @@ export class MediaGenerator {
videoPath: string,
startTime: number,
endTime: number,
padding: number = 0.5,
padding: number = 0,
audioStreamIndex: number | null = null,
): Promise<Buffer> {
const start = Math.max(0, startTime - padding);
const duration = endTime - startTime + 2 * padding;
const safePadding = Number.isFinite(padding) ? Math.max(0, padding) : 0;
const start = Math.max(0, startTime - safePadding);
const duration = endTime - start + safePadding;
return new Promise((resolve, reject) => {
const outputPath = path.join(this.tempDir, `audio_${Date.now()}.mp3`);
@@ -310,7 +311,7 @@ export class MediaGenerator {
videoPath: string,
startTime: number,
endTime: number,
padding: number = 0.5,
padding: number = 0,
options: {
fps?: number;
maxWidth?: number;
@@ -319,9 +320,12 @@ export class MediaGenerator {
leadingStillDuration?: number;
} = {},
): Promise<Buffer> {
const start = Math.max(0, startTime - padding);
const duration = endTime - startTime + 2 * padding;
const { fps = 10, maxWidth = 640, maxHeight, crf = 35, leadingStillDuration = 0 } = options;
const safePadding = Number.isFinite(padding) ? Math.max(0, padding) : 0;
const start = Math.max(0, startTime);
const duration = endTime - startTime + safePadding;
const effectiveLeadingPadding = Math.min(safePadding, start);
const totalLeadingStillDuration = Math.max(0, leadingStillDuration) + effectiveLeadingPadding;
const clampedCrf = Math.max(0, Math.min(63, crf));
@@ -359,7 +363,7 @@ export class MediaGenerator {
fps,
maxWidth,
maxHeight,
leadingStillDuration,
leadingStillDuration: totalLeadingStillDuration,
}),
...encoderArgs,
'-y',