VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
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  
  6. Originally Posted by poisondeathray View Post
    Delete the frames referencing the original numbers first
    But by what method? That's what I was hoping to do with DeleteFrame (instead of the laborious trim(50,1000)++trim(1002,4444) etc).
    Originally Posted by poisondeathray View Post
    then use trim referencing the new numbers
    I'm thinking this would not be necessary if I'd already deleted the bad frames...!
    Quote Quote  
  7. Originally Posted by pooksahib View Post
    Originally Posted by poisondeathray View Post
    Delete the frames referencing the original numbers first
    But by what method? That's what I was hoping to do with DeleteFrame (instead of the laborious trim(50,1000)++trim(1002,4444) etc).
    Using DeleteFrame

    Do this exercise and step through the frames

    Code:
    BlankClip()
    ShowFramenumber()
    DeleteFrame(3, 9, 21, 42) # delete frames 3, 9, 21 and 42
    Frames 3,9,32, 42 are deleted

    Why do you need Trim at all ?
    Quote Quote  
  8. Thanks, poison, but I've just had a eureka moment. I use MeGUI and if the entire movie is selected then finding the bad frames is difficult due to lack of space in the small preview screen. So I select a few scenes at a time making it easier to find the frames to delete. With my first go at using DeleteFrame I assumed it would delete the original frame number but you put me right on that. But - eureka moment - I can still use DirectFrame by using the position number rather than the frame number.
    Image Attached Thumbnails Click image for larger version

Name:	zdf.jpg
Views:	0
Size:	23.9 KB
ID:	82896  

    Quote Quote  



Similar Threads

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