Skip to main content
Topic: How to configure ffmpeg to export spectrogram with information of the audio file (Read 431 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to configure ffmpeg to export spectrogram with information of the audio file

I created the spectrogram for the audio file in ffmpeg, but it's not display the informations as I wish.
My code in BAT file:
set MyFiles=*.flac *.wav *.aif
FOR %%A IN (%MyFiles%) DO ffmpeg -i "%%A" -y -lavfi showspectrumpic=s=1100x500:mode=separate "%%~nxA.png"


Is there a way to configure ffmpeg, display spectrogram like image below:
(Display Frequency 22 kHz; Title in spectrogram | bitrate kbps | samplerate Hz | bitspersample bit | Channels )
 

Can someone help please?

Thanks for any guidance.

Re: How to configure ffmpeg to export spectrogram with information of the audio file

Reply #1
Only sample rate and channels(layout) are available to filter, but you could use additional filter like drawtext to write all info.

Re: How to configure ffmpeg to export spectrogram with information of the audio file

Reply #2
Only sample rate and channels(layout) are available to filter, but you could use additional filter like drawtext to write all info.
Great! Thank you very much!

I have inserted the title in spectrogram:
-vf drawtext=text='%%A':x=(w-tw)/2:y=(h-th)/2:fontfile=OpenSans-Regular.ttf

But parameters as: bitrate kbps | samplerate Hz | bitspersample bit | Channels
I did not found them in "ffmpeg -h"
Could you please guide me as how to insert code?

Re: How to configure ffmpeg to export spectrogram with information of the audio file

Reply #3
You could extract them with ffprobe.


Re: How to configure ffmpeg to export spectrogram with information of the audio file

Reply #5
How to use this on the command line for just one file?
I just tried this:

ffmpeg -i infile.flac -lavfi showspectrumpic=s=1400x800:mode=separate outfile.png

Works, but does not cover the full frequency spectrum. Any ideas?

Re: How to configure ffmpeg to export spectrogram with information of the audio file

Reply #6
How to use this on the command line for just one file?
I just tried this:

ffmpeg -i infile.flac -lavfi showspectrumpic=s=1400x800:mode=separate outfile.png

Works, but does not cover the full frequency spectrum. Any ideas?

The height in your case must be power of 2.

Re: How to configure ffmpeg to export spectrogram with information of the audio file

Reply #7
That explains it, thanks. (Now using 1024 instead of 800)

 
SimplePortal 1.0.0 RC1 © 2008-2018