From a4196851217ead3f94e0c1ef00142a51b2ebbf3d Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Sat, 25 Mar 2023 21:36:14 -0700 Subject: [PATCH] nice --- video-bulk/atarifiy.sh | 62 ++++++++++++++++++++++++++++++++++++++++++ video-cat/extract.sh | 2 +- video-doom/extract.sh | 2 +- video/extract.sh | 2 +- 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 video-bulk/atarifiy.sh diff --git a/video-bulk/atarifiy.sh b/video-bulk/atarifiy.sh new file mode 100644 index 0000000..95b8300 --- /dev/null +++ b/video-bulk/atarifiy.sh @@ -0,0 +1,62 @@ +set -e + +INFILE="$1" +# additional params can be input to the extraction +# for time or seek +shift + +mkdir -p temp + +ffmpeg \ + -i "$INFILE" \ + -r 60000/1001 \ + -vf 'scale=256:-2' \ + -an \ + "$@" \ + -y "temp/$INFILE-%04d.png" + +ffmpeg \ + -i "$INFILE" \ + -vn \ + -ac 1 \ + -ar 15734 \ + -acodec pcm_u8 \ + "$@" \ + -y "temp/$INFILE-audio.wav" || echo no audio + +for frame in "temp/$INFILE-"[0-9][0-9][0-9][0-9].png +do + n="${frame#temp/$INFILE-}" + n="${n%.png}" + out="temp/$INFILE-dither-${n}" + last="${n:0-1}" + node ../dither-image.js "$frame" "$out" & + if (( last == 9 )) + then + echo "frame $n" + wait + fi +done +wait + +if [ -f "temp/$INFILE-audio.wav" ] +then + ffmpeg \ + -r 60000/1001 \ + -i "temp/$INFILE-dither-%04d.png" \ + -i "temp/$INFILE-audio.wav" \ + -ac 2 \ + -ar 48000 \ + -vf 'pad=w=534' \ + -pix_fmt yuv420p \ + -movflags +faststart \ + -y "$INFILE-dither.mp4" +else + ffmpeg \ + -r 60000/1001 \ + -i "temp/$INFILE-dither-%04d.png" \ + -vf 'pad=w=534' \ + -pix_fmt yuv420p \ + -movflags +faststart \ + -y "$INFILE-dither.mp4" +fi diff --git a/video-cat/extract.sh b/video-cat/extract.sh index 8675eb7..b4faa3c 100644 --- a/video-cat/extract.sh +++ b/video-cat/extract.sh @@ -4,7 +4,7 @@ mkdir -p frames ffmpeg \ -i 'cats computer fun.mp4' \ - -vf 'scale=320:150,pad=h=192:y=5' \ + -vf 'scale=256:144' \ -an \ -y 'frames/cats-%04d.png' diff --git a/video-doom/extract.sh b/video-doom/extract.sh index a92ff17..87d2972 100644 --- a/video-doom/extract.sh +++ b/video-doom/extract.sh @@ -8,7 +8,7 @@ ffmpeg \ -i 'doom-speedrun.webm' \ -t $TIME \ -r 60000/1001 \ - -vf 'scale=320:192' \ + -vf 'scale=256:192' \ -an \ -y 'frames/doom-%04d.png' diff --git a/video/extract.sh b/video/extract.sh index 4f8070a..237613c 100644 --- a/video/extract.sh +++ b/video/extract.sh @@ -4,7 +4,7 @@ mkdir -p frames ffmpeg \ -i colamath-dv.avi \ - -vf 'yadif=1,scale=320:200,crop=h=192:y=4' \ + -vf 'yadif=1,scale=256:192' \ -an \ -y 'frames/colamath-%04d.png'