|
|
| oratonastick |
| Posted: Jan 11 2015, 01:29 PM |
 |
|
Newbie

Group: Members
Posts: 5
Member No.: 27646
Joined: 18-May 10

|
During a summer camp I made short movies of all participants, and I am now trying to compile these into a single movie using VirtualDub. The original movies were made with a digital camera and are in MJPEG format. I opened each of these in VirtualDub, removed uninteresting footage at start & end of each movie using the crop function, and saved them as uncompressed AVI with a direct stream copy of the audio. At this stage each individual movie looks good and sound is in sync with the movie. Next I renamed the movies as xxxx001, xxxx002, xxxx0003, etc and used the "Append AVI segment" function to combine the individual movies to one movie. The result looks good, but as the combined AVI progresses sound progressively goes out of sync (sound ahead of the image). Is there some way to avoid or fix this?
I'm using VirtualDub 1.10.4 on Windows 7 (64 bit).
Here is the information of the combined file, which is made up of 119 fragments.
Video: Frame size, fps (µs per frame): 480x640, 30.000 fps (33333 µs) Length: 5070 frames (2:48.99) Decompressor: Internal DIB decoder ( ) Number of key frames: 5070 Min/avg/max/total key frame size: 921600/921600/921600 (4563000K) Min/avg/max/total delta size: (no delta frames) Data rate: 221186 kbps (0.00% overhead)
Audio: Sampling rate: 22050Hz Channels: 1 (Mono) Sample precision: 16-bit Compression: PCM (Uncompressed) Layout: 57 chunks (2.97s preload) Length: 3714456 samples (2:48.45) Min/avg/max/total frame size: 88880/130331/131072 (7255K) Data rate: 353 kbps (0.02% overhead) |
 |
| dloneranger |
| Posted: Jan 11 2015, 01:56 PM |
 |
|
Moderator
  
Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07

|
That's just the info for the first clip, the combined info isn't given in the file information dialog
But, you can see what the problem is just from that It's the tiny difference in length between the audio and the video
When you append a clip, the audio and video are just stacked onto the end of each other With 199 clips, these tiny differences add up to a big sync problem
There are a few ways to deal with this kind of problem
1) Only use uncompressed audio Compressed audio is made of chunks of audio. When you cut, the cut has to happen between two chunks - this is never in the same place as where the video frame changes So you get a file with audio a bit longer or shorter than the video Uncompressed audio can be cut exactly, so it'll cut on a video frame boundary (or so close it makes no difference)
2) Use avisynth and make a script that joins the clips but adds blank audio in between if needed You'll need to recompress with that method though as avisynth only returns uncompressed audio/video You'd install avisynth from here http://avisynth.nl/index.php/Main_Page#Official_builds Then make a new text document Type something like this in, but replacing the filenames and a lot more lines
| CODE | avisource("c:\vid001.avi") ++ avisource("c:\vid002.avi") ++ avisource("c:\vid003.avi") |
Rename that file to something like joinedclips.avs Load the joinedclips.avs into virtualdub Now all the sound should be ok
-------------------- MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask Windows7/8 Codec Chooser All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3 |
 |
| -vdub- |
| Posted: Jan 11 2015, 03:02 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 613
Member No.: 27087
Joined: 24-February 10

|
I could only have suggested setting Options > Sync To Audio then set Direct Copy for both video and audio. Load all the 199 segmented files into Batch Wizard drag set to save to another drive then Add To Queue. Run the batch using Job Control to see if they auto clean up. I'm not sure if dlonerangers suggestion does the same now you have two ways to do this with your intermediate uncompressed AVI|PCM videos
I would also rename all the file so the file names so they are all the same (see below) so able to be loaded later as multi segmented files
Summer Camp.000.avi Summer Camp.001.avi ... Summer Camp.118.avi Summer Camp.119.avi |
 |
| dloneranger |
| Posted: Jan 11 2015, 03:21 PM |
 |
|
Moderator
  
Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07

|
The sync to audio option only syncs the video preview window to the audio It's a display pane option only Too see what it does press play with it enabled/disabled
You may be thinking of the video frame rate option -> change so video and audio durations match?? That'd make the videos unjoinable though, as all the framerates will be different
-------------------- MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask Windows7/8 Codec Chooser All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3 |
 |
| -vdub- |
| Posted: Jan 13 2015, 08:16 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 613
Member No.: 27087
Joined: 24-February 10

|
Yes that's the option I was thinking of now know it would be quicker to do it with an AviSynth script that you posted. I have also made a copy of your script for when need to correct videos with the same problem |
 |
| oratonastick |
Posted: Feb 13 2015, 05:09 PM |
 |
|
Newbie

Group: Members
Posts: 5
Member No.: 27646
Joined: 18-May 10

|
dloneranger, thank you for your help, you're a lifesaver! I finally got around to trying your suggestion. It took some effort to get it to work, at first all I got was a "Avisynth open failure, script error: syntax error". As it turned out VirtualDub and/or Avisynth didn't like the fact that each "++ avisource..." was on a separate line, after I'd fixed that it worked like a charm! |
 |
| dloneranger |
| Posted: Feb 13 2015, 06:10 PM |
 |
|
Moderator
  
Group: Moderators
Posts: 2366
Member No.: 22158
Joined: 26-September 07

|
Yeah, I forgot that avisynth needs a backslash to continue on a new line Sorry about that (edited earlier post to correct that) http://avisynth.nl/index.php/The_full_AviS...ammar#Backslash
-------------------- MultiAdjust JoinWav WavNormalize FFMPeg Input Plugin v1827 UnSharpMask Windows7/8 Codec Chooser All FccHandlers Stuff inc. Installers for acm codecs AAC, AC3, LameMp3 |
 |