Synchronize two audio streams with ffmpeg

Say I have a video of a talk but the soundtrack is bad, and I happen to have an audio recording of the same talk made with a good mike. Is there a way, with ffmpeg, to replace the bad audio with the good one, automatically synchronizing the two (the good mike was not started at the same time as the camera, and I don’t want to manually specify the shift)?

Can ffmpeg do that? I have found many questions about swapping/merging audio streams, but not much about synchronizing them first.