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