MCPcopy Create free account
hub / github.com/TomClive/SeeDance2Stitcher / toneFilter

Function toneFilter

server.js:138–149  ·  view source on GitHub ↗
(tone, frames, fps, scope = "join")

Source from the content-addressed store, hash-verified

136}
137
138function toneFilter(tone, frames, fps, scope = "join") {
139 if (!tone || frames <= 0) return "";
140 const brightness = Math.max(-0.18, Math.min(0.18, Number(tone.brightnessDelta) || 0));
141 const contrast = Math.max(0.8, Math.min(1.25, Number(tone.contrastRatio) || 1));
142 if (Math.abs(brightness) < 0.003 && Math.abs(contrast - 1) < 0.01) return "";
143 if (scope === "full") {
144 return `eq=brightness=${brightness.toFixed(6)}:contrast=${contrast.toFixed(6)},`;
145 }
146 const duration = Math.max(1 / fps, frames / fps);
147 const fade = `max(0\\,1-t/${duration.toFixed(6)})`;
148 return `eq=brightness='${brightness.toFixed(6)}*${fade}':contrast='1+${(contrast - 1).toFixed(6)}*${fade}':eval=frame,`;
149}
150
151function fitFilter() {
152 return "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2,setsar=1";

Callers 2

handleExportFunction · 0.85
handleExportCollageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected