I'm wanting to play strictly audio files with FFplay. Already when opening files it displays a window with a rolling spectogram.

I'd like to have the same spectogram with an overlay of a timecode in hh:mm:ss.

There is nothing on the man page whatsoever of this.

How can I achieve this?


This can be done with the showspectrum and drawtext filters.

enter image description here

ffplay -f lavfi "amovie=input.mp3,asplit[a][out1];[a]showspectrum=mode=separate:color=intensity:slide=1,drawtext=text='%{pts\:hms}':box=1:boxborderw=5:x=(w-text_w)/2:y=h-(text_h*2):fontsize=16:font=Mono[out0]"
  • Seeking during playback will not be possible.
  • Use a mono font, otherwise the width of the numbers will vary causing movement. The use of the option font=Mono allows you to set the font family, but this requires your ffmpeg to be compiled with --enable-libfribidi. Otherwise, use the fontfile option and provide the full path to the font file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.