VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Hello friends.
    A friend and I are trying to write a function for AVS+ (latest version) that replaces frames manually, replacing the indicated frame with an interpolated frame with InsertFramesMC to fix some panoramic jumps in the video, similar to filldrops.

    The function works well with some frames, however there are some random errors when the number of frames is greater. Would anyone know how to indicate a solution or idea on how to fix this?

    this is the error we get:
    Image
    [Attachment 57414 - Click to enlarge]


    this is the beta function:

    Code:
    function MultiReplaceFramesMCD(clip sauce, int_array mapping)
    {
    
        sauce = default(sauce, last)
        mapping = default(mapping, [0])
    
        for(i = 0, ArraySize(mapping) - 1){
            sauce = ReplaceFramesMCD(sauce, mapping[i])
        }
    
        return sauce
    
    }
    
    function ReplaceFramesMCD(clip Source, int N, int "X")
    {
        # N is number of the 1st frame in Source that needs replacing. 
        # X is total number of frames to replace
        #e.g. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps interpolation
        
        Source = default(Source, last)
        N = default(N, 0)
        X = default(X, 1)
     
        start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
        end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point
     
        start+end
        AssumeFPS(1) #temporarily FPS=1 to use mflowfps
      
        super = MSuper()
        backward_vec = MAnalyse(super, isb = true)
        forward_vec = MAnalyse(super, isb = false)
        MFlowFps(super, backward_vec, forward_vec, blend=false, num=X+1, den=1) #num=X+1
        AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
        Trim(1, framecount-1) #trim ends, leaving replacement frames
      
        Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
    }
    The script does something like the following:
    MultiReplaceFramesMCD(100, 201, 351...)
    Where frames 100, 201 and 351 are deleted and interpolated with the following, since they were duplicated.

    Thank you for your time and suggestions.
    Quote Quote  
  2. No crash here.
    Wild guess build be that it's either a problem that Avisynth is running out of memory (switching to 64bit might help) or a problem with the source filter.
    -> Post a sample and a script which crashes with that sample.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. It is not insufficient memory, it rarely reaches 500MB (I tested it on 64 bits, same error), especially since it is just a simple video (without additional filters).
    I believe it is some limitation in the "array", it is not used in avs+ for many things, but I don't know how to do it using standard syntax, other programs (megui) cannot use it, for example.

    The error happens randomly, with just a few lines of maps and sometimes with 30 or 100 lines, so it only works if I disable all of them and activate them one by one, and the error can happen in any one.

    I normally use this filter to correct panoramic scenes with drop frames, this results in several lines (100+) each with 10 to 30 frames.

    Thank you anyway.
    Quote Quote  
  4. Not sure how to exactly do it in Avisynth, just looking at your function, there is lots of trimming and adding. It might be solvable more easy, just having another clip that is just shifted one frame (copy original and delete first frame).
    Then use animate function and if frame == frame from your array use frame from that shifted clip and run something else whatever is needed. Or running it in two phases. First replacing frames, second to smooth them.
    Adding to it,..there could be more shifted clips at the same time, so you use frame from before and after.
    Last edited by _Al_; 22nd Feb 2021 at 11:01.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!