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 ..
+ Reply to Thread
Results 1 to 30 of 52
-
-
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 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")
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
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
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
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
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
Last edited by sanlyn; 20th Sep 2012 at 07:36.
-
-
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. -
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.
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
-
-
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 capturesLast edited by gil900; 26th Sep 2012 at 09:44.
-
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. -
-
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.
-
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? -
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()
Code:last = AviSource("filename.avi") last = Greyscale(last) return(last)
Last edited by jagabo; 28th Sep 2012 at 12:26.
-
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
-
Last edited by sanlyn; 1st Oct 2012 at 21:09.
-
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 ... -
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
-
-
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:
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
-
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.. -
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.
-
-
Last edited by sanlyn; 4th Oct 2012 at 09:44.
Similar Threads
-
Witch the best way to convert a BluRay Movie to MKV ( size DVD9 or else)
By siopilos in forum Blu-ray RippingReplies: 9Last Post: 12th Feb 2012, 20:59 -
the wicked witch is dead!!!
By deadrats in forum Off topicReplies: 3Last Post: 25th Aug 2011, 02:31 -
Is there a software or plugin?
By schematic2 in forum Newbie / General discussionsReplies: 4Last Post: 18th Mar 2011, 20:43 -
In witch way can i export subtitles from a xvid(avi) or x264 file?
By siopilos in forum SubtitleReplies: 1Last Post: 21st Jul 2008, 09:49 -
Witch format for viewing video on Sony-Ericsson p990?
By ptrlks in forum Portable VideoReplies: 6Last Post: 14th Apr 2008, 22:26