I have been ripping the audio streams from some old TV rips to synch with HD video.
The TV audio streams are in a language not available on the bluray version.
The tv rips are 25fps and the HD vid runs at 23.98fps.
So, I usually just use ffmpeg to adjust them;
I then open the .wav in an audioeditor, remove any ads, synch it against the HD English audio streamCode:ffmpeg -i File.avi -filter:a "atempo=0.959" -vn File.wav
and save it as an .aac to add as a new audio stream on the HD vid.
This usually works fine. However I have two files that won't synch.
I've checked the TV rip frame rates. They are 25fps.
I've checked the HD vid frame rates. They are 23.98fps
I've checked for ads. I've checked for extra footage in both versions.
I've checked and re-checked everything but I'm obviously missing something.
When I compare the converted .wav streams to the HD English audio streams,
they differ in length suggesting my frame rates are incorrect.
Yet when I double-check the framerates, they always come out the same.
I've even divided the total number of frames by the runtime.
I've no idea why this is happening. As I said, it usually works fine.
If anyone can suggest where I'm going wrong, I would be very grateful.
+ Reply to Thread
Results 1 to 6 of 6
Video has framerates. Audio does not - it has sample rates. What they have in common is duration.
What is the total duration of both versions?
If for example clip A lasts 13 minutes and 40 seconds and clip B lasts 15 minutes, AND you know that they don't have any differences in editing (they often do), you would time compress/stretch (stretch in this case) the 1st by 45/41 (aka 900/820) to get the 2nd. Or the reverse to go from the 2nd to the 1st.
If they are still off, it is either that you have an offset that wasn't mentioned, or you DO have differences in edits.
As a followup, do you know the frame count of the two sources? If not exactly the same the audio won't synch after doing what you did. If after you're done they're off by the same amount all the way through, then you only have to set a delay. If the out-of-synch is progressive, I'd be willing to bet the frame counts aren't the same.
My intuition was that the ratios between the framerate and video (and audio) length would be a linear constant.
I'm still not entirely sure why it isn't, if you double the speed you will half the length, so there is a constant ratio of 1:2
This worked most of the time. (I seem to have been lucky)
But it definitely isn't working for two of them. I get a progessive offset.
(6.5 secs off at the halfway mark and 13 secs off by the end.)
So using atempo=0.959 must be wrong (23.98/25)
I'll try using the ratio between the audio lengths as suggested.
The frame counts don't match exactly as one is a TV rip with (removed) ads and truncated end-credits.
I usually have to make an offset edit at the ad-breaks, so I end up with 4 or 5 chunks of audio.
As longs as the audio speed and video speed is the same, it's not a problem.
I'd sill love to know why the frame rate ratio doesn't work.
Is the converted audio to long or to short?
Try other ratios g.e. 29.97/25.
(I recently had a 30fps video with a 23.976 fps audio track. Obviously the video track was increased to 30fps. The audio track remained the same.)
You should also use more commas, e.g. 23.976/25=0.95904.
You can also use my clever Ffmpeg-GUI, so you can change the pitch as well as the length.
Last edited by ProWo; 21st Nov 2020 at 04:14. Reason: typo
Finally matched the lengths and there was still a progressive offset which realligned near the end.
Seems I DO indeed have differences in the edits.
I managed to lay my hands on a 25fps dvd version and the 25fps tv stream matched,
so the bluray and dvd versions have some incredibly minor and difficult to detect differences.
(If I want HD vid, I will have to allign scene by scene which is too much effort.)
Anyway, many thanks for all help and advice recieved.