Search code examples
videovideo-editingavisynth

AviSynth - video framerate doesn't match


I am trying to speed up only certain frames in a video, without splitting it into several files, here is the code that I used to do this

AVISource("C:\Users\me\Desktop\source_10FPS.avi")   # get the 10 fps video source

a= Trim(0,100)                                       # trim the first 10  seconds
b= Trim(100,200).AssumeFPS(14, sync_audio=TRUE)      # trim and speed it up 
c= Trim(200,0).AssumeFPS(10, 1, true)                #trim and go back to original speed 

return (a+b+c)                                       # combine the 3 Trims

but I get a "video framerate doesn't match" error

any help would be appreciated


Solution

  • The framerate actually doesn't match, because by AssumeFPS(14) you're changing FPS of b to 14 and try to concatenate that with two 10 FPS fragments. FPS usually can't change along the way of the video, unless it is VFR (variable frame rate), but that's complicated.

    For a simpler solution you can do the following:

    Ar=Audiorate()                                                                  #get audio sampling rate of original clip
    a= Trim(0,100)                                                                  #trim the first 10  seconds
    b= Trim(101,200).AssumeFPS(14, sync_audio=TRUE).ChangeFPS(10).ResampleAudio(Ar) #trim and speed it up while keeping audio rate and fps intact
    c= Trim(201,0)                                                                  #note that to avoid having repeating frames (#100 and #200) you need to change Trim numbers
    

    You can also use ConvertFPS instead of ChangeFPS for probably smoother playback.


    Learn more here: http://avisynth.nl/index.php/FPS