Go Back    Forum > Digital Video > Video Project Help > Restore, Filter, Improve Quality

Reply
 
LinkBack Thread Tools
  #1  
06-07-2017, 09:19 AM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
In the Restored version of the second clip, one frame is repeated a couple of frames later as the player crosses the top of the key. Seems to occur as a still frame in the Original.

There's also tearing, although it only affects one field and seems to come and go at random. Not sure if that's just how tearing is, or not. I've had other tapes tear but it's been consistent enough that I picked it up earlier on in the process.

In the first clip, in the Restored version, the edges of the numbers are doing something weird. Not really sure what's going on there.


Attached Files
File Type: avi Original.avi (72.71 MB, 36 downloads)
File Type: avi Restored.avi (81.51 MB, 29 downloads)
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
06-07-2017, 07:36 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Quote:
Originally Posted by koberulz View Post
In the Restored version of the second clip, one frame is repeated a couple of frames later as the player crosses the top of the key. Seems to occur as a still frame in the Original.

There's also tearing, although it only affects one field and seems to come and go at random. Not sure if that's just how tearing is, or not. I've had other tapes tear but it's been consistent enough that I picked it up earlier on in the process.

In the first clip, in the Restored version, the edges of the numbers are doing something weird. Not really sure what's going on there.
What's going on is that you have yet another godawful bad horrible ugly tape. Looks for all the world like a bad dupe. Whatever. Did the photog bother to get scenes in focus?

beginning in both of your samples has invalid levels. I didn't correct for that (you'd have to do it separately from other sections), I just worked with the second half. I don't know what you were trying to do with color on your restoral except replace a blue color cast with a brownish one. Likely it'll never look really great, the original chroma is a mess.

Code:
AviSource("path\to\Original.avi")
ColorYUV(off_u=-10,off_v=5,gain_v=15,gain_u=-20)
Levels(16,0.90,255, 16, 250, dither=true,coring=false)
ConvertToYV12(interlaced=true)
SmoothTweak(contrast=1.25)

AssumeTFF()
QTGMC(preset="medium",EZDenoise=6,denoiser="dfttest",ChromaMotion=true,\
   border=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3)
SelectOdd()
RemoveDirtMC(20,false)

### -- Name the last video version, and name an audio source)
Source=last
AudioSource=last

### -- Use Stab() to steady frame hops in Source master.
Source
Stab()

### Repair the skewed border at top 28 pixels of frames.
### Create 710x28 patches from the repaired frame, and
### ovberlay this repaired strip onto specific frames of
### new copies of the source. Many possible ways to do it.

Source1=last
b0=Source1
b01=Source1.ReplaceFramesMC(168,1).Crop(4,0,-6,-548)
b02=Overlay(b0,b01,x=4,y=0)
Source2=ReplaceFramesSimple(Source1,b02,mappings="168")

b0=Source2
b01=Source1.ReplaceFramesMC(209,1).Crop(6,0,-6,-548)
b02=Overlay(b0,b01,x=6,y=0)
Source3=ReplaceFramesSimple(Source2,b02,mappings="209")

b0=Source3
b01=Source1.ReplaceFramesMC(224,1).Crop(4,0,-6,-548)
b02=Overlay(b0,b01,x=4,y=0)
Source4=ReplaceFramesSimple(Source3,b02,mappings="224")

### Finish up the filtered source file.
Source4
MergeChroma(aWarpSharp2(depth=30))
LimitedSharpenFaster(edgemode=2)
KillAudio()
AudioDub(last,AudioSource)
Crop(10,4,-10,-10).AddBorders(10,6,10,8)

### RGB32 for VirtualDub color tweaks with curves and ColorMill ---
ConvertToRGB32(interlaced=false)
return last


Attached Files
File Type: mp4 Another_restore.mp4 (5.58 MB, 21 downloads)
File Type: vcf VirtualDub settings.vcf (3.6 KB, 6 downloads)

Last edited by sanlyn; 06-07-2017 at 08:24 PM.
Reply With Quote
  #3  
06-07-2017, 11:37 PM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Quote:
Originally Posted by sanlyn View Post
What's going on is that you have yet another godawful bad horrible ugly tape. Looks for all the world like a bad dupe. Whatever. Did the photog bother to get scenes in focus?
I love how you think these weren't shot by whoever they could find to volunteer for the job, usually a player from the squad who didn't make the team that week.

Quote:
beginning in both of your samples has invalid levels.
Where? I checked the restoration with ColorYUV and the luma values sit between 16 and 235 for all but a one-frame drop to 234.

Quote:
(you'd have to do it separately from other sections)
I don't understand what you mean by this.

Quote:
I don't know what you were trying to do with color on your restoral except replace a blue color cast with a brownish one.
Yours still looks pretty blue (reference attached). Even in mine the lines and the court two backboards are quite visibly blue...no idea what's going on there. I picked out the black team's jerseys, the referee's white shirts, and a neutral mid (I don't recall what, offhand), and fiddled with the balance until they were all correct. Then grabbed someone's arm for a hue adjustment.

Quote:
SelectOdd()
RemoveDirtMC(20,false)
What's this doing? You appear to be completely getting rid of one field, rather than working on each field separately?

Quote:
### -- Use Stab() to steady frame hops in Source master.
'Frame hops'?


Attached Images
File Type: jpg vlcsnap-2017-06-08-12h19m13s621.jpg (50.5 KB, 17 downloads)
Reply With Quote
  #4  
06-08-2017, 05:23 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
I realize your guys aren't pros with a camera, but it's difficult to conceive how the original you posted came straight from an unaltered camera tape. If the sample is what the camera produced, it's indeed a darn sorry camera, putting you through some very hard and mostly unnecessary work.

The court action scene is much darker than the opening sequence. If you want a more natural contrast range for that second scene, then the opening shot would be too bright. You would have to adjust the contrast range in those two shots separately.

Your restoration is too red, especially compared to the off-color tones in your posted reference. That poor VHS "reference" color rendering should never be used as a reference, which is supposed to be a view of known values produced under precisely controlled conditions. Neither of us has such a reference. In any case, I figured that some of the posters along the wall would be white-ish, especially the two "Winfield Stadium" signs and some of the floor markings, and I supposed there was mostly green and blue in the court surface, plus some people in the audience appeared to be wearing white-ish shirts and some blackish or bluish-jeans trousers (but all of the darks look like chocolate). I don't see any of that in your restoration, so I'm assuming the sample you posted refers mostly to the noise and distortion problems and has nothing to do with color balance. Such a discussion about color is pretty academic anyway -- there's no way you can get any color accuracy out of the original sample.
Reply With Quote
  #5  
06-08-2017, 09:04 AM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Quote:
Originally Posted by sanlyn View Post
I realize your guys aren't pros with a camera, but it's difficult to conceive how the original you posted came straight from an unaltered camera tape.
'Your guys'? Tape is older than I am, and probably originated with the other team (which, yes, makes it likely that this is a copy).

I dug up duplicates of some of the other tapes in the archive recently as well, so one or both versions of those must be copies as well.

I actually do this job for a club in a smaller league now, which gives me access to the online portal with all the games across the league. One was yellow. I can only assume they white-balanced for a night game and left the settings the same for a day game and some natural light got in and ruined it, but it looks absolutely awful.

Quote:
The court action scene is much darker than the opening sequence.
They're two clips from the middle of the game. They won't be the same shot, but it's just one camera being turned on and off based on whether the game is going on or not. The portion of that shot just before the move up to the scoreboard is lit almost identically to the second shot in my sample. So you'd have to fade/dissolve between two different brightness setups as the camera moves, or just blow out the scoreboard portion a bit. I'd favor the latter, given that 99% of the footage is of the game with only one or two moves up to the scoreboards.

Even then, mine is less blown out than yours; the world's most ironic no-smoking sign clips on your version.

Quote:
Your restoration is too red, especially compared to the off-color tones in your posted reference.
'Off-color tones'?

Quote:
That poor VHS "reference" color rendering should never be used as a reference, which is supposed to be a view of known values produced under precisely controlled conditions. Neither of us has such a reference.
Which makes what I've got better than nothing, at least. It's not even from the same year, but in the absence of alternatives it'll have to do. Certainly it's enough to indicate the court should be closer to green than blue.

Quote:
I'm assuming the sample you posted refers mostly to the noise and distortion problems and has nothing to do with color balance. Such a discussion about color is pretty academic anyway -- there's no way you can get any color accuracy out of the original sample.
If you want to critique the color balance, or anything else I don't mention, go ahead.

In terms of color, I think the biggest issue is actually the three-point line, rather than necessarily shooting for the most accuracy possible. In the original it's almost exactly the same color as the court, which I thought was just bizarre until I stumbled across that other footage and saw that the court was actually green. So I was shooting for the most contrast I could get between the three-point line and the court, within a range that made everything else look pretty much right.

I initially color-balanced the brights to the backboard against the wall, but that looked awful. I've found with some of these tapes that the lighting varies in such a way that it's often a waste of time to balance anything other than the players/referees and their uniforms, because that's where most of the footage is and everything else has some sort of cast.

I've attached a framegrab from Premiere of a zoom in on a couple of players, if that helps any.

EDIT: You missed my questions about 'frame hops' and the SelectOdd() lines.


Attached Images
File Type: png Color Correction Copy.Still003.png (637.0 KB, 4 downloads)
Reply With Quote
  #6  
06-08-2017, 11:50 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
No one's blaming you for the condition of the tapes. They're the owners' fault completely. I hope you've made aware of it. You're just doing the best you can with abused material.

The first thing I saw in the original was the obvious U/V imbalance. I elected to make an initial correction first in
YUV before going to RGB.



Initial YUV corection, before using RGB tweaks:



You can handle it any way you want, but I chose to correct in YUV first.

Quote:
Originally Posted by koberulz View Post
Quote:
(you'd have to do it separately from other sections)
I don't understand what you mean by this.
If you have a segment thast's crazy bright and the others are clearly, darker, you'll have to correct them separately to make levels match. In the correction business this is known as "color timing".

Quote:
Originally Posted by koberulz View Post
Quote:
SelectOdd()
RemoveDirtMC(20,false)
What's this doing? You appear to be completely getting rid of one field, rather than working on each field separately?
I did that for my own benefit, to take out at least 75% of the work of cleaning bad tracking fields. Almost all of the top tearing and backward-stepping fields are even fields. The even back-stepping fields indicate dropped fields. The result is 25fps progressive. If you like you can work through all original fields with all the bad frames at 50fps. But you can't use it for broadcast or disc authoring.

Quote:
Originally Posted by koberulz View Post
Quote:
### -- Use Stab() to steady frame hops in Source master.
'Frame hops'?
There are several instances of frame hop in the original -- actually, it's field hop, mostly even fields. Look at frame 208 in the original. Then play the restored version in VDub frame by frame and observe the vertical jitter (hopping).


Attached Images
File Type: jpg origial YUV.jpg (119.7 KB, 126 downloads)
File Type: jpg YUV initial correction.jpg (124.7 KB, 126 downloads)
Reply With Quote
  #7  
06-08-2017, 01:17 PM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Should UV necessarily be balanced, though? In this instance we know the court is somewhere between bluish green and green, and it takes up most of the picture, so wouldn't you expect the sort of thing shown in that first screengrab?
Reply With Quote
  #8  
06-08-2017, 01:24 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
In that particular YUV histogram, the closer the channels and peaks get tighter around the center mark, the closer the picture will be to a grayed-out look or will look almost monocolor. No, it's not necessary to perfectly center everything, especially since a nature pic will have a lot of green or blue sky. I adjusted until I got something more workable and realistic IMO. Not that this sample will ever look so "right". It's been through too much. I hate it when that happens, you just do what you can. 10 people will come up with 10 versions of those frames.

How you'll get that court to look like your reference is a mystery to me. Maybe reflecting lights and ceiling affect it here.
Reply With Quote
  #9  
06-08-2017, 03:13 PM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Quote:
Originally Posted by sanlyn View Post
No one's blaming you for the condition of the tapes. They're the owners' fault completely. I hope you've made aware of it.
Is there a 'them' missing after the 'you've'? If so, I'm not sure what you think that might achieve; everything's done digitally now (and as of a couple of years ago all games are televised, so no more amateur-hour garbage).

Quote:
If you have a segment thast's crazy bright and the others are clearly, darker, you'll have to correct them separately to make levels match. In the correction business this is known as "color timing".
As I said previously, it's all from the one camera and the only cuts are when it's turned off for timeouts and between quarters; there are no 'shots' or whatever that clearly need different settings. I can only assume some sort of auto brightness on the camera affects things when it shifts from the court to the scoreboard.

I'm still not sure why yours blows out the no-smoking sign...or why there's a no-smoking sign in a stadium that is otherwise covered in Winfield signage.


Quote:
If you like you can work through all original fields with all the bad frames at 50fps. But you can't use it for broadcast or disc authoring.
You'd just pull out the old SeparateFields().SelectEvery(4,0,3).Weave, yeah?

Quote:
There are several instances of frame hop in the original -- actually, it's field hop, mostly even fields. Look at frame 208 in the original. Then play the restored version in VDub frame by frame and observe the vertical jitter (hopping).
I'm not sure what I'm seeing in frame 208...it definitely looks 'off', but beyond that?

Quote:
Originally Posted by sanlyn View Post
In that particular YUV histogram, the closer the channels and peaks get tighter around the center mark
I'm not quite sure what you're saying here.

I think the scoreboard looks better on yours, but the court itself looks closer on mine (not that either is quite right). Not really a fan of the color of the ball on mine either. On the other hand, I don't want to lose any more of the three-point line than is absolutely necessary.

Quote:
How you'll get that court to look like your reference is a mystery to me. Maybe reflecting lights and ceiling affect it here.
Interesting you should mention reflections...there aren't really any. The reference clip makes it look quite glossy, whereas the tape I've got makes it look very matte. Almost like a tennis court surface. Which makes the game very painful to watch whenever someone gets knocked over or dives on a loose ball or anything like that.

I'm very much looking forward to a few years' time when I get to deal with TV broadcasts from stadiums with normal-colored wood floors.
Reply With Quote
  #10  
06-12-2017, 05:18 AM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
I've played around a bit with ColorYUV but I can't come up with anything better than my first attempt. My first go was even more red, my second had green skintones and no contrast at all between the blue and black jerseys.

Is there anything to be done about the whitish line down the side of the ref's arm in the attached clip? I've tried FixVHSOversharp(), dehalo_alpha() and LGhost(), although I'm not sure if this is something they target.


Attached Files
File Type: avi Test.avi (2.40 MB, 5 downloads)
Reply With Quote
  #11  
06-12-2017, 09:55 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
You won't get rid of all of that ringing, which makes a mild bright ghost, especially since the sample vid has already gone hrough processing. I used the following:

Code:
ConvertToYUY2(interlaced=false)
FixVHSOversharp(20,16,12)
FixVHSOversharp(20,8,4)
ConvertToYV12(interlaced=false)
MergeChroma(aWarpSharp2(depth=30))
Then I put the results in Virtualdub and used the exorcist anti-ghost filter:


Results:


Some fuzzy edges in that sample.


Attached Images
File Type: png exorcist.png (7.8 KB, 117 downloads)
File Type: jpg after.jpg (69.0 KB, 18 downloads)
Reply With Quote
  #12  
06-12-2017, 01:33 PM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Where did you get RemoveDirtMC()? I've found a RemoveDirtMC_SE(), but it requires NLMeansCL2(), which I can't find? There's a KNLMeansCL, and an xNLMeansCL, but that's it.
Reply With Quote
  #13  
06-12-2017, 01:47 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Quote:
Originally Posted by koberulz View Post
Where did you get RemoveDirtMC()? I've found a RemoveDirtMC_SE(), but it requires NLMeansCL2(), which I can't find? There's a KNLMeansCL, and an xNLMeansCL, but that's it.
The non-CLE version seen most often is by johnmeyer, from a very long post on videohelp and elsewhere. There's a link to that post in the attached .avs file, but the function is edited from the super-long script in the videohelp post. Some of the plugins used in that original long script will never be found again.

Hmm, wonder why the picture in my previous post doesn't show. Too busy to worry about it now.


Attached Files
File Type: avs RemoveDirtMC.avs (2.5 KB, 8 downloads)
Reply With Quote
  #14  
06-13-2017, 02:54 AM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
It shows up if you click the attachment at the bottom anyway, so it doesn't really matter.

Any idea what's going on in this one? Going through frame-by-frame the scoreboard appears to 'wobble' horizontally, while the rest of the picture seems okay.

I think I've figured out the color balance: the mids have to stay blue. If you adjust the mids to neutral, everything else gets ruined. So I adjusted the brights and darks to the scope, then just did the mids by eye.

EDIT: Why the horizontal crop on the tearing script?

EDIT 2: And what's the quickest/easiest way to establish the correct numbers for cropping?


Attached Files
File Type: avi ScoreboardMotion.avi (13.59 MB, 8 downloads)

Last edited by koberulz; 06-13-2017 at 03:28 AM.
Reply With Quote
  #15  
06-13-2017, 07:35 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Quote:
Originally Posted by koberulz View Post
Any idea what's going on in this one? Going through frame-by-frame the scoreboard appears to 'wobble' horizontally, while the rest of the picture seems okay.
It's not just the scoreboard. The top 1/3 of the image wiggles horizontally, including the yellow frame braces. I see this in many captures, especially tape dubs. It's usually from the tape, either from deformation or from the tape wiggling across the heads. Sometimes it's recorded that way. You'd have to look at the original interlaced frames to see what's going on. You sample has been deinterlaced. Watch the original in Virtualdub and enable VDub's yadif to see what the fields are doing. I see similar effects in many restorations, especially on TCM and other movie channels. There's an infamous scene in Hitchcock's The 69 Steps in a room where people are talking and a bright table lamp in the background is shifting around while everything else stays still.

Quote:
Originally Posted by koberulz View Post
I think I've figured out the color balance:....
The color is a mess, alright. I'v encountered this many times. I just adjusted U and V offset until the channels were better aligned and the white markings looked white. Sometimes it's more complicated.

Quote:
Originally Posted by koberulz View Post
Why the horizontal crop on the tearing script?
You mean post #2?
Quote:
Originally Posted by sanlyn View Post
Code:
### Finish up the filtered source file.
Source4
MergeChroma(aWarpSharp2(depth=30))
LimitedSharpenFaster(edgemode=2)
KillAudio()
AudioDub(last,AudioSource)
Crop(10,4,-10,-10).AddBorders(10,6,10,8)
The top and/or bottom borders change thickness during the frame hops and tears. Also, Stab() moves the frame up and down and changes the borders as well. You'd have to crop enough to mask the border twitter. Sometimes the results are thicker borders than in other segments, but it's usually a very small difference that's undetected during play. Either that, or you'd have to live with twittery borders, which I think looks worse and is more obvious.

Quote:
Originally Posted by koberulz View Post
what's the quickest/easiest way to establish the correct numbers for cropping?
I guess everyone has their own way of doing it. I run a clip hrough VirtualDub with no other filters going (sometimes just a quickie basic script with no filters except maybe Stab() running by itself). Then I load VDub's BorderControl filter, scroll through some video, adjust borders visually, then use those numbers to crop in Avisynth. Some people just use BorderControl on the output, but it's difficult to get the frame centered that way or they use overly thick borders to make it look centered.

If you use something more drastic like VDub's DeShaker for a wildly wobbling video, you have to run the filter, save the file, and adjust borders with another script.

Sometimes it's less complicated: running a script in Virtualdub, I pause on a frame and adjust Crop numbers, then hit F2 and reload the frame to check for effect. Sometimes you don't notice something is off until after the script has run and you're reviewing the work. Pain in the neck.
Reply With Quote
  #16  
06-13-2017, 07:49 AM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Quote:
Originally Posted by sanlyn View Post
Watch the original in Virtualdub and enable VDub's yadif to see what the fields are doing.
Filters->deinterlace->'interpolate using Yadif'?

Does it matter which Field order I use?

Quote:
I see similar effects in many restorations, especially on TCM and other movie channels. There's an infamous scene in Hitchcock's The 69 Steps in a room where people are talking and a bright table lamp in the background is shifting around while everything else stays still.
You mean 39 Steps?

I have a copy of that, not sure if I've ever watched it.

Quote:
You mean post #2?
I mean where you're going through and using ReplaceFramesMC to generate a piece to cover the tearing on bad frames. The vertical cropping is obviously to only replace the problem area, but I'm not sure why it's cropped four pixels from the left and six from the right.

My question about working out where to crop (in this case the amount to crop from the bottom) also related to this. I'm going through and there are a few standard dropouts, so I'm using the same script but they're obviously not in the same spot so I can't use your numbers and I'm not sure how to work out how far from the top/bottom of the screen to crop it so it covers the dropout without covering any more of the screen than necessary.


Quote:
Then I load VDub's BorderControl filter, scroll through some video, adjust borders visually, then use those numbers to crop in Avisynth. Some people just use BorderControl on the output, but it's difficult to get the frame centered that way or they use overly thick borders to make it look centered.
I don't have and have never heard of BorderControl. For that cropping I just open in VDub, apply a null transform, use VDub's cropping to adjust until I've obscured everything I want to be rid of, then add a 'resize' selecting 'crop/letterbox to size' by multiples of two.
Reply With Quote
  #17  
06-13-2017, 09:29 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Yeah, right, 39 steps not 69. My mind must have been elsewhere!.
The version I refer to is the Turner Classic Movies print, which looks to have been mastered from broadcast tape. I['d suspect something like a Criterion print to avoid that sort of thing. But maybe not.

Making and applying those little patches does depend on minimal motion. Unwanted motion like frame hopping is why I used Stab(). If I included running players and other objects it wouldn't have worked. I cut the edges short on the crop because I didn't include all of the side border area but you can if you want. I think one of those overlays had to be moved a pixel or so to one side, but it's hard to see during play. I write these coordinates down on a slip of paper while figuring it out and have to remember whether I'm cropping top, sides or bottom. It's kinda tricky and I make a lot of embarrassing (enfuriating) missteps. I tried the infamous median/averaging filter from lordsmurf but it did too much damage.

The border control plugin is here: http://www.hlinke.de/vdub-filter/brdcntrl235.zip. There are dozens (maybe hundreds) of little known and famous VDub filters here http://www.hlinke.de/tinc?key=U4rlLO...tualDub_Filter and here http://www.infognition.com/VirtualDubFilters/.
Reply With Quote
  #18  
06-13-2017, 11:17 PM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Quote:
Making and applying those little patches does depend on minimal motion. Unwanted motion like frame hopping is why I used Stab(). If I included running players and other objects it wouldn't have worked.
Why is that? Aren't you recreating the problem frames, rather than just pasting in a portion from a different frame?

Quote:
I write these coordinates down on a slip of paper while figuring it out and have to remember whether I'm cropping top, sides or bottom. It's kinda tricky and I make a lot of embarrassing (enfuriating) missteps.
How do you get the number in the first place, though? Just enter random numbers into the script until it works?
Reply With Quote
  #19  
06-14-2017, 10:36 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Quote:
Originally Posted by koberulz View Post
Quote:
Making and applying those little patches does depend on minimal motion. Unwanted motion like frame hopping is why I used Stab(). If I included running players and other objects it wouldn't have worked.
Why is that? Aren't you recreating the problem frames, rather than just pasting in a portion from a different frame?
The code that creates the patch interpolats a new frame using ReplaceFramesMC, from the preceding and following frames. But I didn't want to use the entire new frame (it didn't work very well). You just want a small part of it. You crop that new frame so that it includes only the part of the image you want, and you overlay that new portion onto the existing bad frame.

Example: the first full patch creation and overlay code sequence from the posted script:

Code:
Source1=last
b0=Source1
b01=Source1.ReplaceFramesMC(168,1).Crop(4,0,-6,-548)
b02=Overlay(b0,b01,x=4,y=0)
Source2=ReplaceFramesSimple(Source1,b02,mappings="168")
The first line creates a reference to the entire, original video and gives the reference the name of "source1":
Code:
Source1=last
The second line creates a work copy of the referenced video, for cropping and other work, and names it "b0" (the names of these working copies are arbitrary inventions, use whatever names you want):
Code:
b0=Source1
"b0" is now saved for a later step. The next thing to do is to make a new reference copy of the video that uses ReplaceFramesMC to interpolate a new frame, in this case frame 168. Then crop off the portion of the new frames that you want to keep, and save this new reference copy as "b01":
Code:
b01=Source1.ReplaceFramesMC(168,1).Crop(4,0,-6,-548)
The entire b01 reference video has all new frames that consist only of the smaller, cropped patches. We'll eliminate all those cropped-patch frames later, except for frame 168. For now, you want to overlay the original full-frame reference "b0" with all of those cropped patches from b01, and save these overlaid frames as new reference copy "b02". So this code overlays the full-frame b0 with cropped patches from b01 and uses x,y coordinates to place the patches where you want them, then saves the work as "b02":
Code:
b02=Overlay(b0,b01,x=4,y=0)
Obviously the only new overlaid frame or frames you want to keep would be frame 168 in this case. So you want to refer back to the original source1 and overlay that video with the repaired frame 168 patch from the collection of overlaid frames in b02. Save the new version of the repaired video as Source2:
Code:
Source2=ReplaceFramesSimple(Source1,b02,mappings="168")
Because there are other frames to repair, I keep saving new copies of the original video as Source2, Source3, etc., because if you keep loading Source1 with every repair you'll just reload the old bad frames. Yes, you can keep saving new frames to the same Source1 name, but the last line of the code gets pretty complicated with each fix. I prefer to increment the names of the new repaired video.

Quote:
Originally Posted by koberulz View Post
Quote:
I write these coordinates down on a slip of paper while figuring it out and have to remember whether I'm cropping top, sides or bottom. It's kinda tricky and I make a lot of embarrassing (enfuriating) missteps.
How do you get the number in the first place, though? Just enter random numbers into the script until it works?
The video ws first deinterlaced and Stab() was used to steady some frame hops, which usually happened on those torn frames. I repaired and evened the jittery borders created by Stab. Then I captured the frame in VirtualDub and pasted it as a new graphic in Photoshop. You can also use any graphics programs that lets you read coordinates as the mouse moves (Mspaint's status bar, for one, reads mouse coordinates).

You read the coordinates for left top, right top, left bottom, right bottom. Because you're building a rectangle which in this case has to be mod-2 for deinterlaced YUV, the left top and right top (x coordinates) will be different because of the width. The bottom (y-coordinates) will be the same because of the height.

Below, the original deinterlaced and Stab'd frame 168 with new borders and the top border rip marked with arrows:



The coordinates for cropping the section I wanted were in the Crop() function as (4,0,-6,-548). That function starts at x=4 at the left in the image, then removes 6 pixels from the right end. The height starts at pixel x=0 in the image, then removes 548 pixels from the original 576-pixel height. The result after cropping was a rectangle, 710 pixels wide by 28 pixels high. In this case I could just as easily have made the width a full 720 pixels, but I didn't need to repair the black top or side borders.

The repaired 710x28 cropped patch from frame 168:



The patch was overlaid onto the video in the top right position at x=4, y=0 from which it was taken.

You could also just use ReplaceFramesMC on the whole frame, but you'd have to live with a ton of bizarre motion artifacts especially with the fast moving players. This codde can also replace multiple bad spots in a frame with smaller patches, which I once used to repair some very bad comets that refused to go sway. The code below just uses Crop to "cannibalize" some small but good spot areas from a previous frame and overlay them onto the offending frame in a slightly different position:

Code:
b0=a6
b01=a2.Crop(616,300,-12,-170) # <- take top spot from here
b02=a2.Crop(612,322,-18,-152) # <- take middle spot from here
b03=Overlay(b0,b01,x=616,y=290) # <- put top spot here
b04=Overlay(b03,b02,x=612,y=316) # <- put middle spot here
a7=ReplaceFramesSimple(a6,b04,mappings="6663")
I've had videos that used dozens and dozens of these overlay patches. Yes, indeed, one of those caps took a very long time and I really despised that horrible video.


Attached Images
File Type: jpg original frame 168 after Stab.jpg (99.3 KB, 113 downloads)
File Type: jpg cropped patch from frame 168.jpg (7.6 KB, 114 downloads)
Reply With Quote
  #20  
06-14-2017, 12:11 PM
koberulz koberulz is offline
Premium Member
 
Join Date: Feb 2016
Location: Perth, Australia
Posts: 453
Thanked 3 Times in 2 Posts
Quote:
Originally Posted by sanlyn View Post
The code that creates the patch interpolats a new frame using ReplaceFramesMC, from the preceding and following frames. But I didn't want to use the entire new frame (it didn't work very well). You just want a small part of it. You crop that new frame so that it includes only the part of the image you want, and you overlay that new portion onto the existing bad frame.
Right, I understand what it's doing. But I'm not sure how it follows that you'll need minimal movement - as you say, you're using patches so you don't have to deal with the issues that come from replacing the whole frame.

Quote:
the left top and right top (x coordinates) will be different because of the width. The bottom (y-coordinates) will be the same because of the height.
...huh?

Quote:
I've had videos that used dozens and dozens of these overlay patches. Yes, indeed, one of those caps took a very long time and I really despised that horrible video.
FixRips + After Effects seems like an easier solution to such cases...
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Super black and white pixels / lines in lower field (only) of VHS capture ctrl-z Restore, Filter, Improve Quality 11 07-26-2015 03:23 PM
Please help to persuade VLC to fix field order metaleonid General Discussion 2 10-02-2013 05:33 PM
Wobbly/Out of phase VHS audio-Caused by tension error? Belmont Capture, Record, Transfer 3 04-25-2012 06:14 PM
Field Dominance / Field Order (Top or Bottom) deter Encode, Convert for discs 1 12-18-2011 10:35 PM
Remove extra lines (empty lines) from copied/pasted text with Notepad++ kpmedia Computers 1 10-07-2011 05:32 PM




 
All times are GMT -5. The time now is 11:29 PM