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.
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=Monoallows you to set the font family, but this requires yourffmpegto be compiled with--enable-libfribidi. Otherwise, use thefontfileoption and provide the full path to the font file.