背景:我有视频片段和音轨,希望将它们与视频同步。
从视频片段中,我会提取一个参考音轨。我还有另一个音轨,希望能与参考音轨同步。由于编辑的原因,每个切换场景的时间间隔都有所不同,导致了不同步。
我需要操作目标音轨,使其看起来(在这种情况下是听起来)像参考音轨。这相当于在正确的位置添加或删除静默。虽然可以手动完成,但这将非常繁琐。因此,我希望能够通过程序确定这些位置。
例如:
从视频片段中,我会提取一个参考音轨。我还有另一个音轨,希望能与参考音轨同步。由于编辑的原因,每个切换场景的时间间隔都有所不同,导致了不同步。
我需要操作目标音轨,使其看起来(在这种情况下是听起来)像参考音轨。这相当于在正确的位置添加或删除静默。虽然可以手动完成,但这将非常繁琐。因此,我希望能够通过程序确定这些位置。
例如:
0 1 2
012345678901234567890123
ref: --part1------part2------
syn: -----part1----part2-----
# (let `-` denote silence)
输出:
[(2,6), (5,9) # part1
(13, 17), (14, 18)] # part2
我的想法是,从一开始开始:
Fingerprint 2 large chunks* of audio and see if they match:
If yes: move on to the next chunk
If not:
Go down both tracks looking for the first non-silent portion of each
Offset the target to match the original
Go back to the beginning of the loop
# * chunk size determined by heuristics and modifiable
这里的主要问题是声音匹配和指纹识别是模糊的,而且相对昂贵。
理想情况下,我希望尽可能少地使用它们。有什么好的想法吗?