VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. The Avisynth wiki gives this example of how to use DeleteFrame:
    Code:
    DeleteFrame(3, 9, 21, 42) # delete frames 3, 9, 21 and 42
    Just what I need for an old film with a single splicemark frame at each scene change. But when looking at the preview of my script the splice marks were still there despite the fact that the framecount had gone down by the number of frames I wanted cut. So, to see what was happening, I scripted
    Code:
    trim(5000,5005).deleteframe(5002,5004)
    It returned a four frame clip comprising frames 5000-5003. The two final frames were cut.

    What am I doing wrong? Thanks
    Quote Quote  
  2. In your example, the trim command makes the frame numbers no longer valid. There are new frame numbers after the Trim(), namely 0,1,2,3,4,5 , corresponding to 5000 to 5005. Any subsequent DeleteFrame call out of the new framenumber range (now 0 to 5) will now just delete frames from the end. So you would expect 5004,5005 to be deleted .


    Use a frame accurate source filter

    Post your script
    Quote Quote  
  3. I do a lot of film work and often have to fix splices. While I generally find it easier to do this within Vegas, using Vegas scripts I have written to delete a frame, or replace it with a duplicate of the next or previous frame, I did write an AVISynth script to replace a bad frame at a scene change. Since splice marks always happen at a scene change (even if the splice was to repair broken film, because this usually creates a big enough jump to create a scene change), you may find this useful (or maybe you won't)

    Code:
    #Script to replace frames at scene changes
    
    global scenethreshold=15
    
    source=AVISource("E:\fs.avi").killaudio().convertTOYV12()
    
    # Temporarily un-comment next line to display the average luma value on screen to help determine threshold value
    #ScriptClip(source,"Subtitle(String(YDifferenceToNext(source) ))" )
    
    fixed = ConditionalFilter(source, trim(source,1,0), source, "YDifferenceToNext()>scenethreshold", "greaterthan", "0")
    
    return fixed
    Quote Quote  
  4. Thanks, poison, I understand DeleteFrame now. Seems counterintuitive, in my view, though. Much easier, surely, to specify the rogue frames with their original numbers. What do you mean by a frame accurate source filter? (I get my frame numbers from the .showframenumber command.)

    Thanks, John. I tried various ways of using your script but without success. How should I apply it to this, my standard way of scripting:
    Code:
    LoadPlugin("D:\MeGUI 2944 32bit\tools\lsmash\LSMASHSource.dll")
    a=LWLibavVideoSource("D:\movie.avi")
    b=LWLibavaudioSource("D:\movie.avi")
    audiodub(a,b)
    trim(5149,68345)
    Thanks again, gents.
    Quote Quote  
  5. Originally Posted by pooksahib View Post
    Thanks, poison, I understand DeleteFrame now. Seems counterintuitive, in my view, though. Much easier, surely, to specify the rogue frames with their original numbers.
    Delete the frames referencing the original numbers first, then use trim referencing the new numbers

    What do you mean by a frame accurate source filter? (I get my frame numbers from the .showframenumber command.)
    Basically not DirectShowSource - because the frames can get mixed up. LWLibavVideoSource is (mostly) frame accurate
    Quote Quote  



Similar Threads

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