Context : The Baade-Wesselink ( BW ) method , which combines linear and angular diameter variations , is the most common method to determine the distances to pulsating stars . However , the projection factor , p -factor , used to convert radial velocities into pulsation velocities , is still poorly calibrated . This parameter is critical on the use of this technique , and often leads to 5-10 % uncertainties on the derived distances . Aims : We focus on empirically measuring the p -factor of a homogeneous sample of 29 LMC and 10 SMC Cepheids for which an accurate average distances were estimated from eclipsing binary systems . Methods : We used the SPIPS algorithm , which is an implementation of the BW technique . Unlike other conventional methods , SPIPS combines all observables , i.e . radial velocities , multi-band photometry and interferometry into a consistent physical modelling to estimate the parameters of the stars . The large number and their redundancy insure its robustness and improves the statistical precision . Results : We successfully estimated the p -factor of several Magellanic Cloud Cepheids . Combined with our previous Galactic results , we find the following P - p relation : -0.08 _ { \pm 0.04 } ( \log P - 1.18 ) +1.24 _ { \pm 0.02 } . We find no evidence of a metallicity dependent p -factor . We also derive a new calibration of the period-radius relation , \log R = 0.684 _ { \pm 0.007 } ( \log P - 0.517 ) +1.489 _ { \pm 0.002 } , with an intrinsic dispersion of 0.020 . We detect an infrared excess for all stars at 3.6 \mu m and 4.5 \mu m , which might be the signature of circumstellar dust . We measure a mean offset of \Delta m _ { 3.6 } = 0.057 \pm 0.006 mag and \Delta m _ { 4.5 } = 0.065 \pm 0.008 mag . Conclusions : We provide a new P - p relation based on a multi-wavelength fit that can be used for the distance scale calibration from the BW method . The dispersion is due to the LMC and SMC width we took into account because individual Cepheids distances are unknown . The new P - R relation has a small intrinsic dispersion : 4.5 % in radius . This precision will allow us to accurately apply the BW method to nearby galaxies . Finally , the infrared excesses we detect again raise the issue of using mid-IR wavelengths to derive period-luminosity relation and to calibrate the Hubble constant . These IR excesses might be the signature of circumstellar dust , and are never taken into account when applying the BW method at those wavelengths . Our measured offsets may give an average bias of \sim 2.8 % on the distances derived through mid-IR P - L relations .