'showspectrumpic' filter: scaling of the frequency axis and fft windows size
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
On 9/13/19, Wolfgang Hugemann <auto@hugemann.de> wrote:
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.
Because used fft accepts only power of 2 sizes. There is code already for more advanced fft but it is not optimized, and thus not yet used.
Kind regards Wolfgang Hugemann _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
Because used fft accepts only power of 2 sizes.
Well, this is clear to me - but what size do you use? My use of the term 'window' may be unclear in this context: I meant the window size for the fft, i.e. how many samples are used in one fft run? I take from your code that the window size is two times the output windows width (? ... rounded to ...?). ... I already tried scaling the frequency axis with 2^n, i.e. 4096 Hz or 8192 Hz, by that did not help. I think there is something basically wrong with the scaling of the frequency axis if you use log. Furthermore, the value that you supply for parameter 'stop' seems to be divided by roughly 2 (?).
There is code already for more advanced fft but it is not optimized, and thus not yet used.
To my knowledge, all such calculations use fft, i.e. 2^n window sizes, mostly with about 50% overlap (as you also do for most windows in your code). Wolfgang Hugemann
Hello, 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, inlink->sample_rate); 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
participants (2)
-
Paul B Mahol -
Wolfgang Hugemann