AV Sync problem when resampling AVI

Discussion in 'Amateur Video Production' started by John Scudder, Apr 11, 2005.

  1. John Scudder

    John Scudder Guest

    Using transcode/mplex to convert AVI video files to MPEG4 for making a
    DVD usually works very nicely, but I have a few AVI videos with the
    audio at 14400 mhz that are giving me problems. For these files I
    enable the -J resample option in transcode to convert the audio to 48000
    mhz. The videos are approximately 350 MB. This resampling proceeds
    with out any error messages, but the resulting MPG file is less than

    At the beginning of the newly made MPEG4 video the audio and video are
    in sync. As the video plays the AV sync gradually drifts apart. By the
    end of the video, the AV sync is several seconds off. If I use
    transcode without the -J resample option, the AV sync is fine through
    out the video, but then the audio is still at 14400 mhz and it will not
    work with dvdauthor.
    What can I do to keep the AV in sync at 48000 mhz??

    John Scudder, Apr 11, 2005
    1. Advertisements

  2. John Scudder

    John Scudder Guest

    Pardon my dyslexia, I meant '44100 hz' not '14400 mhz'

    John Scudder, Apr 11, 2005
    1. Advertisements

  3. John Scudder

    B. Peg Guest

    This is what I have saved and written down on an AVI rip I did where the
    audio synch was off at the end. Maybe it'll help, maybe not. Anyhoo, here
    it is:

    One theory is if the sound card is not really at 44,100 Hz and is actually
    at 44,109, then the audio could be off several seconds at the end of the
    movie - sort of a compression or expansion of the audio file. This one
    explain why a ripped movie is different when played on various players or

    I did one tonight where the audio and video synch was off a few seconds on a
    DivX AVI movie rip I did to put it in my portable player. The thing was off
    a little at the beginning and a bunch at the end.

    A couple of pieces of software can help: VirtualDub and SoundForge
    (VirtualDub is free, other is trial I believe but I bought SF as I like it).

    Here is the outline as I wrote it down:
    Open the AVI file in VirtualDub and make note of the frame counter time
    (bottom of screen) for a sound near the beginning and one near the end. I
    used someone banging a hammer for one and shouting at the end.

    In VirtualDub, you can rip a WAV file out of the AVI file. Using
    SoundForge, load the large WAV file and scan to the two "approximate" times
    noted above and listen for the sounds you are using to mark the file (i.e.
    the hammer and shout noise in mine). Make an exact note of the "real
    occurring time" of the two noises at the bottom of the screen in SoundForge.
    Add or subtract the two times in SoundForge from the frame video times in
    VirtualDub. The object is to get the two times to agree with each other as
    close as you can.

    You can shift the WAV file time ahead or back using either a Insert Time at
    the beginning of the WAV file or subtract it to match the above video frame
    times. No doubt they "both" will not match doing so.

    Now come the little trick. You can use Resample in SoundForge and shift the
    audio (either compress or expand the length of the track). Open Resample
    (leave anti-alias off), check the box regarding "Sample Only" so you do not
    save it yet, and change the Sample Rate from 44,100 Hz to say 44,110 and see
    where the new audio times are in comparison to the frame times earlier done.
    You can increment or decrement the 44,100 number and watch the audio times
    change. The idea is to change it and get it to closely match the video
    frames. You cannot get it exact but close.

    Once done, set the Resample back to 44,100, uncheck the Sample only box, and
    save it. You can then set both the video and audio pulldowns in VirtualDub
    to Streaming and load the AVI file. Under the Audio select your new WAV,
    Press F7 (or Save AVI), and let it rip. It's pretty fast here (4-5

    However, now you have a DivX AVI with a WAV file and it's pretty large. Run
    it back through VirtualDub. Turn on Full Processing Mode in both Video and
    Audio pulldowns. Set the video Compression codecs for DivX; the audio
    Compression for LAME Mp3 (set to around 44,100 Hz, 128 Constant Bit Rate
    (CBR - not variable or average), Stereo. You can also alter the Video
    filter with a bit of Brightness and Contrast (mine always seems so dark in
    Windows Media Player). This run will take longer (30 mins) and the file
    will be much smaller.

    That's as much as I remember.....whew!

    Good luck.

    B. Peg, Apr 11, 2005
  4. John Scudder

    John Scudder Guest

    Thanks for the suggestion. Since I am not using Windows I won't be
    able to do exactly what you did using VirtualDub and Soundforge , but I
    think I can pretty much follow the same steps using comparable Linux
    John Scudder, Apr 12, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.