We apply a method to automatically estimate the background velocities using reverse-time migration. The method uses a combination of differential semblance and similarityindex (a.k.a., “semblance” or “stacking-power”) to measure the focusing error in imaging and a nonlinear optimization procedure to obtain the background velocities. A challenge in this procedure is that, for media consisting of complex and strongly refracting velocities, artifacts in the reversetime migrated image (low-frequency noise) can cause the velocity analysis to diverge. We successfully overcome this issue by applying a simple vertical derivative filter to the image that is input to velocity analysis. The resultant velocity analysis method is tested in two 2D synthetic examples and one 2D field data example. Due to the assumptions inherent to prestack depth migration, the data that are input to velocity analysis must be singly scattered. To apply the method to multiple-rich data, we propose an image-based demultiple method. The method consists of muting events in the subsurface offset common image point gathers constructed with reverse-time migration, and remodeling the data using a kinematic demigration. A field data example shows how the image-based demultiple of the data helps to improve the velocity analysis in the presence of multiple scattering.