Apr 102013

It all started when I used Microsoft’s LifeCam under Windows 8 to record a bit of video. At the end of this quite easy process I was greeted with MP4 file. All that I had to do is to import it in Movie Maker to do some processing. How hard can that be?

Well, quite hard actually. As I imported video in Movie Maker, I noticed that sound was not in sync with video. At first I was thinking that input video had an error but every video player worked correctly. For some reason only video editing software had an issue. What followed was few hours of swimming through Internet and learning everything possible about variable frame rate and how it can make your life a misery. Here is how I got this mess sorted out.

First tool I used was a GraphStudioNext. Once I opened my video this tool showed me processing graph my video goes through. I just went in and deleted last step in audio processing (Default WaveOut Device). That left AC3Filter with unconnected out pin. I used File -> Save As Graph to get MyVideo.grf.

Next in line was AviSynth. Once it got installed, I created file MyVideo.avs with following content:

video=DirectShowSource("C:\MyVideo.mp4", audio=false, fps=29.97, convertfps=true)
audio=DirectShowSource("C:\MyVideo.grf", video=false)
audio=AssumeSampleRate(audio, 44100)
audio=TimeStretch(audio, pitch=108.8435)

This deserves a bit of explaining. First line loads video with constant frame rate of 29.97 which coincides with my camera’s output. After that it loads audio (sampled at 48 kHz). And no, I could not use DirectShowSource to open both audio and video together because audio would sped up for some reason. To get everything back in sync, next line assumes that audio is 44.1 kHz. Notice that this is not true and it will make voice sound very deep. However, it will fix sync. TimeStretch will bring back pitch of our voice while preserving sample rate (value 108.84 is simply 48000/44100*100).

File MyVideo.avs can now be loaded in any video player. Only program that refuses to load this file is Movie Maker. It was time to cheat a bit. I used VirtualDub to open MyVideo.avs and and then I just exported audio (File -> Save WAV).

Last step was to load original video in Movie Maker and mute video volume. Then I used Add music to insert MyVideo.wav as a track. And with that Movie Maker had everything it needed to export final video.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>