Live audio visualization using ffmpeg
ffmpeg can turn audio files into videos with nice
visualizations, for instance displaying a scrolling spectrogram using
the showspectrum
filter.
It turns out you can also use it to do visualization of live audio
signal onto the screen. On Linux I used the -f jack
input option to
route live audio from any jack application into ffmpeg, and the -f sdl
output option to display the result as a window on the screen.
Assuming you have jack server running, you can do:
ffmpeg -f jack -i ffmpeg \
-filter_complex "[0:a]showspectrum=s=1980x500:mode=combined:slide=scroll:fps=30:scale=sqrt:gain=5,format=yuv420p[v]" \
-map "[v]" -f sdl "ffmpeg visualization"
Then connect the desired audio signal to the ffmpeg
jack ports and
enjoy. For more elaborate examples of ffmpeg visualizations see Luka Prinčič’s post.