OK, I did it. Took quite a bit of trial and error, and you may want to tweak things further. Especially “scale=lin” in the first script. You might like “scale=log” better. Refer to the ffmpeg filters documentation to see what’s possible.
https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic
AKWF_spectrographs.zip (253.0 KB)
I wrote this little shell script (there’s probably a more clever unix-y way to do this, but I was feeling lazy).
for i in ~/Music/AKWF/AKWF_stereo/*.wav;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -lavfi showspectrumpic=s=1980x1040:orientation=horizontal:color=fiery:legend=disabled:scale=lin:mode=separate "${name}.jpg";
done
Then I had to scale it down (for some reason the spectrographs looked totally wacked if created at the smaller size to begin with).
for i in ~/Music/AKWF/AKWF_stereo/*.jpg;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -vf scale=w=iw/10:h=ih/10 "${name}-resized.jpg";
done
Flip it vertically (it was upside down, to my eyes)
for i in ~/Music/AKWF/AKWF_stereo/*-resized.jpg;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -vf vflip "${name}-flipped.jpg";
done
Make it grayscale (there is no gray color palette for the spectrographs for some reason)
for i in ~/Music/AKWF/AKWF_stereo/*-flipped.jpg;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -vf format=gray,format=yuv422p "${name}-desat.jpg";
done
Invert the colors (so it is black on white instead of white on black)
for i in ~/Music/AKWF/AKWF_stereo/*-desat.jpg;
do name=`echo $i | cut -d'.' -f1`;
echo $name;
ffmpeg -i "$i" -vf lutrgb="r=negval:g=negval:b=negval" "${name}-invert.jpg";
done