Posted: . At: 11:14 AM. This was 2 years ago. Post ID: 15870
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to make a spectrogram with FFmpeg on Linux. This is very cool.


Making a spectrogram with FFmpeg on Linux is very easy.

The FFmpeg utility is the best way to accomplish this task.

Das Efx - Rap Scholar spectrogram.
Das Efx – Rap Scholar spectrogram.

This simple command will render a spectrogram of the audio file. This can be very interesting if the music file contains hidden information in the audio.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music/Rap]
└─$ ffmpeg -i das\ efx\ -\ rap\ scholar.mp3 -lavfi showspectrumpic=s=1920x1080:mode=separate:fscale=lin:scale=log spect_lin.png

Another example here. This will create a video with a scrolling spectrogram of an audio file. This is also very nice to use.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music/Rap]
└─$ ffmpeg -i Wuthering-heights.mp3 -filter_complex "[0:a]showspectrum=mode=combined:color=intensity:scale=log:s=1280x720,pad=1280:720[ss]; [ss]drawtext=fontfile=CircularSpAraTTBlack.ttf:fontcolor=white:x=10:y=10:text=$text[out]" -map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy me.mkv

A good way to upload your music on Youtube, have the cool spectrogram as the video. Would be very nice indeed.

To get information about an audio file, use the ffprobe utility, this is very useful.

┌──(john㉿DESKTOP-PF01IEE)-[/mnt/c/Users/Intel i5/Music]
└─$ ffprobe -hide_banner -i Dark\ Ambience\ -\ Horror\ Background\ Music\ 10\ Hours\ \[Z6ylGHfLrdI\].mp3 
Input #0, mp3, from 'Dark Ambience - Horror Background Music 10 Hours [Z6ylGHfLrdI].mp3':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.76.100
  Duration: 10:00:00.10, start: 0.025056, bitrate: 95 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 95 kb/s
    Metadata:
      encoder         : Lavc58.13
  Stream #0:1: Video: png, rgb24(pc), 1280x720, 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      title           : "Album cover"
      comment         : Other

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.