VideoHelp Forum
+ Reply to Thread
Results 1 to 11 of 11
Thread
  1. When adding or dropping frames with whatever function, such as Trim, I recall the audio being unaffected, is there any way for the audio to correspond to the edits made with Avisynth?
    Quote Quote  
  2. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Originally Posted by Mephesto View Post
    When adding or dropping frames with whatever function, such as Trim, I recall the audio being unaffected, is there any way for the audio to correspond to the edits made with Avisynth?

    Trim affects audio, if you have audio loaded in the script. Other functions might not, but you have to be specific as to which you are referring to

    e.g

    Code:
    vid = mpeg2source()
    aud = nicac3source()
    audiodub(vid,aud)
    trim()
    Quote Quote  
  3. Member
    Join Date: Jul 2009
    Location: Spain
    Search Comp PM
    As pdr says, Trim() does affect the audio.
    So does Loop().

    But DeleteFrame(), DuplicateFrame() and FreezeFrame() leave audio unchanged.
    Quote Quote  
  4. Member
    Join Date: Nov 2011
    Location: USA
    Search PM
    AviSynth's various Fade filters also affect audio.

    http://avisynth.org/mediawiki/Fade
    Quote Quote  
  5. Member AlanHK's Avatar
    Join Date: Apr 2006
    Location: Hong Kong
    Search Comp PM
    Originally Posted by Mephesto View Post
    When adding or dropping frames with whatever function, such as Trim, I recall the audio being unaffected, is there any way for the audio to correspond to the edits made with Avisynth?
    If audio doesn't stay in sync, you probably have VBR audio in the video file.

    Use EnsureVBRMP3sync() and that will force Avisynth to seek audio from the beginning of the file, rather than calculating the time, which it does incorrectly with VBR audio.
    This makes it slower to play if you are jumping around in VirtualDub, but it will be perfectly in sync.

    Also use ++ (aligned splice) rather than + (unaligned) to join trims.

    E.g., this worked fine for me:
    Code:
    AVISource("S2_3.avi")
    EnsureVBRMP3Sync()
    AmplifydB(0.75) 
    LanczosResize(704,576).AddBorders(8,0,8,0)
    BlankClip(last,75)++Trim(1382,86802) ++Trim(87654,0)
    Another way is to use FFMPEGSource2. This creates an index of the file so it knows exactly when each sample is.
    So you can skip through the file and it plays in sync without delay.
    Like this:
    Code:
    FFmpegSource2("S2_3.avi",atrack=-1,fpsnum=-1,fpsden=1)
    AmplifydB(0.75) 
    LanczosResize(704,576).AddBorders(8,0,8,0)
    BlankClip(last,75)++Trim(1382,86802) ++Trim(87654,0)
    Quote Quote  
  6. Specifically, I need a duplicate frame remover (both MultiDecimate and Dedup failed) to also remove audio when removing frames.

    I thought this was a global thing in Avisynth, why does one function affect audio while another doesn't?
    Quote Quote  
  7. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    It doesn't make sense for some functions to affect audio

    For example, something like dedup is exporting VFR timecodes, so video speeds up in sections that has removed frames. Audio is supposed to be unchanged

    If you have some function that removes duplicates and audio, think of the case where you have some frame removed every say, 30 frames. There will be an audio "blip" every time a frame is removed. Think of how you would remove a single audio sample equivalent to 1 video frame duration in an audio editor - it's impossible without a "blip"
    Quote Quote  
  8. Videos shot from my old camera (which I still use) sometimes lag and there is no sound during the lags, so it gets really choppy. It takes forever to remove the duplicate frames by hand.

    The blips you speak of are easily remedied with click removal.
    Quote Quote  
  9. Member
    Join Date: Sep 2007
    Location: Canada
    Search Comp PM
    Not sure what you're doing this for, but have you considered using filldrops() or related functions? Instead of removing, they use mvtools to synthesize a replacement "inbetween" frame where the duplicates are detected. Audio is unaltered of course
    Quote Quote  
  10. Not sure what I'm doing it for? K listen, the camera lags and a single frame becomes up to 50 like you'd see on a webcam with a dial-up connection. I'm not familiar with filldrops but it wouldn't remedy the audio.
    Quote Quote  
  11. Member AlanHK's Avatar
    Join Date: Apr 2006
    Location: Hong Kong
    Search Comp PM
    Originally Posted by Mephesto View Post
    Not sure what I'm doing it for? K listen, the camera lags and a single frame becomes up to 50 like you'd see on a webcam with a dial-up connection. I'm not familiar with filldrops but it wouldn't remedy the audio.

    Well, if the audio is going out of sync because of duplicate video frames, look at
    http://avisynth.org/mediawiki/External_filters#Duplicate_Frame_Detectors
    You can use "Dup" to detect duplicates, (maybe its log can help to make a script) or try dedup to remove them automatically.
    Quote Quote  



Similar Threads