Considering a gas of self-propelled particles with binary interactions, we derive the hydrodynamic equations governing the density and velocity fields from the microscopic dynamics, in the framework of the associated Boltzmann equation. Explicit expressions for the transport coefficients are given, as a function of the microscopic parameters of the model. We show that the homogeneous state with zero hydrodynamic velocity is unstable above a critical density (which depends on the microscopic parameters), signalling the onset of a collective motion. Comparison with numerical simulations on a standard model of self-propelled particles shows that the phase diagram we obtain is robust, in the sense that it depends only slightly on the precise definition of the model. While the homogeneous flow is found to be stable far from the transition line, it becomes unstable with respect to finite-wavelength perturbations close to the transition, implying a non-trivial spatio-temporal structure for the resulting flow. We find solitary wave solutions of the hydrodynamic equations, quite similar to the stripes reported in direct numerical simulations of self-propelled particles.