How to automatedly synchronize video recording with pre-recorded music track?
Music videos are often the easiest type of video to sync because they rarely (but sometimes) contain any live sound from the set. Usually, the people in the video are lip-syncing to a recording of their own music, which they’ve rehearsed many times, and have no problem repeating.
In postproduction, all an editor needs to do is replace the camera scratch audio with the original recording.  This is easy when camera scratch audio records the on-set playback to which the talent is lip-syncing, because the editor can either align the audio waveforms visually, or use software to sync the audio waveforms, automatically.  All of the major NLEs are capable of waveform synchronization, but third-party alternatives are also available.
In cases where there is no camera scratch audio, aligning visual cues to the music manually is also straightforward and effective.
But in cases where audio is recorded on set, with second system sound (an audio recording device other than the camera), usually the camera and audio are synced by “jam syncing” their internal timecode clocks together. Usually, also the camera slate (aka “clapperboard”) serves as a visual+audio sync cue.  Low budget sets will often only use a slate, and zero budget shoots will use a simple hand clap. Of these methods, only jam-syncing timecode provides an automated way to re-assemble the files.
In a nutshell, jam-syncing tells all synced devices to set their internal clocks to the same time exactly once, and then trusts that the devices are capable of keeping time accurately.  For a short music video, you are unlikely to experience significant drift between clocks, but for longer recordings, the inaccuracies between clocks can introduce sync errors.  In these cases, highly accurate timecode generators are often used to broadcast timecode continuously to all cameras and audio recording devices.  Ambient Recording’s Lockit box and Timecode Systems’ Timecode buddy are two names in this field.  For Jam-syncing, Tentacle Sync devices are also popular.