Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output raw frequency (fft) data using ffmpeg / libavfilter

I'm trying to write libavfilter bindings to convert an arbitrary audio file into a raw frequency (spectrum) data to do subsequent audio analysis. Is there anything built-in ffmpeg or libavfilter to output binary frequency data, rather than a proper audio/video file?

FFmpeg has a few built-in filters that perform an FFT such as afftfilt and showfreqs, however these filters always convert output back to video or audio. What I need is something like the afftfilt filter, but which dumps the raw FFT data, rather than recode it back to PCM.

like image 945
Jeroen Ooms Avatar asked Jan 03 '20 13:01

Jeroen Ooms


1 Answers

Depending on how accurate you need the FFT to be, and whether you need the imaginary part, you could macgyver something out of the showspectrum filter output - have it output to raw bitmaps and treat these as byte arrays.

like image 65
Sinus the Tentacular Avatar answered Sep 23 '22 08:09

Sinus the Tentacular