Last active
December 19, 2017 22:40
-
-
Save porglezomp/2308b53dd25f9a07c07ac3dd34a20bbe to your computer and use it in GitHub Desktop.
All Star but it's been transcoded through a 0% quality JPEG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -ex | |
ffmpeg -y -i "$1" -f u8 -ac 1 all-star.pcm | |
size=`wc -c all-star.pcm | tr -s ' ' | cut -d' ' -f2` | |
size=`python3 -c "M = $size//3; N=int(M**0.5); print(f'{N}x{M//N}')"` | |
convert -size "$size" -depth 8 rgb:all-star.pcm -quality 0% "$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -ex | |
convert "$1" rgb:all-star.raw | |
ffmpeg -y -f u8 -i all-star.raw -ar 48000 "$2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
input=$1 | |
shift; if [ $1 = "but" ]; then shift; fi | |
name=`echo $input | rev | cut -d. -f 2- | rev` | |
pcm=`mktemp`.pcm | |
raw=`mktemp`.raw | |
hash=`echo $@ | md5 | cut -c-8` | |
qf="-hide_banner -loglevel panic -y" | |
set -x | |
ffmpeg $qf -i "$input" -f u8 -ac 1 $pcm | |
size=`wc -c $pcm | tr -s ' ' | cut -d' ' -f2` | |
size=`python3 -c "M = $size//3; N=int(M**0.5); print(f'{N}x{M//N}')"` | |
convert -size "$size" -depth 8 rgb:$pcm $@ "$name.jpg" | |
convert "$name.jpg" rgb:$raw | |
ffmpeg $qf -f u8 -i $raw -ar 48000 "$name-but-$hash.mp3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: all-star-fuzz.mp3 | |
all-star.opus: | |
youtube-dl -x 'https://www.youtube.com/watch?v=L_jWHffIx5E' -o all-star.opus | |
all-star.mp3: all-star.opus | |
ffmpeg -i $< -ss 36.7 -ac 1 $@ | |
all-star.jpg: all-star.mp3 | |
./audio2jpeg.sh $< $@ | |
all-star-fuzz.mp3: all-star.jpg | |
./img2audio.sh $< $@ | |
clean: | |
rm -rf all-star.mp3 all-star.jpg all-star-fuzz.mp3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment