Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
29th July 2009, 16:49 | #1 | Link |
Registered User
Join Date: Sep 2008
Posts: 21
|
Minimize the effect of "old" line on a cartoon
Hi, I encoded a DVD of an old cartoon to x264 (with megui an it's tools [d2v, etc]). The quality is excellent, but unfortunately, the DVD source has a white "line" or a line with artifacts every time the frames change to another scene (for example, a character is moving to the kitchen, and a few seconds later the video scene goes to outside the house. The frame between those scenes, have a line with artifacts)
I'd want to minimize the effect in those frames (that garbage line appears only in 1 frame), but not deleting the damaged frame because my audio can get unsynchronized with the video. I link here the frames which have that line: that thing is in every frame that is between two scenes, and so, they are a lot. Is there a solution for my problem? thanks! Last edited by Guest; 29th July 2009 at 17:14. |
29th July 2009, 18:02 | #3 | Link |
Registered User
Join Date: Sep 2008
Posts: 21
|
But I don't want to add a black line to the bottom... Should I crop that part?
I cropped my video, and it's 696x568 (AR 1:1). Is there any problem if I crop the VHS line? I've read that if you get a unusual resolution, some players could present error, is this true? thanks. |
29th July 2009, 18:07 | #4 | Link | |
契約者
Join Date: Jun 2008
Posts: 1,576
|
Quote:
|
|
29th July 2009, 18:29 | #6 | Link | |
Registered User
Join Date: Sep 2007
Location: Europe
Posts: 602
|
Quote:
Perhaps someone could write a filter that uses data from the previous frame (or the next frame, if the visible splice is at the start of a scene) to cover over this. The splices look like the least of that source's worries, though... |
|
29th July 2009, 18:51 | #7 | Link | |
Registered User
Join Date: Sep 2008
Posts: 21
|
Quote:
But is really annoying for the eye to see this thing flashing all the time =P Darkkurama |
|
30th July 2009, 07:14 | #8 | Link |
Registered User
Join Date: Jun 2009
Posts: 90
|
Cropping it out is probably the best solution. It's not as if the most critical information is going to be at the bottom of the frame so you are not really losing anything.
You could try playing around with MVTools to see if you can use the information from previous frames, I use something similar to remove dirt from film transfers based on the RemoveGrain and RemoveDirt plugins. My code probably wont work for your situation but you may be able to adapt it. Code:
function dedirt(clip, int limit) { super = clip.MSuper(pel=2) backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4) backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4) forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4) forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4) backward_motion2 = MFlow(clip, super, backward_vec2) backward_motion1 = MFlow(clip, super, backward_vec1) forward_motion1 = MFlow(clip, super, forward_vec1) forward_motion2 = MFlow(clip, super, forward_vec2) clp=interleave(forward_motion2, forward_motion1, clip, backward_motion1, backward_motion2) #remove dirt here clp=clp.RemoveDirt(limit) #clp=clp.despot() clp=clp.SelectEvery(5,2) return clp } function RemoveDirt(clip input, int limit) { clensed=Clense(input) alt=input.RemoveGrain(mode=2) return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=16) } |
30th July 2009, 15:21 | #10 | Link | |
Registered User
Join Date: Sep 2008
Posts: 21
|
Quote:
Thanks, but that would be a hard work, because there are many glitched frames. , and sorry for my english |
|
30th July 2009, 16:47 | #11 | Link |
Registered User
Join Date: Jun 2009
Posts: 90
|
I don't really understand it either, it's basically just the demo from the RemoveGrain website updated to use mvtools2. As far as I can tell it takes the data from 5 frames of video and if it finds an area affected by dirt then it replaces that data with the data from another frame. If your problem only occurs on 1 frame every so often then it should work, otherwise I would just crop it out.
|
30th July 2009, 17:12 | #12 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
30th July 2009, 19:16 | #13 | Link |
Registered User
Join Date: Sep 2008
Posts: 21
|
Wow! It's really amazing that .dll!
I applied it with a dfactor of 4.0, and it's almost perfect (the effect got "minimized", but not eliminated at all.) My avs: Code:
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\warpsharp.dll") Load_Stdcall_Plugin("C:\Program Files (x86)\megui\tools\yadif\yadif.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\RemoveDirtSSE2.dll") source = DGDecode_mpeg2source("D:\New\DVD.d2v", info=3).ColorMatrix(hints=true, interlaced=true, threads=0).Yadif(order=1).WarpSharp(depth=135, blur=4, bump=128) prev = source.selectevery(1,-1) next = source.selectevery(1,1) source.SCSelect(next,prev,source,dfactor=4.0) mergechroma(blur(1.3)) I've detected a "frameskip" when the dfactor is 2.0, but with 4.0 It's OK, What causes that frameskip (It's like the FPS have changed or something like that)? Thanks |
26th April 2013, 17:16 | #14 | Link |
Registered User
Join Date: Sep 2007
Location: Europe
Posts: 602
|
Sorry to bump this guys, I have a source that has visible splices at the bottom of the last frame in a scene, and at the top of the first frame in the next.
Fortunately, the splices are not so high, and the motion content of the film is quite... serene. One thing I would like to do is replace only the affected portions of the frame, rather than removing the entire frame. So I wrote this script which will only replace a portion of the frame. Can anyone suggest how I could add edge-feathering to this? Better yet would be edge feathering and some sort of motion compensation, but that's tricky... anyway, right now the replaced portions are quite obvious. Code:
#Replace the top 150px of the first frame in each scene with a duplicate of frame 2 in that scene. #Also replace the bottom 150px of the last frame in a scene with a duplicate of the frame before it. #needs edge feathering source=last prev = source.selectevery(1,-1) #Select the last frame before a scene-cut. prevSourceKeep = source.crop(0,0,-0,-150) #Keep the previous image but cut only the bottom 150px. prevCrop = prev.crop(0,930,-0,-0) #The portion with the splicemarks to be replaced. # #The "930" refers to cropping a 1080p height image: 1080 - the 150 we cropped = 930. # prevCombine = stackVertical(prevSourceKeep, prevCrop) next = source.selectevery(1,1) #select the first frame of a scene. nextSourceKeep = source.crop(0,160,-0,-0) #Keep the next image but cut only the top 160px. nextCrop = next.crop(0,0,-0,-920) #The portion with the splicemarks to be replaced. nextCombine = stackVertical(nextCrop, nextSourceKeep) source.SCSelect(nextCombine,prevCombine,source,dfactor=2.0) Last edited by Lyris; 26th April 2013 at 17:19. |
26th April 2013, 18:09 | #15 | Link |
Registered User
Join Date: Sep 2007
Location: Europe
Posts: 602
|
Here's an alternative: can anyone provide me with a script which will output only the frames surrounding the scenecuts? I could then output them as TIFFs with ImageWriter and do some work on them with Photoshop macros.
|
27th April 2013, 23:55 | #16 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
@Lyris
Code:
# Script to create command files for FrameSelect/FrameReplace, Last frame before scene change & 1st frame after. # Can examine metrics going backwards/forwards but output command files will be rubbish. # Making command files, Reload AVS if was jumping about, MUST play all the way through, NO JUMPING ABOUT, FORWARD ONLY. AVISource("D:\avs\test.avi").Killaudio() # SCThresh=80.0 # Scene change Threshold (about 80.0 seems very good for high/low motion). SHOW=True # Show metrics FAST=True # AssumeFPS 250.0 EXTRA=True # Create Extra command files for frame before PRE and frame after POST (for fixing PRE and POST in eg PhotoShop) # Top=32 # Crud (edges ignored in differencing) Bot=32 Lft=32 Rgt=32 # fn_Pre = "Pre.Txt" # FrameSelect/FrameReplace Command file for Last frame before scene change fn_Post = "Post.Txt" # FrameSelect/FrameReplace Command file for 1st frame after scene change fn_PrePre = "PrePre.Txt" # FrameSelect/FrameReplace Command file for frame BEFORE Last frame before scene change fn_PostPost = "PostPost.Txt"# FrameSelect/FrameReplace Command file for frame AFTER 1st frame after scene change (Exist(fn_Pre)) ? RT_FileDelete(fn_Pre) : NOP (Exist(fn_Post)) ? RT_FileDelete(fn_Post) : NOP (Exist(fn_PrePre)) ? RT_FileDelete(fn_PrePre) : NOP (Exist(fn_PostPost))? RT_FileDelete(fn_PostPost) : NOP B=0.0 C=0.0 sc=False Prev=-2 # Init vars CondS=""" # If jumped about, get values for Previous frame, else keep same. A=(current_frame!=Prev+1) ? RT_LumaSceneChange(Last,Last,n=current_frame-2,n2=current_frame-1,x=Lft,y=Top,w=-Rgt,h=-Bot) : A B=(current_frame!=Prev+1) ? RT_LumaSceneChange(Last,Last,n=current_frame-1,n2=current_frame,x=Lft,y=Top,w=-Rgt,h=-Bot) : B C=(current_frame!=Prev+1) ? RT_LumaSceneChange(Last,Last,n=current_frame,n2=current_frame+1,x=Lft,y=Top,w=-Rgt,h=-Bot) : C psc=(current_frame!=Prev+1) ? (B>=SCThresh && A<SCThresh && C<SCThresh) : sc # Pass the parcel A=B B=C C=RT_LumaSceneChange(Last,Last,n=current_frame+1,n2=current_frame+2,x=Lft,y=Top,w=-Rgt,h=-Bot) # diff(next,next+1) sc=(B>=SCThresh && A<SCThresh && C<SCThresh) (SHOW) ? Subtitle(String(current_frame)+"] "+String(A,"%6.2f")+" "+String(B,"%6.2f")+" "+String(C,"%6.2f")) :NOP (sc) ? RT_TxtWriteFile(String(current_frame),fn_Pre ,append=true) : NOP (sc&&EXTRA) ? RT_TxtWriteFile(String(current_frame-1),fn_PrePre ,append=true) : NOP (sc&&SHOW) ? Subtitle("END OF SCENE",align=1,size=30) : NOP (psc) ? RT_TxtWriteFile(String(current_frame),fn_Post,append=true) : NOP (psc&&EXTRA)? RT_TxtWriteFile(String(current_frame+1),fn_PostPost,append=true) : NOP (psc&&SHOW) ? Subtitle("START OF SCENE",align=3,size=30) : NOP Prev=current_frame Return Last """ ScriptClip(CondS) (FAST) ? AssumeFPS(250.0) : NOP return Last.ConvertToRGB32() Code:
# Script to Extract Last frame before scene change AVISource("D:\avs\test.avi") fn_Pre = "Pre.Txt" SHOW=False FrameSelect(cmd=Fn_Pre,show=SHOW) ConvertToRGB24() ImageWriter("PRE_",type="BMP") Code:
# Script to Extract 1st frame after scene change AVISource("D:\avs\test.avi") fn_Post = "Post.Txt" SHOW=False FrameSelect(cmd=Fn_Post,show=SHOW) ConvertToRGB24() ImageWriter("POST_",type="BMP") Code:
# Script to Extract the frame BEFORE the Last frame before scene change AVISource("D:\avs\test.avi") fn_PrePre = "PrePre.Txt" SHOW=False FrameSelect(cmd=Fn_PrePre,show=SHOW) ConvertToRGB24() ImageWriter("PREPRE_",type="BMP") Code:
# Script to Extract the frame AFTER the 1st frame after scene change AVISource("D:\avs\test.avi") fn_PostPost = "PostPost.Txt" SHOW=False FrameSelect(cmd=Fn_PostPost,show=SHOW) ConvertToRGB24() ImageWriter("POSTPOST_",type="BMP") Code:
# Script to replace frames back into original clip. C=AVISource("D:\avs\test.avi") SHOW=True PRE_N =RT_WriteFileList("PRE_*.BMP","TMP.LIST") # Pre Frames to get POST_N =RT_WriteFileList("POST_*.BMP","TMP.LIST") # Post Frames to get RT_FileDelete("TMP.LIST") Assert(PRE_N==POST_N,"pre-post frame count mismatch") PRE=ImageSource("PRE_%06d.BMP",start=0,end=PRE_N-1).ConvertToYV12() POST=ImageSource("POST_%06d.BMP",start=0,end=POST_N-1).ConvertToYV12() C=FrameReplace(C,PRE,CMD="PRE.TXT",show=SHOW) # Replace Pre frames FrameReplace(C,POST,CMD="POST.TXT",show=SHOW) # Replace Post frames return Last FrameSelect v1.02, added FrameReplace filter for above scripts. RT_LumaSceneChange added to RT_Stats v1.16.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 28th April 2013 at 22:45. |
28th April 2013, 04:49 | #17 | Link |
Registered User
Join Date: Sep 2007
Location: Europe
Posts: 602
|
Brilliant, thanks a ton!
Just one problem I'm running into. In the last script, the one which re-seats the modified frames into the file, I sometimes get black frames with this error: "ImageReader: raster sizes must be identical" Which is strange, because the resolution of the source clip and all the BMP files is 1920x1080. Any ideas? |
28th April 2013, 04:55 | #18 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
No idea here. Works fine on my test clip (only 640x400).
Does it work OK without editing the frames, ie scripts 1 through 4 in sequence without modding in Photoshop. Which version Avisynth you using ?
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 28th April 2013 at 05:06. |
28th April 2013, 05:07 | #19 | Link |
Registered User
Join Date: Sep 2007
Location: Europe
Posts: 602
|
2.5 - and yes, this is even before any modifications are made. Seems to be working at the moment though. Fingers crossed!
Even if I did have to resort to manually replacing some frames, your script is a huge help, so many thanks. |
28th April 2013, 05:09 | #20 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Think I once had a problem if Dots Per Inch were not all same (perhaps PhotoShop changes them).
(think it was DPI, changed by MS Office Picture Editor). EDIT: Above cross posted. EDIT: Think you can import series of Bitmaps into VDub current, perhaps can save as clip and hack script 4. EDIT: Perhaps BMP save/load broken, maybe try another format. EDIT: Would it be useful to have the frames BEFORE PRE and AFTER POST as well, for fixing damage ?
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 28th April 2013 at 09:07. |
Thread Tools | Search this Thread |
Display Modes | |
|
|