From 73a707f99db9c693f2ffd87ef59b7e6a5a5b39d4 Mon Sep 17 00:00:00 2001 From: Brooke Vibber Date: Sat, 31 Aug 2024 09:30:21 -0700 Subject: [PATCH] wip --- dither-image.js | 4 ++-- video-rickroll/combine.sh | 4 ++-- video-rickroll/extract.sh | 4 ++-- video-rickroll/video.sh | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dither-image.js b/dither-image.js index dd71da6..e6f4783 100644 --- a/dither-image.js +++ b/dither-image.js @@ -247,7 +247,7 @@ function colorize(input) { // Try dithering with this palette. for (let x = 0; x < width; x++) { let rgb = inputPixel(x, error); - let luma = Math.round(rgb.luma() / 15); + let luma = Math.round(rgb.luma() * 15 / 255); let pick = luma; let diff = rgb.difference(atariRGB[palette[pick]]); @@ -558,7 +558,7 @@ async function saveImage(width, height, lines, dest) { resolve(image); }); }); - await image.resize(Math.round(width2 * 4 / 1.2), height * 2); + await image.resize(Math.round(width2 * 4), height * 2); await image.writeAsync(dest); } diff --git a/video-rickroll/combine.sh b/video-rickroll/combine.sh index 3c833f3..29d177c 100644 --- a/video-rickroll/combine.sh +++ b/video-rickroll/combine.sh @@ -1,10 +1,10 @@ ffmpeg \ -r 60000/1001 \ - -i 'frames/dither-%04d.png' \ + -i 'frames/dither-%05d.png' \ -i 'rickroll-audio.wav' \ -ac 2 \ -ar 48000 \ - -vf 'pad=w=534,setsar=9/10' \ + -vf 'scale=534x384,setsar=1' \ -pix_fmt yuv420p \ -movflags +faststart \ -y rickroll-dither.mp4 diff --git a/video-rickroll/extract.sh b/video-rickroll/extract.sh index ed545ec..59ce590 100644 --- a/video-rickroll/extract.sh +++ b/video-rickroll/extract.sh @@ -4,9 +4,9 @@ mkdir -p frames ffmpeg \ -i rickroll.mp4 \ - -vf 'scale=320:192,framerate=60000/1001' \ + -vf 'scale=320:230,framerate=60000/1001' \ -an \ - -y 'frames/rickroll-%04d.png' + -y 'frames/rickroll-%05d.png' ffmpeg \ -i rickroll.mp4 \ diff --git a/video-rickroll/video.sh b/video-rickroll/video.sh index 4553490..b3158bf 100644 --- a/video-rickroll/video.sh +++ b/video-rickroll/video.sh @@ -1,6 +1,6 @@ set -e -for frame in frames/rickroll-[0-9][0-9][0-9][0-9].png +for frame in frames/rickroll-[0-9][0-9][0-9][0-9][0-9].png do n="${frame#frames/rickroll-}" n="${n%.png}"