View Full Version : Problem with AssumeSampleRate


kingmob
2nd September 2004, 15:55
I have a video, which for some strange reason isn't synchronised anymore. It used to be, but i must've been careless (probalby during a fps conversion) and now it's totally f'ed.
So i tought i'd change the sampling rate and hope the change in pitch isn't too bad. So i tried this:

vid = AviSource("movie.avi").AssumeSampleRate(40518)
return vid

The problem is, that the sound is much shorter than the video, by as much as 6 minutes. But instead of making the gap smaller, this actually makes it larger? This while virtualdub reports that the sound length is now almost exactly the movie length.
So it ought maybe the silence at the end was somehow taken, so i tried this:

vid = AviSource("movie.avi")
audio = vid.Trim(0,50970).AssumeSampleRate(40518)
audiodub(vid,audio)

But this yields the exact same results, as it should.
What am I doing wrong here?!

Wilbert
2nd September 2004, 16:11
AssumeSampleRate doesn't resample the sample rate. You have to use SSRC to resample it and AssumeSampleRate to make it 48 kHz (or whatever the original sample rate is) again.

AviSource(...)
SSRC(40518)
AssumeSampleRate(48000)

kingmob
2nd September 2004, 16:28
But SSRC resamples without changing the speed, doesn't it? So wouldn't this speed up the audio instead?
But i tried it out anyway and SSRC complains it "could not resample between the two sample rates". Does this mean, SSRC only wants to resample between standard values?
[edit]
Found the problem, SSRC didn't like the last integer. I've now computed that to get it correctly at 48000 i have to use:

AviSource("movie.avi")
SSRC(52240)
AssumeSampleRate(48000)

And this seems to result in the correct audio, though it's hard to check since it's extremely slow now :).
Thanks for the help!