PDA

View Full Version : Changing FPS without Audio out of sync.


Revgen
4th January 2006, 21:20
My video capture device captures video at 30fps. Unfortunately I can't use 30 fps if I want to put the content onto a DVD. So when I change the FPS to 29.97 the audio becomes out of sync. I tried adjusting the Delay parameter, but that just made things worse. Is there a way that I could change the audio so it's in sync with the video?

I tried searching these forums but couldn't find any definitive answers.

foxyshadis
4th January 2006, 22:08
Method 1, easiest: drop 1 of every 1001 frames (or fields). Any decimator should handle that fine.

Method 2, overkill: motion compensate into the new framerate. :p

Method 3, sensible: stretch the audio to 1001:1000 of the original rate, then just change the framerate (via assumefps). Since you have to resample to 48000 anyway, unless your camera captures in that, it shouldn't hurt it any more.

Dark Alchemist
4th January 2006, 22:41
Hmmmm, this almost sounds like what I do for Pal->NTSC which is 25 to 29.97.

All that I do is demux the audio, ChangeFPS(29.97) on the video then remux the audio back in. Works 100% for me with no loss of sync for even a 3hour movie.

Would be the same even in your case of 30->29.97

foxyshadis
4th January 2006, 23:47
Sure, changefps works, that's my #1. You don't even have to demux/remux the audio because the filter leaves it alone. (I don't like it for 25->30 because the stutter is pretty noticeable with progressive frames, but much less so for interlaced content.)

Dark Alchemist
5th January 2006, 00:11
I never had a problem taking a dvd pal and doing it like that.

Dvd Pal -> Demux AC3 -> ChangeFPS(29.97) -> CCE -> DVD Lab Pro. Bring in the ac3 and the now 29.97i NTSC mpeg2. Not one bit of stutter on any of my dvd's and no sync loss.

Richard Berg
5th January 2006, 00:32
Use TimeStretch. Resampling the video is always going to be more noticeable.

hartford
5th January 2006, 02:45
Here is what I do for my captures:

avisource("z:\my_capture.avi")assumefps(29.97,true)

The "true" parameter will adjust the audio sample-rate to match
the video length.

Then you seperate the audio to a wav. I use VirtuaDub and do
"save wav." I then resample the wav using Sound Forge which
does resample and timestretch in one operation. I'm not
aware of another program that does this.


If you use "changefps," the rate will be fine, but you will
get blended frames.

foxyshadis
5th January 2006, 03:23
ConvertFPS blends frames (normally). ChangeFPS just repeats or axes frames.

Avisynth comes with its own audio resamplers, ResampleAudio & SSRC. You can use it like so:

avisource("blue.avi").assumefps(29.97,true).SSRC(48000)

SSRC quality compares very favorably to eg. Soundforge, Audacity, etc; ResampleAudio is faster but lower quality.

hartford
5th January 2006, 05:11
<i>ConvertFPS blends frames (normally). ChangeFPS just repeats or axes frames.</i>

What?

ConvertFPS might blend.

Why would you want that?

<edit>

I'm not going to argue. I've presented my solution. Revgen will decide.

stickboy
5th January 2006, 06:17
foxyshadis was refuting your statement that ChangeFPS blends. There's nothing to argue: ChangeFPS never blends.

BTW, if you want to delete 1 of every 1001 frames, I've got this DeleteEvery function (http://www.avisynth.org/stickboy/) that's good for that.

Revgen
5th January 2006, 09:06
Thanks guys.

I decided to bob the video with EEDI/TDeint and use the assumefps(59.94,true) command to avoid any chance of field problems. I then used separatefields().selectevery(4,0,3).weave(). It seems to work well since there is no audio sync issues.

For some reason SSRC said that it was unable to convert my audio to 48khz. So I demuxed it with Vdubmod and converted it with winamp's diskwriter plugin. Everything seems to be in order now.

squid_80
5th January 2006, 11:04
IIRC SSRC can't do arbitrary conversions, there has to be some relation between input rate and output rate but I can't remember exactly what it is. I would imagine the adjustfps(59.94, true) leaves you with an audio input rate that SSRC doesn't like.

Wilbert
5th January 2006, 11:41
IIRC SSRC can't do arbitrary conversions, there has to be some relation between input rate and output rate but I can't remember exactly what it is.
Yup. Too lazy to look up the documentation? :)

http://www.avisynth.org/SSRC

@Rev,

Try ResampleAudio:

avisource("blue.avi").assumefps(29.97,true).ResampleAudio(48000)

Mug Funky
6th January 2006, 07:19
I decided to bob the video with EEDI/TDeint and use the assumefps(59.94,true) command to avoid any chance of field problems. I then used separatefields().selectevery(4,0,3).weave(). It seems to work well since there is no audio sync issues.

provided you know what the input field order is (hint: if 4,0,3 is giving you top first, then the source is top-first), then you will not have to bob first - that's just wasted time if you're re-interlacing without changing the number of frames.

try:
assumefps(30000,1001,sync_audio=true).resampleaudio(48000)

and you'll (hopefully) find that it's a lot faster with the same result :)

Revgen
6th January 2006, 07:45
I'm well aware when it comes to interlacing issues. It was a TFF source, so it worked fine.

It was the audio that was giving me problems. I'm kinda a noob when it comes to audio stuff. Knowing the "true" command for AssumeFPS should now help me in the future. Hopefully.;)

I'll try the ResampleAudio command the next time and see how it works.

Poutnik
6th January 2006, 09:31
Edit: Moved to separated thread by topic starter

hartford
8th January 2006, 02:44
@ stickboy

You know, it's funny. I can't find the thread, but some time ago
I had a problem with a capture that involved frame-blending.

You asked me to post my avisynth script. Esby replied and
told me to use "assumefps" rather than "changefps," which stopped
the blending (could have been "convertfps").

Beats me. Whatever works is fine.