This tool automatically syncs matching video and audio files using recurrence quantification analysis (RQA). The tool allows you to adjust the sampling rate, hop length, and ftt window size so you can achieve near-perfect synchronization.
At the start of this project, I used dynamic time warping (DTW) instead of recurrence quantification analysis (RQA) to synchronize the two audio tracks. This method seemed efficient for my purposes, but didn't achieve near-perfect synchronization on some tests. This led me to implement RQA, which maximizes alignment paths and relies on similarity rather than distance.
More information on RQA can be discovered here on Wikipedia, and a similar project has been documented on this pdf
pip install -r requirements.txt
pip3 install -r requirements.txt
python audiosync.py --help
-v, --video | path to video file
-a, --audio | path to audio file
-o, --output | path to output file
-f, --fft | fft window size | recommended to be a power of 2 | default: 4410
-hl, --hoplength | hop length | the number of samples between successive frames | default: 512
-sr, --samplingrate | sampling rate in Hz | Most applications use 44.1kHz | default: 44100Hz
-d, --duration | duration to check for offsets | default: 120 seconds