Files
songs2vid/lib/ffmpeg/brand-watermark.ts
T
Atakan Doğan Özban 2f25435921 Make layout blur, opacity, and watermark position apply in rendered videos.
Still-image encodes ignored boxblur and 1s black fills; switch to gblur plus full-length black frames, and honor brand watermark position.
2026-08-17 12:47:19 +02:00

26 lines
859 B
TypeScript

/**
* Modular FFmpeg filter fragments for the Songs2VID brand watermark overlay.
* Honors corner/center position + padding; scales to a fraction of frame width.
*/
import { overlayXy, type WatermarkPosition } from "../watermark";
export function buildBrandWatermarkOverlayFilters(options: {
baseLabel: string;
watermarkInputIndex: number;
watermarkWidthPx: number;
position?: WatermarkPosition;
offsetX?: number;
offsetY?: number;
outLabel?: string;
}): string[] {
const ox = options.offsetX ?? 20;
const oy = options.offsetY ?? 20;
const position = options.position ?? "bottom-right";
const { x, y } = overlayXy(position, ox, oy);
const out = options.outLabel ?? "vout";
return [
`[${options.watermarkInputIndex}:v]scale=${options.watermarkWidthPx}:-1[wm]`,
`[${options.baseLabel}][wm]overlay=${x}:${y}[${out}]`,
];
}