VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 52
  1. hi

    I was not here for a long time
    I returned to the project after a break ..

    I decided that I should use the function RemapFrames
    Because I recorded the tape several times and I know that if I combine the recordings so some broken frames will be fixed.

    At least that's what I gather from what I've read about this plugin.

    I downloaded the plug-in. The only problem is I do not know how to use it.
    I tried to read the help file and figure out what to do but I could not understand ..

    I'd love to get sample code ..
    The examples in the help file is not good enough for me ..
    Quote Quote  
  2. I don't use it to fix broken frames, but use it to filter different sets of frames in different ways. For this I use the ReplaceFramesSimple part of it. And use it something like this (from a script I happen to have lying around):

    BaseClip=Last
    SourceClip=BaseClip
    SourceClip=SourceClip.Tweak(Bright=0,Cont=0.93,Cor ing=False)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[6285 7433] [10234,12444] [15023 18400] ")

    BaseClip=Last

    SourceClip=BaseClip
    SourceClip=SourceClip.InpaintFunc(mask="logo1.bmp" ,loc="22,18,-236,-244",AR=4.0/3.0,mode="Inpaint",speed=10, ppmode=2,pp=85,radius=6.0,preblur=10.0)
    ReplaceFramesSimple(BaseClip,SourceClip,Mappings="[3695 208691]")
    The other parts of RemapFrames are used similarly (I think). But if you're really talking about fixing frames, as in generating new frames to replace corrupted or ugly ones, then RemapFrames isn't what you want.
    Quote Quote  
  3. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    The RemapFrames plugin contains three functions.

    The RemapFrames() function replaces frames in a Base clip with frames from a Source clip. The function uses a "mappings" text string to specify two frame numbers (or two groups of frame numbers). The first number(s) refer to frames in the Base clip, the second number(s) refer to frames from the source clip. Therefore:

    For this function you need two videos: a Base video and a Source video. In your script you can assign variables to the videos:

    Code:
    BaseVid=AviSource("drive:\path to file\BaseVideo.avi")
    SourceVid=AviSource("drive:\path to file\SourceVideo.avi")
    Three examples of using the function

    Code:
    RemapFrames(BaseVid, mappings="[0 9] [100 109]", SourceVid)
    ### frames 0-9 in the Base clip are replaced by frames 100-109 from the Source clip.
    return last
    Or:

    Code:
    out1=RemapFrames(BaseVid, mappings="10 5", SourceVid)
    ### frame 10 in the Base clip is replaced by frame 5 from the Source clip
    return out1
    Or:

    Code:
    out1=RemapFrames(BaseVid, mappings="[20 30] 6", SourceVid)
    ### frames 20-30 in the Base clip are replaced by frame 6 from the Source clip.
    ### That is, frames 20-21-22-23-24-25-26-27-28-29-30 in the Base clip 
    ### will become 6-6-6-6-6-6-6-6-6-6-6 from the Source clip.
    return out1
    The term "mappings=" can be replaced with the path + filename of a text file that contains frame mappings. NOTE: Do not use "mappings=" together with the mapping filename in the same statement. Use one or the other, but not both.

    To combine all three of the above examples, create a text file called "mappings.txt". The .txt file would contain these lines (do not use quotes):
    Code:
    [0 9] [100 109]
    10 5
    [20 30] 6
    Combine the three example statements into one:

    Code:
    mapfile="drive:\path to mapfile\mapfile.txt"
    BaseVid=AViSource("drive:\path to file\BaseVideo.avi")
    SourceVid=AViSource("drive:\path to file\SourceVideo.avi")
    
    out1=RemapFrames(BaseVid, mapfile, SourceVid) 
    return out1
    The two other functions in RemapFrames will replace frames, but they do it in a different manner.
    Last edited by sanlyn; 20th Sep 2012 at 07:36.
    Quote Quote  
  4. Good one, sanlyn. Yeah, that's probably what he's after.
    Quote Quote  
  5. Originally Posted by sanlyn View Post
    The RemapFrames plugin contains three functions.

    The RemapFrames() function replaces frames in a Base clip with frames from a Source clip. The function uses a "mappings" text string to specify two frame numbers (or two groups of frame numbers). The first number(s) refer to frames in the Base clip, the second number(s) refer to frames from the source clip. Therefore:

    For this function you need two videos: a Base video and a Source video. In the .avs script you can assign the video paths + filenames to your own variables:

    Code:
    BaseVid=AviSource("drive:\path to file\BaseVideo.avi")
    SourceVid=AviSource("drive:\path to file\SourceVideo.avi")
    Three examples of using the function

    Code:
    RemapFrames(BaseVid, mappings="[0 9] [100 109]", SourceVid)
    ### frames 0-9 in the Base clip are replaced by frames 100-109 from the Source clip.
    return last
    Or:

    Code:
    out1=RemapFrames(BaseVid, mappings="10 5", SourceVid)
    ### frame 10 in the Base clip is replaced by frame 5 from the Source clip
    return out1
    Or:

    Code:
    out1=RemapFrames(BaseVid, mappings="[20 30] 6", SourceVid)
    ### frames 20-30 in the Base clip are replaced by frame 6 from the Source clip.
    ### That is, frames 20-21-22-23-24-25-26-27-28-29-30 in the Base clip 
    ### will become 6-6-6-6-6-6-6-6-6-6-6 from the Source clip.
    return out1
    The term "mappings=" can be replaced with the path + filename of a text file that contains frame mappings. NOTE: Do not use "mappings=" together with the mapping filename in the same statement. Use one or the other, but not both.

    To combine all three of the above examples, create a text file called "mapfile.txt". The .txt file would contain these lines (do not use quotes):
    Code:
    [0 9] [100 109]
    10 5
    [20 30] 6
    Combine the three example statements into one:

    Code:
    mapfile="drive:\path to file\mapfile.txt"
    BaseVid=AViSource("drive:\path to file\BaseVideo.avi")
    SourceVid=AViSource("drive:\path to file\SourceVideo.avi")
    
    out1=RemapFrames(BaseVid, mapfile, SourceVid) 
    return out1
    The two other functions in RemapFrames will replace frames, but they do it in a different manner.
    I do not work with avi files (I work with m2v files) so I did this:

    Code:
    BaseVid=Mpeg2Source("part 1.d2v")
    SourceVid=Mpeg2Source("part 1 v2(r1).d2v")
    But it did not work .. I got this message:

    Name:  o7jblc.jpg
Views: 5235
Size:  17.7 KB

    What to do?
    Quote Quote  
  6. If you have multiple captures use a median filter. That will get rid of junk that only appears in one capture (on a per frame basis).

    https://forum.videohelp.com/threads/340963-Best-quality-and-speed-video-denoisers-2011?...=1#post2122313

    It also results in some (playback) noise reduction.
    Quote Quote  
  7. Originally Posted by jagabo View Post
    If you have multiple captures use a median filter. That will get rid of junk that only appears in one capture (on a per frame basis).

    https://forum.videohelp.com/threads/340963-Best-quality-and-speed-video-denoisers-2011?...=1#post2122313

    It also results in some (playback) noise reduction.
    Thanks but I started with what sanlyn says ..
    Quote Quote  
  8. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    By using the method I suggested, I take your last reply to mean this:
    1) The different captures are not an exact frame-by-frame match with each other.
    OR...
    2) A frame in one capture is damaged, but the same frame in another capture is OK. The frame numbers are different between the two captures, so you need to "borrow" a good frame from one capture and use it to replace a different frame number in the other capture.

    In either case, you need something like RemapFrames to build a better final capture with repaired frames.


    Originally Posted by gil900 View Post
    I do not work with avi files (I work with m2v files) so I did this:

    Code:
    BaseVid=Mpeg2Source("part 1.d2v")
    SourceVid=Mpeg2Source("part 1 v2(r1).d2v")
    But it did not work .. I got this message:

    Image
    [Attachment 14028 - Click to enlarge]


    What to do?
    If you're using Avisynth, you're working in AVI. MPEG2Source converts to uncompressed AVI. Opening the script in VirtualDub converts it to RGB AVI. You can tell VirtualDub to return the results in another format or colorspace, which is what I presume you've been doing.

    In the avs script, after the last line of your processing you can use this statement:
    Code:
    return last
    Look at the "return" statement in the sample I posted. It tells Avisynth what to return as the result. In the sample script you posted, the name of the "result" in your last statement is "SourceVid". If that's what you want as a result, the statement could be "return SourceVid". This assumes that your script didn't do any more processing than the lines shown in your script. In the script you posted, all the script does is open a .d2v project and serve the frames to VirtualDub as AVI. That's the only work that the script performs.
    Quote Quote  
  9. Originally Posted by gil900 View Post
    Originally Posted by jagabo View Post
    If you have multiple captures use a median filter. That will get rid of junk that only appears in one capture (on a per frame basis).

    https://forum.videohelp.com/threads/340963-Best-quality-and-speed-video-denoisers-2011?...=1#post2122313

    It also results in some (playback) noise reduction.
    Thanks but I started with what sanlyn says ..
    If you have caps without dropped frames a median filter is much less work. You'd be wasting your time manually figuring out where all the bad frames are and remapping them when Median1() would do it all automatically.
    Quote Quote  
  10. Originally Posted by jagabo View Post
    Originally Posted by gil900 View Post
    Originally Posted by jagabo View Post
    If you have multiple captures use a median filter. That will get rid of junk that only appears in one capture (on a per frame basis).

    https://forum.videohelp.com/threads/340963-Best-quality-and-speed-video-denoisers-2011?...=1#post2122313

    It also results in some (playback) noise reduction.
    Thanks but I started with what sanlyn says ..
    If you have caps without dropped frames a median filter is much less work. You'd be wasting your time manually figuring out where all the bad frames are and remapping them when Median1() would do it all automatically.
    This process can be Automatic?
    I did not think it could be automated ..

    sanlyn explained very well. On the other hand what you offer mor faster ..
    If that's so I do not know what to do ...

    EDIT:

    to use this method you MUST:
    -Use TBC
    -Have no frame drops in the captures

    i have frame drops in all my captures
    Last edited by gil900; 26th Sep 2012 at 09:44.
    Quote Quote  
  11. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    The multiple captures must have the same number of frames, and the frames must occur with the same frame numbers in all captures. Frame 100 in one capture should be frame 100 in the other capture(s). If you have dropped a frame in one capture between frame 100 and 101, and the other captures have the same frames in frame 100 and 101, then the captures match and are identical. They all have the same frame drop in the same place.

    Neither Avisynth nor VirtualDub can "know" that there is a dropped frame. All they see are frames 100 and 101. You know there is a dropped frame because you're looking at the video and you can see a skip or jerk in the action. But let's say that Capture #1 has a dropped frame that you know is missing between frames 100 and 101. If the second capture does not have that dropped frame, but has a frame 100, 101, and 102, then the two captures are NOT ALIKE. Starting with frame 102, the two captures show different action in all the following frames. They cannot be matched or merged using the methods described. You will have to do it another way.

    By the same token, if all the captures have a dropped frame between 100 and 101, then at that point the captures are alike.

    Now the question is, give an example of the kind of frame replacement you're trying to make with RemapFrames. If you mean that frame 100 is a bad frame (discolored, fuzzy, ripped, etc.) in capture #1, but capture #2 has a "clean" version of that same frame, then you can use RemapFrames to replace the bad 100 with the clean 100. Or.....maybe capture #2 has exactly the same action, but that action is in frame 106. Then you can replace the bad 100 with the clean 106 using RemapFrames. In that case the frame numbers don't have to match between captures, but the frames you use for replacement must have the same action.

    You should overcome your obsession with total automation. None of these filters or applications can read your mind. You are dealing with the kind of video damage that requires you to analyze frames, make decisions, and tell your processing apps what to do.
    Quote Quote  
  12. Yes. I know the job ..


    Is there a way to see the change directly?
    Quote Quote  
  13. Originally Posted by gil900 View Post
    i have frame drops in all my captures
    Then which is less work depends on how many frame drops vs how many bad frames.
    Quote Quote  
  14. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by gil900 View Post
    Is there a way to see the change directly?
    Yes. When you open a script in VirtualDub, what you see is the result of the work being done by your Avisynth script.

    You can also use VirtualDub for view-only. There is more than one way to view the video. 1) Open the file with an Avisynth script, then open the avs script in VirtualDub. Or, (2) you can directly open your m2v file in VirtualDub using "Open video file . . ." and navigating to the m2v. In doing so, VirtualDub will make certain assumptions about the video, so the safest way to open an m2v for viewing in VirtualDub is to use an Avisynth script and open the file as a d2v project. In either case, you are just viewing the video, not processing and re-saving it.

    A simple way to view more than one file in VirtualDub is to open VirtualDub onto your desktop and load the first video. Leave that display of VirtualDub open on your desktop, then open a second copy of VirtualDub and load another video into it. You can have more than one copy of VirtualDub open on your desktop. Each copy can be looking at different videos.

    There are ways to combine video output inside Avisynth, placing frames atop each other or side by side. But you don't know Avisynth that well, so let's not get too complicated.

    We still don't know exactly what you want to do with RemapFrames. Are you REPLACING frames between two capture files (that is, replacing a bad frame in one video with the same good frame another video), or are you INSERTING frames into one of the videos to compensate for dropped frames? You can't INSERT a frame into a video using RemapFrames.
    Last edited by sanlyn; 26th Sep 2012 at 15:36.
    Quote Quote  
  15. I converted m2v files to avi files and I still get this message:
    https://forum.videohelp.com/attachment.php?attachmentid=14028&d=1348665129

    I converted without compression ..

    This is the test code:
    BaseVid=AviSource("part 1.avi")
    SourceVid=AviSource("part 1 v2(r1).avi")


    What to do?
    Quote Quote  
  16. Do something with SourceVid and/or BaseVid. AviSynth returns the video called "last". Whenever you perform a filter it uses the video called last and outputs the video called last -- unless you tell it to use a different video. For example:

    Code:
    AviSource("filename.avi")
    Greyscale()
    implies:

    Code:
    last = AviSource("filename.avi")
    last = Greyscale(last)
    return(last)
    In your script you've defined two video streams but not what to do with them or what to output.
    Last edited by jagabo; 28th Sep 2012 at 12:26.
    Quote Quote  
  17. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by gil900 View Post
    I converted m2v files to avi files and I still get this message:
    https://forum.videohelp.com/attachment.php?attachmentid=14028&d=1348665129

    I converted without compression ..

    This is the test code:
    BaseVid=AviSource("part 1.avi")
    SourceVid=AviSource("part 1 v2(r1).avi")
    What to do?
    See jagabo's reply to that error message.

    When you say "I converted m2v to avi files", how did you do that? If you simply opened the m2v's directly in VirtualDub and saved as avi, it will work but that's not the best way to do it, and you could make a mess of the color space if not done correctly. Anyway, you don't have to convert them to avi separately. The DirectShowSource statement that opens the d2v project files creates video streams for VirtualDub that are avi's (effectively). There's no need to perform that extra conversion to AVI containers.
    Last edited by sanlyn; 1st Oct 2012 at 21:08. Reason: corrected code error
    Quote Quote  
  18. Originally Posted by sanlyn View Post
    Originally Posted by gil900 View Post
    I converted m2v files to avi files and I still get this message:
    https://forum.videohelp.com/attachment.php?attachmentid=14028&d=1348665129

    I converted without compression ..

    This is the test code:
    BaseVid=AviSource("part 1.avi")
    SourceVid=AviSource("part 1 v2(r1).avi")
    What to do?
    See jagabo's reply to that error message.

    When you say "I converted m2v to avi files", how did you do that? If you simply opened the m2v's directly in VirtualDub and saved as avi, it will work but that's not the best way to do it, and you could make a mess of the color space if not done correctly. Anyway, you don't have to convert them to avi separately. The DirectShowSource statement that opens the d2v project files creates video streams for VirtualDub that are avi's (effectively). There's no need to perform that extra conversion to AVI containers.

    Code:
    mapfile="drive:\path to file\mapfile.txt" 
    BaseVid=DirectShowSource("drive:\path to file\BaseVideo.d2v") 
    SourceVid=DirectShowSource("drive:\path to file\SourceVideo.d2v")  
    
    out1=RemapFrames(BaseVid, mapfile, SourceVid)  
    return out1
    Ok thanks for the code ..

    I did this with d2v file and got this error:

    Click image for larger version

Name:	2cxhrtl.png
Views:	2101
Size:	26.7 KB
ID:	14090
    What should I do?


    This is my code:
    HTML Code:
    mapfile="mapfile.txt" 
    BaseVid=DirectShowSource("part 1.d2v") 
    SourceVid=DirectShowSource("part 1 v2(r1).d2v")  
    
    out1=RemapFrames(BaseVid, mapfile, SourceVid)  
    return out1
    Quote Quote  
  19. D2V files are opened with MPEG2Source(), not DirectShowSource()
    Quote Quote  
  20. Originally Posted by jagabo View Post
    D2V files are opened with MPEG2Source(), not DirectShowSource()
    Ok .. I just did by example I got here.

    But I thought about what you own and tried this:
    HTML Code:
    mapfile="mapfile.txt" 
    BaseVid=Mpeg2Source("part 1.d2v") 
    SourceVid=Mpeg2Source("part 1 v2(r1).d2v")  
    
    out1=RemapFrames(BaseVid, mapfile, SourceVid)  
    return out1
    And I get this error:

    Click image for larger version

Name:	107ju6f.png
Views:	2078
Size:	21.0 KB
ID:	14092
    Quote Quote  
  21. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by jagabo View Post
    D2V files are opened with MPEG2Source(), not DirectShowSource()
    Oops. Took that from an old script. Will correct now. Sometimes cut-and-paste is not the easiest way!
    Last edited by sanlyn; 1st Oct 2012 at 21:09.
    Quote Quote  
  22. Originally Posted by sanlyn View Post
    Originally Posted by jagabo View Post
    D2V files are opened with MPEG2Source(), not DirectShowSource()
    Oops. Took that from an old script. Will correct now. Sometimes cut-and-paste is not the easiest way!
    It's okay ..

    I tried to figure out what is right and I got a few options that work -
    1)
    out1 = RemapFrames (SourceVid, mapfile, "", BaseVid)

    2)
    out1 = ReplaceFramesSimple (BaseVid, SourceVid, mapfile)

    I did a test - I wrote in the mapfile file this:

    [0 9] [100 109]
    10 5
    [20 30] 6


    Then I saw that it works ..

    But I can not get the numbers ..
    In my case Frame 341 = Frame 154 in the second capture.

    So I wrote this:
    [341 342] [154 155]

    But when I run the script so it does not replace the frame 341 to frame 154 in the second capture. It replaces frame 342 to another that i do not know where it came from ...
    Quote Quote  
  23. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Good work, gil900 You were almost there. But I had problems as well, and I tried the same changes. This is very very VERY strange. I used RemapFrames() in the past, and I use ReplaceFramesSimple all the time. But now RemapFrames() is giving me errors, as well. I resurrected some 2-year-old scripts, and they would not run. After searching for 2 hours in doom9 I see that RemapFrames() had some parsing problems. But I saw no repairs. Finally, through Google Translate I find myselkf in an Indian movie forum where this problem was discussed. Apparently some parts of the RemapFrames plugins haven't been updated for the latest versions of Avisynth.

    Unfortunately I fell asleep for 15 minutes at the computer. When I woke, I had lost all my browser windows! But I managed to copy a couple of solution scripts. Cancel the "mapfile" and the text file; apparently RemapFrames isn't updated for newer versions of Avisynth, so it's not reading outside text properly. I inserted some extra test frames below, so change the frame numbers you will need.

    Code:
    BaseClip=Mpeg2Source("part 1.d2v")
    BaseClip=BaseClip.RemapFrames(mappings="341 154
     342 155
     200 201
     [202 210] 211
     220 225", SourceClip=Mpeg2Source("part 1 v2(r1).d2v"))
    
    return BaseClip
    Yes, some of it does look odd. Observe the quotation marks and commas carefully.
    Quote Quote  
  24. Originally Posted by sanlyn View Post
    Good work, gil900 You were almost there. But I had problems as well, and I tried the same changes. This is very very VERY strange. I used RemapFrames() in the past, and I use ReplaceFramesSimple all the time. But now RemapFrames() is giving me errors, as well. I resurrected some 2-year-old scripts, and they would not run. After searching for 2 hours in doom9 I see that RemapFrames() had some parsing problems. But I saw no repairs. Finally, through Google Translate I find myselkf in an Indian movie forum where this problem was discussed. Apparently some parts of the RemapFrames plugins haven't been updated for the latest versions of Avisynth.

    Unfortunately I fell asleep for 15 minutes at the computer. When I woke, I had lost all my browser windows! But I managed to copy a couple of solution scripts. Cancel the "mapfile" and the text file; apparently RemapFrames isn't updated for newer versions of Avisynth, so it's not reading outside text properly. I inserted some extra test frames below, so change the frame numbers you will need.

    Code:
    BaseClip=Mpeg2Source("part 1.d2v")
    BaseClip=BaseClip.RemapFrames(mappings="341 154
     342 155
     200 201
     [202 210] 211
     220 225", SourceClip=Mpeg2Source("part 1 v2(r1).d2v"))
    
    return BaseClip
    Yes, some of it does look odd. Observe the quotation marks and commas carefully.
    Thank you!
    Now it worked perfectly
    I'll write a script that calculates the differences between the frames and then everything will be done through pushing a button. I do everything automatically with programming.

    It made perfect patch! Much better than ReplaceFramesMC
    Quote Quote  
  25. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    RemapFrames() and ReplaceFramesMC() work differently. RemapFrames replaces one frame with another frame. ReplaceFramesMC creates new frames using motion interpolation between existing frames.
    Quote Quote  
  26. Originally Posted by sanlyn View Post
    RemapFrames() and ReplaceFramesMC() work differently. RemapFrames replaces one frame with another frame. ReplaceFramesMC creates new frames using motion interpolation between existing frames.
    Yeah I know ..


    I made the tool!

    Image:

    Name:  55kp09.jpg
Views: 2442
Size:  9.9 KB
    Code:


    Code:
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    $Lsize = 24
    
    $Form1 = GUICreate("RemapFrames Tool", 213, 96, 934, 482)
    $Label1 = GUICtrlCreateLabel("Waiting", 16, 40, 176, 41, $SS_CENTER)
    GUICtrlSetFont(-1, $Lsize, 800, 0, "MS Sans Serif")
    $Input1 = GUICtrlCreateInput("0", 144, 8, 49, 21)
    $Label2 = GUICtrlCreateLabel("Fix:", 112, 8, 28, 24)
    GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
    GUISetState(@SW_SHOW)
    WinSetOnTop($Form1,"",1)
    
    Global $x,$Frame,$f1,$f2,$final
    
    $update = True
    $action = False
    $stage = 1
    
    While 1
    Sleep(50)
    $VBState = WinGetState("[CLASS:VirtualDub]", "")
    
    $Greed = GUICtrlRead($Label1)
    
    If $action = False Then
        If $Lsize <> 24 Then
            $Lsize = 24
            GUICtrlSetFont($Label1, $Lsize, 800, 0, "MS Sans Serif")
        EndIf
        If $VBState = 15 Then
            If $Greed <> "" Then
                GUICtrlSetData($Label1,"")
                HotKeySet("{SPACE}", "code")
            EndIf    
        ElseIf $VBState = 7 Then
            If $Greed <> "Waiting" Then
                GUICtrlSetData($Label1,"Waiting")
                HotKeySet("{SPACE}")
            EndIf
        ElseIf $VBState = 0 Then
            If $Greed <> "No VB" Then
                GUICtrlSetData($Label1,"No VB")
                HotKeySet("{SPACE}")
            EndIf
        EndIf
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    WEnd
    
    Func code()
    If $stage = 1 Then
        GetFrame()
        $f1 = $Frame
        GUICtrlSetData($Label1,$f1)
        $action = True
        $stage = 2
        Return $f1
    ElseIf $stage = 2 Then
        $fix = GUICtrlRead($Input1)
        GetFrame()
        $f2 = $Frame
        If $f1 = $f2 Then
        $y = $f1-$fix
        $final = $f1&" "&$y
        WriteMapFile()
        If $f1 >= 10000 Or $f2 >= 10000 Then $Lsize = 20
        GUICtrlSetFont($Label1, $Lsize, 800, 0, "MS Sans Serif")    
            For $i = 1 to 3    
                GUICtrlSetData($Label1,$final)
                Sleep(500)
                GUICtrlSetData($Label1,"")
                Sleep(500)
            Next
        ElseIf $f2 > $f1 Then
            $y1 = $f1-$fix
            $y2 = $f2-$fix
            $final = "["&$f1&" "&$f2&"]"&" "&"["&$y1&" "&$y2&"]"
            WriteMapFile()
            $Lsize = 10
            If $f1 >= 10000 Or $f2 >= 10000 Then $Lsize = 8
            GUICtrlSetFont($Label1, $Lsize, 800, 0, "MS Sans Serif")
            
            For $i = 1 to 3    
                GUICtrlSetData($Label1,$final)
                Sleep(500)
                GUICtrlSetData($Label1,"")
                Sleep(500)
            Next
        EndIf
        $action = False
        $stage = 1
    EndIf
    EndFunc    
    
    
    Func GetFrame()
    $Frame = ControlGetText("VirtualDub" & $x, "Frame", "Edit1")
    $Frame = StringTrimLeft($Frame, 6)
    $Frame = StringTrimRight($Frame, 18)
    Return $Frame    
    EndFunc
    
    Func WriteMapFile()
    $file = FileOpen("MapFile.txt", 1)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open MapFile.")
    Else
        FileWriteLine($file,$final)
        FileClose($file)
    EndIf
    EndFunc

    Instructions:
    Put in the "fix" the number represents the difference between the frames of video1 and video 2.

    If there is no difference then keep number 0.

    (I hope I understood.. my English is not perfect)

    Use the key - SPACE to perform the operation.
    Last edited by gil900; 2nd Oct 2012 at 10:49. Reason: code errors
    Quote Quote  
  27. How can I combine the code from here:
    https://forum.videohelp.com/threads/348054-Help-with-filtering-pictures-problems-from-V...=1#post2177383

    With this code?

    There are certain parts that have broken frames in the tow captures and can not be corrected by replacement..
    Quote Quote  
  28. Ok I succeeded ..
    this works:

    Code:
    BaseClip=Mpeg2Source("part 1.d2v")
    BaseClip=BaseClip.RemapFrames(mappings="
    [341 346] [154 159]
    [571 575] [384 388]
    ", SourceClip=Mpeg2Source("part 1 v2(r1).d2v"))
    
    
    function ReplaceFramesMC(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
     
        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)
    }
    
    
    
    ReplaceFramesMC(BaseClip,142,7)
    # reinterlace the video
    AssumeTFF()
    SeparateFields()
    Weave()
    Last edited by gil900; 2nd Oct 2012 at 15:19.
    Quote Quote  
  29. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by gil900 View Post
    Code:
    ReplaceFramesMC(BaseClip,142,7)
    # reinterlace the video
    AssumeTFF()
    SeparateFields()
    Weave()
    I don't see a de-interlace routine in your script. The last two lines above do unnecessary work. It finishes where it began and doesn't accomplish anything.
    Quote Quote  
  30. Banned
    Join Date
    Oct 2004
    Location
    New York, US
    Search Comp PM
    Originally Posted by gil900 View Post
    Code:
    ReplaceFramesMC(BaseClip,142,7)
    # reinterlace the video
    AssumeTFF()
    SeparateFields()
    Weave()
    I don't see a de-interlace routine in your script. The last two lines above do unnecessary work. They don't accomplish anything.
    Last edited by sanlyn; 4th Oct 2012 at 09:44.
    Quote Quote  



Similar Threads

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