The geometry of the inner accretion flow of X-ray binaries is complex, with multiple regions contributing to the observed emission. Frequency-resolved spectroscopy is a powerful tool in breaking this spectral degeneracy. We have extracted the spectra of the strong low-frequency quasi-periodic oscillation (QPO) and its harmonic in GX339-4 and XTE J1550-564, and compare these to the time-averaged spectrum and the spectrum of the rapid (< 0.1s) variability. Our results support the picture where the QPO arises from vertical (Lense-Thirring) precession of an inhomogeneous hot flow, softer at larger radii closer to the truncated disc and harder in the innermost parts where the rapid variability is produced. This coupling between variability and spectra allows us to constrain the soft Comptonization component, breaking the degeneracy plaguing the time-averaged spectrum and revealing the geometry of the accretion flow close to the black hole.