View Full Version : Audio Desync, complicated!
Neillithan
12th October 2007, 06:01
Okay, so this technically is not a virtualdub problem, or at least this is not caused by virtualdub. But, virtualdub is someway affecting the final encoded file.
First of all, I recorded using fraps. It spit out 12 huge avis (around 4 gigs a piece). I used a program called Staxrip to combine and encode the file into high quality x264. It spit out a nice 1.2 GB x264 encoded .mkv file, which plays perfectly, looks great, but the audio desyncs around 6 minutes in.
I tried to see if the original avis made by Fraps had the audio desyncing problem. The only 1 with audio desyncing is part 1 of 12. The other 11 parts sync up properly. So, 6 minutes into the first frapsed .avi, the audio desyncs, but the others remain perfect.
Now, I have narrowed it down. First of all, Staxrip uses virtual dub automatically to combine and create the audio file (.wav). This audio file is all 12 parts combined. For some reason, during this process, all syncing issues become finalized into a single .wav, which later is included with the final encoded video.
Consequently, instead of virtualdub combining all 12 .avis, and syncing properly, it desyncs all because the very first .avi has an audio desyncing problem. Has anyone else encountered this, and /or does anyone know how I may solve this problem?
Thanks,
Neil
Adub
12th October 2007, 07:29
Why don't you just adjust the audio for the first avi using delaycut, or virtualdub as you like, then take that fixed version and feed it in with the rest of the avi's into staxrip?
Neillithan
12th October 2007, 09:19
It seems to me like delaycut is pretty complicated.
Problem is getting it to sync with the video and I need a visual cue / audio cue in order to get them synced up properly. The only program I can think of that lets me do this easily is Sony Vegas. Another problem is, I need to resync a single 4 gig file and sony vegas will churn away at at that for hours, especially if I'm aiming for lossless compression so that I may continue to merge the remaining files.
It looks to me like I'm gonna have to trial and error this for a few hours to get the results I'm looking for. :(
Adub
12th October 2007, 09:50
No, you shouldn't. Just open the file in virtualdub, use the interleaving->audio delay options to pic an estimate value (start at around 100ms and increase to 200, 300,....). Then save only a small section of the file. Open that file in your prefered player and check the sync. If its fine, Great! if not, go back and try it again, this time increasing/decreasing as you see fit.
the sony idea does work, but as you said, it may take a while for it to churn through it. With virtualdub, you just find your approximate value using a small sample, and then affect the large one with your discovered value. Much faster.
Also, you can also use negative delay values if you need to. find a value which works best for you.
Neillithan
2nd January 2008, 01:31
New Years Resolution: Get an answer to this thread that actually "answers" my questions. Obviously, interleaving in VirtualDub is not what I need. I need a way that will crop the audio to the actual length of the avi, because Fraps has a tendency to create different lengths for audio / video... which causes programs like VirtualDub, to simply append the audio streams together instead of cropping the audio per avi segment to prevent audio desyncing issues.
Jesus christ, it makes perfect sense to me, but after writing / reading this, it seems like it's easily misunderstood by someone who's not actually sitting in my chair with this problem. :(
http://img231.imageshack.us/img231/2618/frapsvideoaudiolengthdigd9.png
http://img232.imageshack.us/img232/4535/frapsvideoaudiolengthdirs9.png
I hope those pictures make my problem easy to understand.
setarip_old
2nd January 2008, 02:35
Hi!
If, as you seem to be indicating (in both your earlier words and your recent pictures) the ONLY problem is that the FIRST .AVI has excess audio "dead air" at some point, BEFORE joining the .AVIs, you can use GoldWave as follows:
1) "Drag & Drop" the .AVI onto the already opened GoldWave window
2) Delete the "dead air" and resave the audio in the same format
3) Load the original FIRST .AVI into VirtualDubMOD
4) Streams>>Stream List>>Disable (Disables the ORIGINAL audiostream)
5) Streams>>Stream List>>Add (Add the NEW audiostream created with GoldWave)
6) Video>>Direct Stream Copy
7) Save with a new filename (Replacement for ORIGINAL first .AVI)
Neillithan
2nd January 2008, 04:40
Dude, you suggested Trialware. Not cool. It's bad enough that I have Sony Vegas.
How does someone build up 9000 posts at the doom9 forum and ultimately suggest trialware? That is just beyond me.
setarip_old
2nd January 2008, 05:23
@Neillithan
First and foremost, you haven't stated whether my suggested procedures resolved your problem (Whether you used GoldWave or something you may have found in the way of freeware)Dude, you suggested Trialware. Not cool.No, actually I suggested a commercial program. Some of us actually purchase commercial software when it serves our purpose.How does someone build up 9000 posts at the doom9 forum and ultimately suggest trialware?Your comment may go down in the annals of history as one of the most absurd remarks of all time. What the heck does the number of my posts have to do with ANYTHING?
kumi
2nd January 2008, 05:46
AlignedSplice() (http://avisynth.org/mediawiki/Splice)
AlignedSplice cuts off the first sound track or inserts silence as necessary to ensure that the second sound track remains synchronized with the video.
Maybe you can do what you want in AviSynth. I'm not sure, but maybe something like:
foofile = mpeg2source("foofile.d2v")
foofile = audiodub(last, wavsource("foofile.wav"))
barfile = mpeg2source("barfile.d2v")
barfile = audiodub(last, wavsource("barfile.wav"))
return foofile++barfile
Neillithan
2nd January 2008, 07:40
AlignedSplice() (http://avisynth.org/mediawiki/Splice)
AlignedSplice cuts off the first sound track or inserts silence as necessary to ensure that the second sound track remains synchronized with the video.
Maybe you can do what you want in AviSynth. I'm not sure, but maybe something like:
foofile = mpeg2source("foofile.d2v")
foofile = audiodub(last, wavsource("foofile.wav"))
barfile = mpeg2source("barfile.d2v")
barfile = audiodub(last, wavsource("barfile.wav"))
return foofile++barfile
Thank you so much. :) Thank you for showing me how to solve one of the most plaguing issues ever. Now I can record my games using fraps and rest assured that the audio will no longer desync during the file splitting process. This was quick and painless, thank you so much. :thanks:
AlignedSpice() For the Win!
@setarip,
I'm sorry man, I just wanted a somewhat automatic method of eliminating gaps between multiple video files, and the several methods suggested prior to Kumi were very non-automatic. I am 100% positive your way worked, but I was seeking not only a free means to accomplish this, but also a quick means without the need for any secondary (intermediate) operations. AviSynth did exactly what I needed and I am eternally grateful for such a great scripting language/program/thing! :D
Oh, and as for the "trialware" statement, I am correct in at least one way--it is listed as Trialware at Softpedia.com. Sorry if it offended you.
Just to clarify one more thing.. It wasn't just the first file with "dead air"... infact, it wasn't dead air at all. Fraps has a tendency to drop frames of the video file during the splitting process... Basically, fraps will capture game footage uncompressed, but when it reaches the 4 gigabyte barrier, at attempts to chop the video and then start a new one. During this "chopping" or "splitting" process, Fraps somehow manages to make the video stream shorter than the audio stream. Then, when I attempted to append the 5 - 15 segments in Virtualdub, the audio would simply "add" without any regard to "alignment" with the actual video file. After about 10 to 15 minutes of watching the finalized video, there will be extreme audio/video desyncing.. Worse is, to manually fix this would involve manually deleting the gaps via exporting, editing, and importing the audio files back... this was such a laborious task that I couldn't even fathom why it would ever be suggested. What you suggested seemed as if it does exactly what delaycut does. That's why my response to you was outright angry. I'm sorry, I want to rely on doom9 for help, but I do have a problem with receiving accurate responses... and as you could see, this thread died without ever receiving one. :( That is, until I bumped it. Sorry for the drama.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.