Star Hype News.

Premium celebrity moments with standout appeal.

general

How can I show a timecode while playing audio in FFPlay?

By Matthew Cannon

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?

1 Answer

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.
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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