Ok i guess this topic has been covered quite a few times. So i'll try and make it quick.
Now Phat J's guide did give me some clues, but he overlooked a simpler, more accurate and quicker solution. I guarantee and promise this will work. Basically you need to resample rather than compress or expand the time. The example I've done here works for MPEGs but you could apply the same methods for AVI files.
Unbeknownst to most people I should imagine. Sound cards suggest they are record at 44.1KHz. Well in most cases they probably do. However, sometimes they don't quite sample correctly and are off by about 0.005KHz. This is what causes your gradual sync people. Some guitarists may recognise this if you have a software tuner. You need to calibarate the soundcard to get the perfect tuning.
The method will also work with VHS captures too, even if you capture other sources and they are in sync.
Is everybody in, is everybody in, so let me begin.
You will need:
Sonic Foundry's Sound Forge or Cool Edit (Both are available as demos)
TMPGenc
VirtualDub
1. Similiar to Phat J's guide
Use VirtualDub to find a time in the video to find a noticeable sound. It helps if you can lip-read but it's not essential. Make a note whether the sound is behind or before the video.
Here I've found a frame from the Let It Be film, where John is going to sing the word "Seeeeee" from the song I've Got A Feeling.
Jot the time down, in this case it's 1:16:22.891. The audio is ahead.
2. Use TMPGenc and under MPEG Tools to demultiplex the MPEG file into two separate files. So in this case it would Let It Be.m1v for the video and Let It Be.mp2
3. Open your audio file in Sound Forge (This may take a while if it's huge) and find your jotted time. Play the sound and note the where it's playing.
Here you can see the beginning of the "Seeee" peak and the audio is about 0.939 seconds ahead out of sync.
4. Now here's the amazing part. Instead of expanding or compressing the sound, we're going to adjust sample rate of the sound instead. Under Process you will find an option called Resample.
Make sure you only set the sample rate first only. Here i've added 9Hz because the sound was ahead so it needs to be played ever slightly more quickly. Reduce the sample rate if it's behind. You'll have to tinker with the sampling rate, but you'll find that adding 1 Hz will reduce about 0.1 seconds off over an hour. Don't worry about the pitch change, it's doesn't make a difference due to such a small change.
Now you can see i'm only 0.002 seconds out. This is alot more accurate than the time expand/compression utility. Not only that, you don't have to render the effect to preview, so you don't have to wait ages if you've got a big file. Some soundcards won't play at 41,109Hz but this really isn't a worry.
5. Once you've found the correct sample rate, you need to resample. So this time go back to Process and Resample and clear the box that says: "Set the sample rate only(Do Not Resample") and adjust the new sample rate to 44,100Hz. You don't need to apply an anti-aliasing filter, the resampling difference is so small to justify the time taken to apply the filter. Once you've set it it will start to resample which may take a while.
Now you can see your sound is at 44,100Hz and the sync is damn as near correct as it can be. No amount of time expanding/compression can get this close.
6. Now all you need to do is save the file. You'll have to save it as a Wave File at 44,100Hz Stereo unfortunately, which means mega space, but it'll be worth it.
7. After you've saved it, use TMPGenc to change the wav file into an mp2 file.
8. Use TMPGenc again and goto MPEG Tools and select Multiplex. Here it would be Let It Be.m1v as the video and Let It Be.mp2 as the audio. Choose anything you want as the output file( well make sure you end it .mpg or mpeg)
9. Enjoy your newly synched video.
10. Praise me for wasting hours trying to sort this out once and for all. I really do believe you can't get any more accurate than this method and it works with humungous files.
So to cap off, blame the soundcard, it's not recording at the correct sampling rate it's supposed to. The soundcard in this case actually records at probably about 44,109 to 44,110Hz. Perhaps video capturering software needs to use an audio calibrating utility like guitar tuning software does to help with the sampling rate and synch.
Thanks to Phat J for spurring me a bout of inspiration and thanks all for those in sync-hell. Welcome to uniformity.
Yours in humanity
ACID Agent
+ Reply to Thread
Results 1 to 30 of 77
-
-
/me is sad
no one's praising me for my fantastic efforts in audio department. I should get some Nobel award for this research. We should have VCDHelp medals.
-
I will try it
I will try also that another option
Pinnacle Studio 8 and DV home video editing (ver.9 already home) -
That is most kind sir, tell me how you get on, i'm sure you'll be pleased with the results.
-
your info looks great. im not very audio knowledgeable. i use cool edit and goldwave any chance you could show how to use one of those? also im not sure of the difference between playback rate and resampling. i tried it with goldwave now my wav is 44090 which i presume wont work as a svcd. thank you ejw
-
well - its a nice guide you wrote but i mentioned also you can just load the mpeg file (audio and video) into soundforge and view both together (vegas is even better for this) and adjust your audio .. then save out only the new wav (or mp2 file) ..
-
where was this guide when I was capping with a USB capture device??
Then my audio was always out-of-synch.
Since I bought a PCI card and cap to .avi instead of mpeg2 I haven't had the problem since!! But should I ever run into that problem again I have your guide. Good-job, Well done!!!!!"The software said Win XP or better, so I Installed Linux" -
EJW, it looks as if you're getting somewhere. You're right in saying that at 44090Hz it won't be SVCD compatible. I've just downloaded Goldwave.
[EDIT]See my post below about the whole Playback rate issue. Although it really shouldn't be called Playback rate. It may confuse you more, but if you just want to do the job just read below.
To permenantly change the audio file for compatibility and to get it into sync, the first thing you should do in Goldwave is set the "Playback rate" to 44090Hz. Next click Resample and change that to 44100Hz. It should then render the file so that the "correct" recorded sample rate of 44090Hz will be upsampled to the compliant VCD/SVCD sample rate of 44100Hz. The timing will stay the same as 44090Hz, but it will now be a legitimate 44100Hz audio file. Now save your file as a wav file.
Sorry if i've explained that really poorly. I'll give you another example. In ye olden days of computing audio recording was limited to recording at 22500Hz. The quality of 22500Hz recordings is half the quality of a 44100Hz recording. So if you were to set the playback rate of your 22500Hz file to 44100Hz it would play the file at double the speed although the file would still remain a 22500Hz file.
If you were to immediately resample the file, then the 22500Hz would be converted to 44100Hz without the change of speed. If you set the playback rate first and then resample it, you would end up with a file that plays double the original speed and 44100Hz.
BJ_M i didn't even bother at first trying to open the MPEG in Sound Forge or Vegas!!! I overlooked that one. Can you adjust the playback rate of the sound only and then resample it in Vegas. I'll have a look when i get back to my computer tomorrow. The only problem i can predict is that Vegas will have to encode the whole mpeg again, but i guess this might solve a error message i got in TMPGenc when i multiplexed. I'll try to remember what it said, but it worked fine when i played it back.
Sorry Lpn1160.. twas never destined for this guide to come to light any earlier or later in time. Or maybe i was just a lazy bastard
I've only really got into video encoding, it's time to get rid of my Hauppauge PCI Card, the quality is pretty terrible for previewing and/or capturing. I wanna watch decent quality TV on my new 17" IIyama LCD screen!! -
no -- dont touch the mpeg file in vegas or soundforge .. your just adjusting audio , render out the audio file only ... the video is loaded in there for refrence only ..
demultiplex existing audio and re-multiplex with new audio after
btw -- sample rate has NOTHING to do with playback rate ..
you are only tricking the audio decoder on how many sample bits are in a stream .. many decoders just would not play .
audio is normally 30fps NDF but you can change that ..
30fps still plays at the same speed as say 24fps .. , just that there are 24 pictures instead of 30 every sec..
audio - the same thing .. except with audio you can more easy to stretch or shrink it ..
sample rates should not be changed for a number of reasons except if nessessary between 44.1 and 48 ... -
BJ_M - I've edited my fourth post to make things a bit clearer. I don't know if it's just me, but I don't think you understand
. The finished file ends up as a 44.1KHz audio file. Complete compatibility. The decoder will see it as a 44.1KHz file.
44090Hz was what the audio was really recorded by the soundcard but encoded at 44100Hz and so hence it goes out of sync. So we need to set the sample rate back to 44090Hz and then upsample and encode it from that to 44100Hz.
The "playback rate" at 44090Hz will seem to "play" slower(although it really always plays at the same speed of 30 fps) when actually the audio has been expanded(if you saved the file now, it would be a 44090Hz file and incompatible)!!!
However Goldwave is tricked into thinking it now has a sample rate of 44090Hz. Since Goldwave now thinks the sample rate is 44090Hz you can now upsample from 44090Hz(which is taken from the adjusted "playback rate" in Goldwave) to 44100Hz. You end up with a file which is 44100Hz, in sync and compatible.
I agree playbackrate is a totally different thing. Goldwave is a bit silly really, instead of calling it the playback rate, they should change it to "set sample rate only" instead, to clear things up like Sound Forge. Playback rate to me suggests 1x 2x speed settings, rather than using Hz.
I hope this clears a few things up. BJ_M i don't know if you believe me, but i promise you what i'm doing is 100% compatible and in-sync. Maybe i'm just not explaining it well enough. -
ok my error then -- i didnt understand and perhaps didnt read your post through enough ...
don't get me wrong either ... its great that you have taken the time to put this together and worked it all out ... very nice work .. -
Thanks BJ_M i knew we'd get there eventually. Explaining sampling is not the easiest subjects to deal with.
-
Originally Posted by Acidagent
Unless you have a capture card that locks the video clock and audio clock together, you will often have drift between the video and audio. This isn't necessarily a problem, however, as a good capture program (e.g., VirtualDub) will drop the necessary frames to keep A/V sync...
As for "awards", the mods have suggested creating a "karma" rating system... However, it is not that easy to implement. Until it actually comes into being, I give you positive karma points for you guide!
Regards.Michael Tam
w: Morsels of Evidence -
Acidagent - I came across this guide, and subsequent thread, because you posted in a thread I was participating in. You pointed people over here to solve audio drift problems. My issue is that I get audio 'drift' (starts great; ends up 2 seconds out after 30 mins), so I came over here to read your guide.
My situation is that I can capture video at 352x240 using ATI, direct to MPEG 1; The MPEG1 file plays great in ATI file player - no synch issues. I can also author the mpeg file as VCD using VCDEasy and get a decent VCD file that plays on my standalone.
Then I tried to capture video at 480x480, direct to MPEG-2. The MPEG 2 file plays great in ATI file player - no synch issues. When I author this file to SVCD, I get lots of errors (encoding errors). I then demux/remux using TMPG, author as SVCD (no encoding errors), and get an output file that has the audio drift.
So - referring to the post of the moderator, and your posts/guide, would you think I'm experiencing the problem you are addressing (poor clock / timing attributes of the audio stream), or, problems with the codec, muxing problems, etc? My hunch is that I'm experiencing Muxing or codec issues, since my audio is in synch on captures with certain settings. Only falls apart when I capture to MPEG2, and/or at certain settings, and process the files.
Of course, I'll give the audio cleanup a shot. I have beSweet - that should be usable, should it not? I'd rather not learn yet another audio program!!
Thanks for the guide. -
Vitualis - Yep you're right, i was a bit carried away with the moment thinking i found the sole cause to gradual sync problem
But resampling should help a lot of people out whether it be the soundcard or the codec, etc. We all need aid to get us some decent capture cards.
It's about time i got some good karma, although it worries me cos now i've got good karma somewhere along the line will come the bad karma
Bizuser - I'm guessing that its ATI's MPEG2 codec which is a bit buggy when it comes to compliancy. The same goes for Cyberlink's too in PowerVCR. I think it's probably down to them trying to save processing power or cutting corners because they capture in realtime but their players can regonise and correct this.
I've had a look at beSweet and it doesn't look the most useable of programs but it's in its early days by the looks of things. beSweet seems to be more of a channel converter. You really need to see the data to see where the sound fits in. I really suggest you try the Sound Forge Demo or Goldwave demo. Personally i'd go for Sound Forge but Goldwave is a lot smaller and quicker to download. -
thanks for the newer info this would expalin a lot. Actually i have heard of this before and if you use soundforge to cpature it has the option of properly caliberating your sound card to fix any speed problem it migt have.
i just did 2 dvd projects and had 2 audio tracks for each. Long story short, i have soundblaster 2k and it has the rate at 48k for dvd, anyway whatever i ran in would NEVER properly sync up to the video source already on my pc or the other sound itself.
it was driving me nuts and i did some side by side to make sure my source and sound were playing the same speeds which they were.
thanks for the info check on the resample rate to fix that issue. -
My 2 cents for analog source captures:
Of course, one way to fix sync is to capture it in sync in the first place! PCI drift is definitely caused by the fact the sound card and video capture board (or USB, or whatever) aren't keeping track of each other with any time code. So you need software to do it for you.
If you use Windows 9x, then AVI_IO is the best program. It drops or adds blank frames to adjust for the sound drift.
If you have Win2K/XP and all WDM driver based hardware, then the best capture app is Virtual VCR at www.digtv.ws. It can resample the audio dynamically to keep sync with the video. We're talking less than .01% so not even somebody with perfect pitch can hear the difference. The only other 32-bit Windows program that keeps audio in sync correctly is Showshifter, but its not freeware.
I capture all my VHS tapes with VirtualVCR. As long as you set it up right, then you'll have perfect captures every time.
Proper settings under the AV tab are:
* Check: Resample Audio & Resample audio dynamically
* No Check: Adjust Stream Offset
-Robert -
Hey!
What should I do if my synch problem is the video, not the audio?
I have a video at 24.021 fps and I have to convert it to 29.97 fps, so I can watch it in my standalone dvd player.
And doing the conversion, the video becomes like 15 minutes shorter. I can easily fix the audio to match that lenght and have no synch problems. But that video is a concert, and that change in the lenght really screws it up.
So, how do I convert the framerate without changing the lenght? -
Originally Posted by Valnar
Getting the best results ever from my ATi TV Wonder (pci version and not VE version). -
for the record my card is the dazzle 2 (dvc2) i also have a tbc so my issues are not cpaturing. Sometimes i ripped a certain dvd and looked at the aiudio, yours truly made some commentaries for my own benefit to add on the actual disc. So iwould just run in the sound as thats what was only recored (via the mic input, as its just me tlaking), but i have eveerything on key and due to the sound card it would throw off the sync and now i know why
-
(I'm the poster who complained of audio synch problems with ATI AIW, using direct-to-MPEG2).
Yesterday I experimented with adjusting the audio stream. I used 'WLA' (wavelength adjust), and found that my audio and video were finally in synch - but the process for me is tedious based on the tools I'm using (demux; convert audio to wav; adjust length of audio; convert back to mpa; remux). I know it could be easier if I used recommended tools, but anyway I proved the point. FYI, for me, I adjusted from 44100 to 44200, NOT to 44095 - but it seems somewhat random. Rather than go through this whole process (since I also have difficulty cutting these native mpeg2 files) ...
Today I experimented with both PicVideo MJPEG and Huffyuv codecs in VDub. While the Huffyuv results were very good, the size is extremely large. MJPEG, at setting '18', seems to be giving me great quality AND manageable sizes (2 gig for 20 minutes). I then use avisynth to frame-serve the AVI to TMPG. So at this point, I'm thinking of giving up on the MPEG2, even though it's great compression and good video quality.
Now you bring up virtualVCR ... I'll definitely give it a try. I see, from reading the website, that it too requires/recommends MJPEG or Huffyuv codecs; so ... if I'm getting good results with Vdub+MJPEG and Huffyuv, what may I expect that's better with virtualVCR? From reading here, I'm guessing that VirtualVCR adds the audio clock-synching feature. Ironically, I don't seem to be getting audio synch problems in the first place once I use VDub!
Thanks everyone for the help! -
Dark Knight jr:
What should I do if my synch problem is the video, not the audio?
I have a video at 24.021 fps and I have to convert it to 29.97 fps, so I can watch it in my standalone dvd player.
And doing the conversion, the video becomes like 15 minutes shorter
If you are making VCDs, you don't even need to do the pulldown flag - VCD standard actually supports 23.976 natively. But if you want SVCD, you must set the pulldown flag, which 'fakes out' the player to think it's got a 29.976 stream. Actually, the mpeg stream 'instructs' the dvd player to repeat a frame every now and then. This is now movies (in US/NTSC)are stored on DVD - stored at 23.976, played back at 29.976 due to pulldown - thus you get better use of the bandwidth on the dvd. -
To Valmar and Kenmo:
If you have Win2K/XP and all WDM driver based hardware, then the best capture app is Virtual VCR
Further searching of the web, and looking at my setup, suggests I have a 'Rage Theater' tuner, not a BT8*8 tuner chip. Is this a problem for Virtual VCR?
I verified I have directX 8.1.
I can use virtualDub, and the 10 or soother programs I've been downloading and testing with ... so I'm not too suspicious of out of date stuff - but could have conflicts at this point!
(EDIT) - well of course, right after posting this, I gave it 'just one more try' and ... got it to work (of course...!). The trick was to 'scan' for channels in the tuner tab. For whatever reason, I didn't need to do this in VirtualDub - it just 'saw' the channels already scanned by ATI tuner. Anyway, once I scanned, I could preview channels and now I'm recording!! (why, I wonder, could I hear audio, even before doing this...?) Oh well... (end edit) -
Originally Posted by Bizuser
I definitely agree that it's a lot better to deal with the problem before you capture. It's just a shame that you have to re-encode to MPG and the amount of disc space avi's take although 6 GB/hour doesn't seem too bad in the days of 200 GB hard disc drives. But the end quality will be much higher even when it's converted to MPEG2, just don't use ATI's program to covert it.
I'd love to encode real decent quality MPEG2 files in realtime and in sync, but i still think it requires a lot more ooomph than they(ATI, Cyberlink, Intervideo)say and their software still need to sort out quite a few bugs out. It's a real shame, it'd save a lot of people's time to spend on something else, but with MPEG-4 hardware players coming out, i should imagine they will head towards that direction. -
Valmar/Kenmo - so I succeeded in getting VirtualVCR installed, and did some test recordings. To my surprise, the audio synch was quite bad! I double-checked all my settings, made sure I was resampling the audio dynamically
Proper settings under the AV tab are:
* Check: Resample Audio & Resample audio dynamically
* No Check: Adjust Stream Offset
Retested several times.
Went back to VirutalDub (using same video compression settings - Picvideo MJpeg), got very good results again. I'm sure you guys are right, in that VirtualVCR will do a great job; I must be missing a setting somewhere! Do my symptoms suggest any obvious error? Thanks! -
Just to straighteneveryone out who may take wrong info out of here.
NTSC is 29.970or, even more specifically, 29.9706 (Note the zero)
Not 29.976
NTSC FILM is 23.976 (Pulled down to 29.970) -
when i open up sound forge and try to open up the music file, it says i need a proper plug-in and to get it i have to buy something. is it okay if i just use the wav in soundforge that i got from virtual dub?
-
I'm wondering the same thing eric. The problem is when i load my .wav file, there is no audio with some programs. It will play in Windows Media Player, but not with Musicmatch Jukebox, and when I load it into Sound Forge, it appears to have no audio to it. Are you having that problem?
Similar Threads
-
Loss of Audio Sync after cutting (Avidemux)
By Maverick-X in forum EditingReplies: 4Last Post: 14th Oct 2011, 15:12 -
Loss of audio sync when compressing or converting DV files on Mac
By Sloperman in forum Newbie / General discussionsReplies: 2Last Post: 6th Mar 2011, 09:26 -
How to convert from avi without loss of audio-video sync?
By bonespur in forum MacReplies: 6Last Post: 26th Feb 2011, 20:47 -
Join .MP4 with .AC3 to .MKV without loss of sync
By vanleeuwen in forum Video ConversionReplies: 2Last Post: 18th Dec 2008, 02:53 -
Loss of audio sync during streaming
By TheOnlyMFH in forum Video Streaming DownloadingReplies: 0Last Post: 3rd Nov 2008, 12:58