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. |
9th November 2022, 18:01 | #1 | Link |
Registered User
Join Date: Dec 2018
Posts: 65
|
big green line removal with overlay mask possible?
hey there,
I'm dealing with a HD source which has 2 very annoying big green lines in it for about 10 minutes. Is there any way to get rid of that? Various versions of RemoveDirtMC were of course not able to filter that away and I doubt that anything is able to anyways so an overlay mask would be the only way. So I digitised and upscaled a VHS and made the frames match to the bluray. The lines move so they need to be used as the overlay mask but the problem is they're not always a lot brighter than the rest of the picture so the rest of the picture becomes the mask too. There's also the problem of the pictures not lining up exactly and them having different colors. If you could find a way to just use the green lines as the overlay mask it could maybe work. https://drive.google.com/file/d/1U4_...usp=share_link https://drive.google.com/file/d/1oIB...usp=share_link Thanks in advance for looking into it regards |
9th November 2022, 18:41 | #3 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,718
|
I didn't see any green line in the first sample.
The second sample has a green-tinted film scratch which wanders back and forth. I do lots of film restoration and scratches are notoriously difficult to remove digitally without a tremendous amount of frame-by-frame work or without some sort of object tracking that is beyond anything yet developed for AVISynth. You can always try the AVISynth Descratch filter, but I don't hold out much hope that it will work. [edit]I re-read the OP and realize you are talking about doing an overlay. Don't know how I missed that. So the real problem is auto-generating a mask based on the color and intensity of the scratches, and substituting your lower-res version into that portion of each frame. Others are better at writing masks than I am and I'm sure you'll get some help (you can also just search this forum and probably get the script you need). The script will also definitely need some way to feather the edges or else the substitution will call attention to itself. However, the much bigger problem is going to be alignment. I have done almost exactly what you are trying to do where I wanted to add or remove (can't remember which now) subtitles by substituting a lower-res version. The problem was that both the cropping and alignment between the two different sources changed, and also the editing on the two versions was subtly different so all of a sudden the two captures were several frames offset from each other. They also sometimes changed x,y, or rotational alignment with respect to each other. It required a LOT of manual work to finish the project. Last edited by johnmeyer; 9th November 2022 at 21:50. |
9th November 2022, 18:56 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
|
I'm not sure if this can help
https://forum.doom9.org/showthread.p...30#post1850330 I think its the script I was thinking of, but the images aren't available now [PostImages.org says server not available, however other images from there are available, so maybe just a single server (out of a cluster of servers) have problem.] I'm not gonna down 4.7GB, so cant test. You may have to turn clip sideways. EDIT: Maybe not that script. Seems that one is for temporal damage/repair. (temporal frame interpolation)
__________________
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; 9th November 2022 at 19:10. |
9th November 2022, 22:07 | #5 | Link |
Banana User
Join Date: Sep 2008
Posts: 1,045
|
Can you share less than 200MB samples?
__________________
InpaintDelogo, DoomDelogo, JerkyWEB Fixer, Standalone Faster-Whisper - AI subtitling |
9th November 2022, 23:37 | #6 | Link |
Registered User
Join Date: Dec 2018
Posts: 65
|
thanks for the posts so far guys. I tried to setup the latest dirtbox version of stainless but have no idea how to get it to work in avs+. It seems like RT-stats are the problem. Never used RT stats before would have to wrap my head around it
if you want to take a look at the actual videos here are some samples shrinked and kept short https://workupload.com/archive/6AqM9AmD Last edited by Metal-HTPC; 9th November 2022 at 23:48. |
10th November 2022, 05:46 | #7 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
|
Quote:
__________________
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 ??? |
|
10th November 2022, 18:17 | #9 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,718
|
My "replace bad frames" script is totally the wrong thing to be using here. That script was designed to detect, and optionally replace, a single bad frame, like a photographer's flash, or a dropout, or blank frame. Your green line persists and that is exactly what my script doesn't detect.
|
12th November 2022, 02:27 | #10 | Link |
Banana User
Join Date: Sep 2008
Posts: 1,045
|
Dunno what you want to overlay there because your both videos don't fit by geometry nor by colorimetry.
Anyway, here is mask and inpainted result from InpaintDelogo [frame 108]: Code:
LWLibAvVideoSource("D:\Enforcer-Dust-Linescene.avs.mov.mov.mkv") # Show=0 will do inpainting InpaintDelogo(Loc="0,0,-0,-0", Show=4, DynMask=2, \ DynTune=140, DynTuneInf=4, \ DynTEdge=1, DynTEdgeThY=25, DynTEdgeInf=4, \ DynColor=$4EBC80, DynColorTol=50, DynColorInf=4, \ DynInflate=3)
__________________
InpaintDelogo, DoomDelogo, JerkyWEB Fixer, Standalone Faster-Whisper - AI subtitling Last edited by VoodooFX; 12th November 2022 at 02:41. |
12th November 2022, 02:58 | #12 | Link |
Banana User
Join Date: Sep 2008
Posts: 1,045
|
So? It's to check how well green stripes are covered.
__________________
InpaintDelogo, DoomDelogo, JerkyWEB Fixer, Standalone Faster-Whisper - AI subtitling |
12th November 2022, 15:32 | #13 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,495
|
The problem with inpainting is that it is only working on a single frame and thus can't really find fitting content to place inside the removed content and 'guessing' a face isn't easy.
(sadly afaik none of the video inpainting techniques have are available in Vapoursynth or Avisynth) Vapoursynth script(https://pastebin.com/MzMvMAfC), using vsgan with an inpainting model (1x_NMKD-YandereInpaint_375000_G): Using cv_inpaint.InpaintShiftmap: Using cv_inpaint.InpaintFSR: Using cv_inpaint.InpaintTelea(clip, mask, 1): Using cv_inpaint.InpaintNS(clip, mask, 10): (script for the cv inpaint tests: https://pastebin.com/tLLjLg2c) => single image based inpainting fails Cu Selur Last edited by Selur; 12th November 2022 at 22:06. |
21st November 2022, 15:15 | #15 | Link |
Registered User
Join Date: Dec 2018
Posts: 65
|
thanks so far, yea I fixed single frames with cloning in ulead photo impact too but that was for a maximum of 120 frames. In this case I'm having 10 minutes which would be too much find to go through.
So I guess the line will remain then |
6th October 2023, 05:56 | #16 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,516
|
Quote:
Prefiltered with Spotless. Mask from InpaintDelogo above, and roughly painted in holes for coverage (I probably missed a few spots), fed into ProPainter cropped comparison video @ half speed https://www.mediafire.com/file/hi0pv...12fps.mp4/file Overall pretty good but some minor issues 1) window shutters a bit wobbly. I think algorithm is confused by the slightly shaky picture. I'm guessing prestabilizing would help. Not show heren, but FGT has stable shutters (but worse problems with other parts) 2) Left eye stays more open on frame 20/21. You would expect both eyes to be similar level of eyelid closing. But it's a fast head turn with the scratch obscuring those frames. There are dozens of machine learning temporal inpainting projects on github . The newest one, Propainter, is probably the best overall IMO, although FGT++ is supposed to be coming out soon with significant improvements. To list a few: https://github.com/sczhou/ProPainter https://github.com/hitachinsk/FGT https://github.com/nbei/Deep-Flow-Gu...deo-Inpainting https://github.com/MCG-NKU/E2FGVI https://github.com/seoungwugoh/opn-demo Various autosegmenting/automasking/autotracking machine learning algorithms exist - but the ones I've tried tend to work better on objects, not wandering, shape changing scratches like this. Or I haven't found any yet for this type of scratch pattern Some of the temporal inpainting algorithms have options like adjustable stride length, neighbor references length, iterations, lower precision (float16), internal mask and flow dilation mask parameters... you're often limited by GPU memory depending on the scene and settings . There are tradeoffs eg. If you reduce the references length to reduce memory consumption, you might miss out on usable data from nearby frames . Or if you use too long references , you might get worse results with contamination with slightly less similar data They are far from perfect, but the newest ones have significantly improved, especially Propainter, FGT. Useful tools in the pipeline for object/logo removal, clean plates, extrapolation - and you can fine tune the results in other programs |
|
6th October 2023, 06:18 | #18 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,718
|
Wow, I didn't think wandering vertical scratches could be removed algorithmically. Your demonstration is absolutely amazing.
I guess I need to get out of the dark ages and figure out how to use these newer tools. If I am understanding you, except for some prefiltering using AVISynth with a few plugins, this was all done in ProPainter, yes? |
6th October 2023, 13:18 | #20 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,516
|
Quote:
Another big problem for those types scratches is still identification and masking / propogation. I'm still looking for a suitable algorithm for wandering scratches that change shape like that. I'm guessing you need to train something specific for that case. For the fill part - it's actually better if the scratch moves / or camera moves / or BG elements move - because you have clean data in other frames. If nothing moved, you'd be basically spatial inpainting The way I see this: it's a timesaver over the old way of manually cloning and tracking textures from other frames to fix defects You probably missed: |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|