FFmpeg 2.7.7
Since* 2.3
#

Convert input audio to a video output representing frequency spectrum logarithmically (using constant Q transform with Brown-Puckette algorithm), with musical tone scale, from E0 to D#10 (10 octaves).

The filter accepts the following options:

volume

Specify transform volume (multiplier) expression. The expression can contain variables:

frequency, freq, f

the frequency where transform is evaluated

timeclamp, tc

value of timeclamp option

and functions:

a_weighting(f)

A-weighting of equal loudness

b_weighting(f)

B-weighting of equal loudness

c_weighting(f)

C-weighting of equal loudness

Default value is 16.

tlength

Specify transform length expression. The expression can contain variables:

frequency, freq, f

the frequency where transform is evaluated

timeclamp, tc

value of timeclamp option

Default value is 384/f*tc/(384/f+tc).

timeclamp

Specify the transform timeclamp. At low frequency, there is trade-off between accuracy in time domain and frequency domain. If timeclamp is lower, event in time domain is represented more accurately (such as fast bass drum), otherwise event in frequency domain is represented more accurately (such as bass guitar). Acceptable value is [0.1, 1.0]. Default value is 0.17.

coeffclamp

Specify the transform coeffclamp. If coeffclamp is lower, transform is more accurate, otherwise transform is faster. Acceptable value is [0.1, 10.0]. Default value is 1.0.

gamma

Specify gamma. Lower gamma makes the spectrum more contrast, higher gamma makes the spectrum having more range. Acceptable value is [1.0, 7.0]. Default value is 3.0.

gamma2

Specify gamma of bargraph. Acceptable value is [1.0, 7.0]. Default value is 1.0.

fontfile

Specify font file for use with freetype. If not specified, use embedded font.

fontcolor

Specify font color expression. This is arithmetic expression that should return integer value 0xRRGGBB. The expression can contain variables:

frequency, freq, f

the frequency where transform is evaluated

timeclamp, tc

value of timeclamp option

and functions:

midi(f)

midi number of frequency f, some midi numbers: E0(16), C1(24), C2(36), A4(69)

r(x), g(x), b(x)

red, green, and blue value of intensity x

Default value is st(0, (midi(f)-59.5)/12); st(1, if(between(ld(0),0,1), 0.5-0.5*cos(2*PI*ld(0)), 0)); r(1-ld(1)) + b(ld(1))

fullhd

If set to 1 (the default), the video size is 1920x1080 (full HD), if set to 0, the video size is 960x540. Use this option to make CPU usage lower.

fps

Specify video fps. Default value is 25.

count

Specify number of transform per frame, so there are fps*count transforms per second. Note that audio data rate must be divisible by fps*count. Default value is 6.

#

Examples

  • Playing audio while showing the spectrum:

    ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt [out0]'
  • Same as above, but with frame rate 30 fps:

    ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fps=30:count=5 [out0]'
  • Playing at 960x540 and lower CPU usage:

    ffplay -f lavfi 'amovie=a.mp3, asplit [a][out1]; [a] showcqt=fullhd=0:count=3 [out0]'
  • A1 and its harmonics: A1, A2, (near)E3, A3:

    ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
                     asplit[a][out1]; [a] showcqt [out0]'
  • Same as above, but with more accuracy in frequency domain (and slower):

    ffplay -f lavfi 'aevalsrc=0.1*sin(2*PI*55*t)+0.1*sin(4*PI*55*t)+0.1*sin(6*PI*55*t)+0.1*sin(8*PI*55*t),
                     asplit[a][out1]; [a] showcqt=timeclamp=0.5 [out0]'
  • B-weighting of equal loudness

    volume=16*b_weighting(f)
  • Lower Q factor

    tlength=100/f*tc/(100/f+tc)
  • Custom fontcolor, C-note is colored green, others are colored blue

    fontcolor='if(mod(floor(midi(f)+0.5),12), 0x0000FF, g(1))'
  • Custom gamma, now spectrum is linear to the amplitude.

    gamma=2:gamma2=2