Have you noticed if they do it on smooth roads?
From the sound of it, I'd say it was a loose wire but if so, it should be more pronounced on uneven surfaces.
Another test would be to leave the car running, with the lights on, and keep it stationary. If they still flicker, I'd put it down to an issue with the ECU or one of the other control modules. If they don't flicker, it would seem to support the loose connection / wire theory.