View Full Version : Need help to clean this video *images inside*
solvalou
19th July 2004, 22:54
Im dealing with a video that was originally progressive but was poorly mastered interlaced so what happens is that it has a lot of bad frames that show a kind of a comb effect when it should be a clean progressive frame. You will find an example below.
Is there any way of removing that "ghost" effect without altering the image detail ?
any help will be greatly apreciated
interlaced frame:
http://premium.uploadit.org/phantastica/interlaced.jpg
frame that should be clean (check the combed ghost effect beside the horses):
http://premium.uploadit.org/phantastica/clean.jpg
Leak
19th July 2004, 23:53
Originally posted by solvalou
Im dealing with a video that was originally progressive but was poorly mastered interlaced so what happens is that it has a lot of bad frames that show a kind of a comb effect when it should be a clean progressive frame. You will find an example below.
Is there any way of removing that "ghost" effect without altering the image detail ?
I'm not sure what can be done here, but if you run the following through AviSynth you clearly see that the fields themselves already contain those shadows, so there's no way deinterlacing alone will eliminate them...
ImageSource("interlaced.jpg",0,0)
AddBorders(0,0,1,1)
AssumeFrameBased()
SeparateFields()
np: Sixtoo - Storm Clouds & Silver Linings (Chewing On Glass & Other Miracle Cures)
scharfis_brain
20th July 2004, 00:18
provide an unmodified 100 frames (at least) clip.
if it is a DVD, use chopperXP or something similar to cut out a sample.
I think, it contains fieldblending.
so doing further assumptions is just a waste of time here, until we see a sample vid. ...
kassandro
20th July 2004, 00:21
Originally posted by Leak
I'm not sure what can be done here, but if you run the following through AviSynth you clearly see that the fields themselves already contain those shadows, so there's no way deinterlacing alone will eliminate them...
You may be wrong here. The shadows may be a consequence of jpeg compression. One should never compress a combed picture with JPEG. Simply spoken, JPEG treats field discontinuity very poorly. Use PNG instead.
Now to solvalou's problem. If these combs are on all frames with motion, then the following script function works quite well
function ShiftFields(clip input)
{
input = AssumeTFF(input)
sep = SeparateFields(input)
sep = trim(sep, 1,0)
return weave(sep)
}
This is for top field first source. If you have bottom field first, replace AssumeTFF by AssumeBFF. If some motion frames are correct and others are combed, then it gets complicated. If this happens in a periodic way, then the video is probably telecined and you have to ivtc it. If it is aperiodic, you may use trbarry's Uncomb, which is not perfect, but I cannot come up with a better solution until now.
Leak
20th July 2004, 00:35
Originally posted by kassandro
You may be wrong here. The shadows may be a consequence of jpeg compression. One should never compress a combed picture with JPEG. Simply spoken, JPEG treats field discontinuity very poorly. Use PNG instead.
Yes, it does, but take a close look at the gap between the horses in the combed picture and you'll see a faint ghost where there's no horse in either of the weaved fields, but rather where the horse will be if the camera pans further in the next frame - that can't be the JPEG artifact you describe.
EDIT: Now if that wasn't a mid-air collision with Scharfi's post... ;)
np: Radiohead - Gagging Order (Com Lag (2+2=5))
scharfis_brain
20th July 2004, 00:37
I think, that your shiftfields() function does this in short:
assumetff().separatefields().deleteframe(0).weave()
which means, it reverses the fieldorder, like:
assumetff().doubleweave().selectodd()
but, I doubt, that this would helb here.
and no kassandro, JPEG compression is okay for combed images, IF the color subsampling of JPEG is set to 4:4:4. (in photoshop: go above quality 50!)
if you reduce the 2nd picture by half size using simple pixel discarging, you'll clearly see a blend.
as I said, we need a sample for further testing.
kassandro
20th July 2004, 01:07
Originally posted by scharfis_brain
I think, that your shiftfields() function does this in short:
assumetff().separatefields().deleteframe(0).weave()
which means, it reverses the fieldorder, like:
assumetff().doubleweave().selectodd()
but, I doubt, that this would helb here.
Yes, it reverses the field order, but for a truely progressive clip field order doesn't matter. Only if you have some kind of field difference, you need to know, which field comes first. According my experience in german satellite tv for more than 50%
improperly mastered progressive videos all frames are wrong and then my simple function ShiftFields works a lot better than Uncomb.
and no kassandro, JPEG compression is okay for combed images, IF the color subsampling of JPEG is set to 4:4:4. (in photoshop: go above quality 50!)
I didn't know that and I can't really believe it, because it is completely against the DCT philosophy, which was born with JPEG. If it wouldn't mess up combs, then it couldn't exploit any vertical continuity either. What a poor compression technique!
scharfis_brain
20th July 2004, 01:22
high contrasted combs are preserved with JPEG, if a high enough quality level is choosen.
the pics above are NOT visually influenced by JPEG.
solvalou
20th July 2004, 06:21
ok i used chopperxp to cut 2 movie sequences.
Actually the source is hybrid because DVD2AVI detected 84% video .. I was wondering why they do a hybrid encode for a pure progressive material. Anyways I chopped 2 samples, one from the horses (progressive) and one from another part (interlaced). On both samples you can see that ghost/shadow effect.
Click here to download (http://home.ripway.com/2004-1/61792/sample.rar)
thanks for helping !
btw: kinda off topic but why is it that when I use avisynth to playback the .d2v of the horses vob it playbacks interlaced (like on the first picture above) ?
scharfis_brain
20th July 2004, 11:37
okay, no blending at all, but huge crappy-denoiser leftovers.
they produce the light combs on the decimated image...
all you can do is:
- decimate your source to 24fps
- apply some vertical blur:
either using : blur(0,1).blur(0,-0.7)
or: lanczos4resize(width,height*3/4).lanczos4resize(width,height)
morsa
20th July 2004, 12:12
Doesn't the Vdub Exorcist plugin work for this?
It is for removing ghosts...
scharfis_brain
20th July 2004, 12:19
the exorcist plugin has been made for spatial ghosts, that are typical for analogue terrestrical transmision.
but it will NOT work in the temporal domain.
it is not intended to remove denoiser leftovers.
Didée
20th July 2004, 13:12
Which reminds me once more of some analogy:
If a source was spatially blurred or softened, then the process can (partially!) reversed by applying a spatial sharpener again.
Could it be possible to get something useful out of a "temporal sharpener"? Of course only IF the source was temporally smoothed before.
Something between the lines of
input = last
temporal = input.temporalsoften(whatever)
tempdiff = subtract( temporal, input )
antitemporal = subtract( input, tempdiff )
Hmmh ... probably not a good idea to apply temporalsoften again to get the mask.
Better would be, measure the per-pixel-difference between past/current/next, and then build the "tempdiff" mask out of those values.
Should be worth at least a try, but I can't do that now.
- Didée
scharfis_brain
20th July 2004, 13:39
I've made a temporal deghoster:
loadplugin("c:\x\dgdecode.dll")
loadplugin("c:\x\avisynth_c.dll")
loadCplugin("c:\x\smartdecimate.dll")
mpeg2source("walking.d2v")
converttoyuy2(interlaced=true)
a=smartdecimate(24,60,tel=1.0)
# remove the combs by vertical blur
b=a.lanczos4resize(width,height*3/4).lanczos4resize(width,height)
# w is the factor to remove the ghosts set it between 0.7 (over strong removal) and 1 (no removal)
w=0.9
c=overlay(b.invert().duplicateframe(0),b,opacity=w)
c=c.levels(round((1-w)*255),1,round(255*w),0,255).subtitle("deghost")
#show before & after side by side
stackhorizontal(a,c).bilinearresize(1152,height)
but it is pretty bad, cause the denoiser works non-linear
(didée, you're mor familar with such tweaks so I think you could make a better solution)
solvalou
21st July 2004, 00:28
Hi. Thanks for helping. I did some tests with your script and I got good results with laczos4resize (it doesnt remove the ghost but removes the comb effect of the ghost) but the other part of the script is weird.. sometimes it removes the ghost pretty well and other times it adds a bright ghost. I put some images below for you to see and also a new clip.
Download new clip (http://home.ripway.com/2004-1/61792/sofa.rar)
Is it possible to remove that color cycle that happens on "lines" like just below her eyes on this screencap ?
http://premium.uploadit.org/phantastica/sample1.jpg
Here you see that it removes the left leg quite well but adds a bright ghost on the right leg.
http://premium.uploadit.org/phantastica/sample2.jpg
And here you see that it creates a bright ghost from nothing.. really strange.
http://premium.uploadit.org/phantastica/sample3.jpg
scharfis_brain
21st July 2004, 00:40
never said it would be perfect.
I could not find a rule, which defines,whether a ghost appers or not. it seem a little bit irregular.
also the strenght of the ghost varies, so a fixed value (w) is not sufficient....
maybe didée has a better idea
Leak
21st July 2004, 01:04
Originally posted by solvalou
Is it possible to remove that color cycle that happens on "lines" like just below her eyes on this screencap ?
Well, those cycling colors are usually called "rainbows" and are mostly caused by improperly handling analog video - I posted about a way to reduce those rainbows here (http://forum.doom9.org/showthread.php?threadid=79144), and immediately got real loads of feedback (:D) but you probably might want to give it a try; the script in that thread also has it's own fieldmatcher that might do the trick for your ghosts as well - at the very least it should give you blends instead of combs, which are less ugly IMHO.
np: John Hughes - Counting Backwards (Bogdan Raczynski Remix) (Immediate Action comp.)
MasterYoshidino
21st July 2004, 08:18
That's the exact same type of artifact one gets when using temporal filters that can clean frames in the future (and ghost them). Good example of one is temporalsoften set to very high thresholds. Darn those studios and their lame attempts at cleaning up a vhs master.
Didée
21st July 2004, 08:24
Originally posted by scharfis_brain
maybe didée has a better idea
No, he has not. He played half an hour with the samples, got pretty deep folds in the forehead, and then had to leave off. Sorry.
- Didée
solvalou
21st July 2004, 14:36
@leak I tried your filter and it removed the rainbow effect nicely.. the problem is that its very slow so my encode would take like 2 days and also ii cant open it in ccesp it says like unsupported framerate...
anyways thanks to all for helping im gonna stick to laczos4resize so at least I can remove the comb effect of the ghost.
Leak
21st July 2004, 15:13
Originally posted by solvalou
@leak I tried your filter and it removed the rainbow effect nicely.. the problem is that its very slow so my encode would take like 2 days and also ii cant open it in ccesp it says like unsupported framerate...
That's strange - leaving VirtualDub's preview window running a few minutes with my Armitage III DVD tells me it's going to take ~9 hours, which isn't to bad IMHO for 2 hours and 15 minutes of video. That's on my P4 2.4Ghz - what are you using?
Then again, I'm just setting up VC6 as I want to pour that script into a proper AviSynth plugin, which should speed things up a bit.
That unsupported framerate thing is strange, maybe an AssumeFPS(23.976) at the end fixes it? Or does CCE only take 29.97 FPS video? (Can't think of a reason why it would, though... in that case you'd have to re-do the telecine in AviSynth instead of CCE flagging the MPEG stream properly...)
np: Ricardo Villalobos - Dexter (Erlend Oye - DJ-Kicks)
DarkNite
22nd July 2004, 03:15
Originally posted by Leak
Then again, I'm just setting up VC6 as I want to pour that script into a proper AviSynth plugin, which should speed things up a bit.
That would be nice. I've found it quite useful as of late. :)
Although, to be fair, bifrost handled the rainbowing as well.
/me returns to waiting for the day of telecine's extinction (would that be mass telecide?)
Leak
26th July 2004, 00:37
Originally posted by DarkNite
That would be nice. I've found it quite useful as of late. :)
Well, it's still missing the de-rainbowing, but other than that it's working and it's quite a bit faster than my script:
BlendBob AviSynth plugin (http://forum.doom9.org/showthread.php?s=&threadid=80289)
Although, to be fair, bifrost handled the rainbowing as well.
Well, reading up on it it seems that bifrost does it's derainbowing in the temporal domain (and thus probably needs a frame or two to kick in), while my script solely works on 2 fields of the same frame (that's why I've incorporated it into my fieldmatcher; I have to be sure that the fields match so I can be sure that the only chroma change between the fields must be the rainbows...).
Actually, now that I've read the docs of Bifrost I see that I'm actually doing almost the same thing, but without the need for using YATTA (which I could never get the hang of, thus my BlendBob plugin :D).
My plugin is probably missing an option to turn off frame matching in case the source isn't telecined (even though the frame matching should be right in most cases), but other than that it should work as well... and perhaps I should add an option to choose the match with a higher chroma difference if luma differences are almost the same; I'm only handling the case where the rainbowing was added after the telecine currently.
/me returns to waiting for the day of telecine's extinction (would that be mass telecide?)
Probably... :)
Not that that would be a bad thing; we've had multisync screens for computers since ages and TV is still stuck in fixed-refresh-rate land... :(
np: Alter Ego - Beat The Bush (Transphormer)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.