Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#8919 closed defect (fixed)

Setting 'fscale=log' together w/ 'start>0' will mess up the scaling of the y-axis in showspectrum(pic)

Reported by: RKleinert Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: showspectrum, showspectrumpic
Cc: r.kleinert@unfallforensik.de Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

In the 'showspectrum' and 'showspectrumpic'-functions you can choose to scale the y-axis (frequencies) either linear or logarithmic (parameter 'fscale'). Also you can define the range of the y-axis (parameters 'start' and 'stop'). If you choose logarithmic scaling and start at y=0Hz ('start=0') the y-axis is scaled correctly; i.e. the proportions from one mark on the axis to the next in equal distances stays constant. If you however choose anything else than 'start=0' the scaling is entirely wrong. The ratio between the individual, equidistant marks on the y-axis will start somewhere above 2 at the higher values and decrease to 1 further down at the bottom of the axis.

TL;DR:

Setting parameter 'fscale=log' together with 'start>0'will mess up the scaling of the y-axis in showspectrum(pic)

How to reproduce:

The exact way of calling the function doesn't seem to matter. It's just about the situation explained above. I used this example to verify:

Sample Code:

ffmpeg -i input.wav -filter_complex "showspectrumpic=size=700x400:mode=combined:color=rainbow:scale=sqrt:fscale=log:legend=1:start=500:stop=20000" output.png

Attachments (3)

input.wav (864.1 KB ) - added by RKleinert 4 years ago.
Testfile I used to create the attached output-file
output.png (62.1 KB ) - added by RKleinert 4 years ago.
Result with the attached testfile and the code-example provided in the description
1khz_spectrumpic_1024x768.png (148.0 KB ) - added by RKleinert 3 years ago.
output with start=500 and stop =20000, y-axis scaling still not fixed

Download all attachments as: .zip

Change History (9)

by RKleinert, 4 years ago

Attachment: input.wav added

Testfile I used to create the attached output-file

by RKleinert, 4 years ago

Attachment: output.png added

Result with the attached testfile and the code-example provided in the description

comment:1 by Elon Musk, 3 years ago

Resolution: fixed
Status: newclosed

comment:2 by RKleinert, 3 years ago

Resolution: fixed
Status: closedreopened

We've just revied the function in the current version of ffmpeg (2021-10-18-git-d04c005021-full) and I have to report that the issue is still nox fixed.

Choosing frequencies from 500 to 20000 Hz in my example the ration between two steps on the y-axis starts at around 1.4 at max. values and steadyly decreases to round about 1 at the bottom of the axis.

by RKleinert, 3 years ago

output with start=500 and stop =20000, y-axis scaling still not fixed

comment:3 by Elon Musk, 3 years ago

Resolution: fixed
Status: reopenedclosed

You are not using log scale.

comment:4 by Elon Musk, 3 years ago

Probably using sqrt one. Ah I see what you want...

comment:5 by Elon Musk, 3 years ago

The frequency log scale axis matches the spectrum output.
What you want would make high spectrum content not displayed at all.

Imagining you want: 0.1 1 10 100 1000 scale.

in reply to:  5 comment:6 by RKleinert, 3 years ago

Replying to Elon Musk:

The frequency log scale axis matches the spectrum output.
What you want would make high spectrum content not displayed at all.

Imagining you want: 0.1 1 10 100 1000 scale.

Yes, that is what I would understand as a log-scaled y-axis.

Note: See TracTickets for help on using tickets.