Here’s a puzzle for you.
To produce a scrolling spectrogram, from an audio file, using an FFMPEG script.
I did find a random script, deep within the depths of google, however what I’d like, is for the scrolling spectrogram to start in the “middle” of the video window, rather than at the right hand side.
Now it is possible to achieve this, using the likes of Sonic Visualizer, and then run OBS to do a screen capture of the application playing back the audio & spectrogram. However a script would make it a lot easier, and no issues with screen tearing / lack of sync due to screen recording…
Link to video created using this script…
# This is a simplified script of https://gist.github.com/keunwoochoi/f0ea2c49355fc21e93dad88d210efcdd
# Usage: 1. Modify the font path in the line with [ss].
# In my case, I copied and pasted CircularSpAraTTBlack.ttf to the same folder.
# 2. Put the wav file in the same folder, say, audio_file.wav
# 3. run $./spectrogram_scrolling_video.sh audio_file.wav
# 4. You'll see audio_file.mkv in the same folder!
#
text=$(basename $1 .wav)
ffmpeg -i $1 -filter_complex \
"[0:a]showspectrum=mode=combined:color=green:slide=1:legend=yes:scale=lin:overlap=0.95:start=0:stop=10000:rotation=0.5:fps=30:s=1280x720[ss]; \
[ss]drawtext=fontfile=CircularSpAraTTBlack.ttf:fontsize=16:fontcolor=white:x=640:y=10:text=$text[out]" \
-map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy $text.mkv