[FFmpeg-user] 'showspectrumpic' filter: scaling of the frequency axis and fft windows size

Wolfgang Hugemann auto at hugemann.de
Tue Sep 29 21:11:46 EEST 2020


today, I stepped across a bug I reported last year, September 13th,
which still seems to exist in the current version of ffmpeg:

Obviously, the frequency scaling of the attached spectrum is not
logarithmic, i.e. the frequency ratio of the labels is not constant:

655.47 / 641.80 = 1.02130
313,67 / 300.00 = 1.04557

I downloaded the source code at Github, and the bug seems to be located
in avf_showspectrum.c, somewhere in the lines 748 - 751:

for (y = 0; y < h; y += 40) {
  float range = s->stop ? s->stop - s->start : inlink->sample_rate / 2;
  float bin = s->fscale == F_LINEAR ? y : get_log_hz(y, h,
  float hertz = s->start + bin * range / (float)(1 << (int)ceil(log2(h)));

Deplorably, I am not able to fix the code on my own and I see no
possibilty to report the issue on Github.

Can somebody help me with this issue? How does bus reporting work in the
ffmpeg project?

Grretings from M√ľnster, Germany
Wolfgang Hugemann

Am 13.09.2019 um 15:35 schrieb Wolfgang Hugemann:
> Today, I have been experimenting with the 'showspectrum' filter, mostly
> with 'showspectrumpic'.
> I think there is a bug in the log scaling of the frequency axis if (and
> only if) it doesn't start at zero: The ratios of the frequency axis'
> labelings is not constant, they grow with larger values.
> I had a quick look at the source code and gained the impression that the
> fft windows size is based on the height of video created (?). At least
> it cannot by specified in the filter options.
> Kind regards
> Wolfgang Hugemann

-------------- next part --------------
A non-text attachment was scrubbed...
Name: log_300-1000.jpg
Type: image/jpeg
Size: 248426 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200929/3ea2cd3c/attachment.jpg>

More information about the ffmpeg-user mailing list