In this work, we aim at modelling crowd motion in emergency situations. We propose a macroscopic model (where people are represented as a density) following two basic principles. First, each individual has a spontaneous velocity (typically, the one which leads to the nearest exit) which would be fulfilled in the absence of other people. On the other hand, the crowd has to respect a congestion constraint, and its density must remain underneath a critical density. This constraint prevents people from following their desired velocity. The actual velocity we consider is the closest, in a mean square sense, to the desired one, among the velocities which respect the maximal density constraint.The mathematical formulation writes as a transport equation which cannot be studied with classical methods, since the real velocity field has no a priori regularity, even if the desired velocity is smooth. Thanks to the optimal transport theory, we prove an existence result, first in the case where the desired velocity is the gradient of a given function, and then in the general framework. We also propose a numerical scheme which follows the catching-up principle: at each time step, we move the density according to the spontaneous velocity, and then project it onto the space of admissible densities. The numerical results we obtain reproduce qualitatively the experimental observations