sonic
sonic copied to clipboard
Output seems to be slightly too fast
I am using sonic to speed up the audio of videos, and have been noticing that I am getting a slight audio/video desync. At 2.5x this seems to be around half a second for every half an hour of video (original length).
Example
$ youtube-dl -f bestaudio "https://www.youtube.com/watch?v=8sBYyrJDC0o" -o aud.webm
$ ffmpeg -loglevel panic -i aud.webm -f wav - | sox -t wav - -t wav slow.wav
$ sonic -s 2.5 slow.wav fast.wav
$ ffmpeg -i slow.wav 2>&1 | grep Duration | awk '{print $2}' | tr -d ,
00:31:00.10
$ ffmpeg -i fast.wav 2>&1 | grep Duration | awk '{print $2}' | tr -d ,
00:12:23.40
The first time is the length of the original audio, the second is the length of the audio sped up to 2.5x with sonic.
s = 31*60 + 0 + 10/60 = 1860.1666666666667
f = 12*60 + 23 + 40/60 = 0743.6666666666666
s/2.5 = 0744.0666666666667
s/f = 2.5013446884805024
In this case the sped up audio was about 400ms shorter than what I was expecting- 743.6 seconds rather than 744-, and the speed up factor was about 2.501 rather than the specified 2.5.