| Printable Version of Topic
Click here to view this topic in its original format |
| Unofficial VirtualDub Support Forums > Testing / Bug Reports > Append Multiple Vids - Audio Out Of Synch |
| Posted by: zenowik Nov 1 2011, 04:31 AM |
| Not only I have this problem its in VDUB since many years but still no fix. When i edit multiple files and then i want to merge them using append and direct stream then at the beginning audio is ok but later in merged video sound is out of synch. http://www.tacticalgamer.com/video-production/164624-fraps-audio-out-sync-long-files-virtualdub.html I also tried to only compress the video to xvid and use direct stream audio for every small vid and then join them all together in different app - audio is out of synch as well. There must be something during saving of the video in virtualdub, cause merging filesfrom it even in other programs like avidemux or boilsoft video joiner results in out of synch audio. Anyone can try this, just take some long clip and save about 10 clips from it using only compressing to xvid with direct stream copy for audio and try to merge them with append LOL.Why is this happening ? This is serious issue for me cause after saving such file in VDUB i cant even merge it correctly in other program without taking the sound and inserting audio manually after each clip in this big merged file. |
| Posted by: Abrazo Nov 1 2011, 09:43 AM |
| You are not the only one who struggles with this problem. Please read this post from about a year ago: http://forums.virtualdub.org/index.php?act=ST&f=15&t=19361&hl=append It comes from a "difference in length" between video and audio after the compression of each file (have a look a File > Information). It is logic that after putting them together via Append, the difference will be greater and more noticeable after each part. A solution that I use is to first make a new copy of each part via "Direct stream copy" of both Video and Audio. So, video and audio have exactly the same length. Than I put them together via Append. A little inconvenience is to have a little sound pitch at each place where the files are joined. |
| Posted by: zenowik Nov 2 2011, 03:21 PM |
| So cant this be fixed ? If so many people know that virtualdub doesnt cut audio to the same lenght then how about fix ? Audio gets compressed before video so how about compressing after and check lenght of the vid then cut the lenght of audio track ? |
| Posted by: dloneranger Nov 2 2011, 04:53 PM |
| That issue is nothing to do with virtualdub, but a result of the way that the compressors work eg Mp3 encodes a block of audio at a time (called a "frame") This frame contains a small time-length of sound (From http://www.mp3-converter.com/mp3codec/frames.htm it appears to be about 26 milliseconds long - offhand I dont know if vbr mp3 change that length) Either way, the chances of the break between 2 audio frames actually matching the same instant that a new frame of video occurs is pretty small So, when you cut a video up in direct stream copy mode, the video frame you cut on will be somewhere in that audio frame That audio frame then has to be included or excluded, depending on how far through the audio frame the cut is The best way to cut/edit a video is to do it with uncompressed audio, and only compress the audio when you're all done and finished |
| Posted by: zenowik Apr 28 2012, 01:22 AM |
| This problem occurs only when i cut beginning of video file, when i render files without any cuts or cuts are only at the end then files join perfectly fine, so whats happening in vdub that it creates audio lag when you cut beginning of the file ? |
| Posted by: dloneranger Apr 28 2012, 10:06 AM |
| Like I said, when you cut at the beginning you have almost zero chance that a block of audio will also start at the same time So, in direct stream copy mode, Virtualdub has to either include the audio block that starts before the video, or the block that starts after the audio Either way, the audio won't be exactly cut in sync (vbr mp3's can make this even harder to get in sync) You can move the audio backward and forwards relative to the video from the menu Audio->Interleaving Type a number into the Audio Skew Correction box and save the video eg 1000 will delay he audio by 1 second ------ If you convert the audio track to uncompressed pcm before you do all the cutting, then you can cut and keep the audio in sync |
| Posted by: TCmullet Jan 8 2013, 09:23 PM |
| (Tho this thread is months old, it starts to speak to my problem, which remains unsolved.) Lossless vid. codec, PCM audio. The sound track was obtained from another source and it varied a little in speed through out. I have broken who video (2+ hours) up into (say) a dozen pieces. For each piece, I use the audio display to carefully pick the best +/- ms to delay audio for THAT piece, then saved each piece. I did so with "copy direct stream" for both video and audio. Each resultant stream plays correctly. But when I append all back together, sync errors. Now having read this thread and others, I've taken each of my sync-corrected pieces and created a "further corrected" piece where audio was "full processing mode", yet still PCM length in newly created small-file is different than video length. So therefore I believe appending all together will still be out of sync. I cannot trim video frames from any piece. How can I correctly get the audio and video lengths equal? I would have thought that changing audio delay would have an invisible feature to cut off excess audio and fill in a shortfall with silence. Once I learned it wasn't doing that in "direct (audio) stream copy", I thought "full processing would do it". But it doesn't. What should I do, please? |
| Posted by: dloneranger Jan 8 2013, 09:35 PM |
| Ugh, that sounds like a thankless task If it was me, I'd have made each piece longer than needed (at the beginning and end) That'd give a bit of 'play' when I was sliding the audio left and right in the audio display to line it up I usually just hold down the shift or ctrl (I can never remember which) and drag the audio around with the mouse It's a lot easier like that to line up a noise with a frame (doors banging etc) Joining them all back up could be awful though, with the audio joins having cuts or repeated bits in |
| Posted by: TCmullet Jan 8 2013, 09:41 PM |
| It was tedious. But now I have sync corrected files. What do I do to fix the length? Strip out each sound track, append a second of silence, then merge the track back in?? If I must, I must. I just want to be sure it's necessary. I'm assuming that whatever excess I add will be trimmed off to match the video (i.e. there will be audio for each video frame, and no more than that). When you shift the audio around and save, the audio is kept in sync, as evidenced by the new file has zero audio skew correction (and it sounds correct). This led me to believe that the head and tail ends would receive silence generated by Vdub. But it's not, whether I recompress audio or not. I'm guessing that if I delay the audio, then LEADING silence must be being added. But then why, when I'm "undelaying" audio, doesn't it add silence at the end? |
| Posted by: dloneranger Jan 8 2013, 09:59 PM | ||
| You'd have to take that up with Phaeron :-) Do you have avisynth? You could join them up with a script in that There are two ways to append in avisynth one is like virtualdub and the other adds the blank audio if needed + and ++ eg myjoinedclip.avs
Drag that into virtuadub and you should get what you want |
| Posted by: TCmullet Jan 9 2013, 07:29 PM |
| I did it my way, although was tedious. "Saved as WAV". Appended 2 sec. of silence in WAV editor (I use CoolEdit96). Then in same Vdub instance with short audio, I switch audio to external file, the one I tail-padded. Save AVI with video=direct stream, and audio=full process (to PCM). Worked like a champ. Perhaps if I had seen your nice post, I would have been bold enough to try what you showed as a much simpler way. Yes, I have used AviSynth somewhat. |
| Posted by: TCmullet Jan 9 2013, 10:19 PM | ||
Gosh, I didn't know one could slide the track like that! I experimented and discovered the ctrl key allows it! Yay! (Sooooooo many secret features buried away to those who seek or inquire!) |