Log in

View Full Version : Worst blending ever!


Floatingshed
25th November 2015, 18:11
I am doing some work on a telerecording (kinescope in US).

Basically a film recording of a tv screen. Every time there is a scene/shot change there is very nasty blending which gives the impression of the shots morphing rather than the intended cut.

Generally each "cut" takes three frames, I have experimented with manually trimming a few and it works well with minimal audio disruption, but a less hands-on approach would be good.

Does anyone have any suggestions for a starting point?

Here's a one second clip! It should be enough.

Thanks.

https://www.mediafire.com/?p85f5sar45autrw

johnmeyer
25th November 2015, 18:55
First of all, I couldn't even see it when I initially played it in my media player. It wasn't until I brought it into my NLE and walked frame-by-frame that I saw the problem.

So, my first advice is to do nothing.

However, if you really want to do something, even though you'll have to re-encode, here's how I'd do it. This approach will not require any re-syncing, because you'll end up with the same number of frames.

I'd use a good scene detection script (I have half a dozen), and when you detect a scene change, use a WriteIf statement to replace the current frame with the previous one. With progressive film, you'll never detect a duplicate frame at a scene change boundary. Heck, I do restoration for a living so I'm reasonably sensitive to things, and I didn't even see the blended frame until I slowed down the film. The visual disturbance of the scene change can mask a lot of minor issues, like this one.

Floatingshed
25th November 2015, 19:10
Thanks, but what I didn't say, in the interests of clarity, was that the final version gets interpolated to restore the original look of studio VT. The interpolation creates fields between the blends and makes it almost into a mix, well more of a morph.
Once I know it's there I spot it all the time!

Can I possibly have a play with a scene change detection script that may help?

Thanks.

johnmeyer
25th November 2015, 20:54
No time to put together something with really good scene detection, but this works on your sample, and illustrates the concept. This one actually replaces the scene blend with the first frame of the new scene. You can change the trim() logic if you want to use the previous frame.

#Script to replace frames at scene changes

global scenethreshold=15

source=AVISource("E:\fs.avi")
# Temporarily un-comment next line to display the average luma value on screen to help determine threshold value
#ScriptClip(source,"Subtitle(String(YDifferenceToNext(source) ))" )

fixed = ConditionalFilter(source, trim(source,1,0), source, "YDifferenceToNext()>scenethreshold", "greaterthan", "0")

return fixed

I've done a lot of kinescope conversions, to make them look like the original video. I assume you are doing all the dirt removal, grain reduction, stabilization, etc. VideoFred's film restoration scripts can really help.

Floatingshed
25th November 2015, 21:09
Yes, I'm using your modified scripts. I have been for some time and getting very good results... Thank You!

I will play with the above script tomorrow, thanks.

One other question. Often there is damage to only a portion of a frame and sometimes it is in a static area. At the moment I manually repair the frame by cloning from an adjacent frame using a paint program, but I wonder if there is a script that can make this easier...

manono
25th November 2015, 21:49
Often there is damage to only a portion of a frame and sometimes it is in a static area. ... but I wonder if there is a script that can make this easier...
I interpolate portions of a frame or frames using a couple of ways:

A=Last
B=ReplaceFramesMC(7010,4)
B=B.Crop(510,0,0,-210)
Overlay(A,B,510,0)

That says to interpolate four frames beginning with #7010 to the right of 510 and above 210 (the upper right corner). It can also be modified to use FreezeFrame or the BadFrames filter in place of ReplaceFramesMC when the section needing work is truly static. It needs an additional line for that. The other is with a mask:

A=Last
B=A.ReplaceFramesMC(500,6)
Mask=ImageSource("Swim.bmp")
Overlay(A,B,0,0,Mask)

That says to interpolate everything in white (around the black center part) for six frames beginning with frame #500. The mask used (converted to JPG for the smaller size) is shown at the bottom of the post. The ReplaceFramesMC function is from jagabo at videohelp.com and modified from other frame interpolators developed here. It's found just below:

function ReplaceFramesMC(clip Source, int N, int X)
{
# Replace X frames, starting at N, with motion interpolated frames
# 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(pel=2, hpad=0, vpad=0, rfilter=4)
backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24))
backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3)
forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3)
backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3)
forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3)
MBlockFps(super, backward_3, forward_3, num=X+1, den=1, mode=0)

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)
}

function InsertFramesMC(clip Source, int N, int X)
{
# Insert X motion interpolated frames at N
# N is the insertion point
# X is the number of frames to insert
# the frames will be interpolated with Source frames N-1 and N as references

loop(Source, X+1, N, N)
ReplaceFramesMC(N, X)
}
I forget what it needs, the usual interpolation filters, MVTools2, I think.

I've got a good one for around scene changes, too, but you have to find them manually and I got the impression you weren't interested in doing that. It uses a combination of Freezeframe and frame interpolation to remove blends or corruption/artifacts at scene changes from as far away as three frames on either side of the scene change.

Floatingshed
26th November 2015, 15:37
Thanks for this, can't wait to play!