(tone, frames, fps, scope = "join")
| 136 | } |
| 137 | |
| 138 | function 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 | |
| 151 | function fitFilter() { |
| 152 | return "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2,setsar=1"; |
no outgoing calls
no test coverage detected