pallete gen ffmpeg

This commit is contained in:
legop3
2026-01-03 21:01:21 -05:00
parent e0cadb493f
commit 4e30eb1d52
+17 -1
View File
@@ -272,6 +272,7 @@ async function buildReplayGif() {
await fsp.writeFile(path.join(tmpDir, filename), frames[i].buffer);
}
const outPath = path.join(tmpDir, 'replay.gif');
const palettePath = path.join(tmpDir, 'palette.png');
const delayMs = getRoomCameraReplayDelayMs();
const fps = (1000 / delayMs).toFixed(3);
await execFileAsync('ffmpeg', [
@@ -284,7 +285,22 @@ async function buildReplayGif() {
'-i',
'frame-%04d.jpg',
'-vf',
'scale=640:-1:flags=lanczos',
'palettegen',
palettePath,
], { cwd: tmpDir });
await execFileAsync('ffmpeg', [
'-y',
'-hide_banner',
'-loglevel',
'error',
'-framerate',
fps,
'-i',
'frame-%04d.jpg',
'-i',
'palette.png',
'-lavfi',
'paletteuse=dither=bayer:bayer_scale=5',
'-loop',
'0',
outPath,