View Single Post
Old 5th October 2019, 01:40   #5  |  Link
Goggen240
Registered User
 
Join Date: Sep 2019
Posts: 14
Quote:
Originally Posted by shekh View Post
Example using blend layers:



You need to use "name output" to add options for input menu.
I'm not 99% sure "merge layers" does blend between input0 and input1 using input2 as blending factor in "lerp" mode, and that blending factor is threshold in "select" mode.

Btw this was actually implemented in original 1.10 and IMO this whole idea only reached prototype - very difficult to use in practice.

This works!
(Well, it's a flickery mess in a hopelessly complicated filter stack, but it's a horribly complicated blended flickery mess!)
And yes, the third layer does actually work as a mask.

See attachment


I've been using 1.9.11 for about 10 years, so a lot of the newer functions (Add Input) are new to me. They also do seem a bit poorly documented, unfortunately.
But thankfully this forum has helpful people like you!

What the heck I'm doing:
I have a 1280x720p25 file that was downscaled incorrectly from 1080i50:
Line 1: Field 2
Line 2: Field 2
Line 3: Field 1
Line 4: Field 1
And so on.
Obviously this can't be deinterlaced in this state.
So, step by step, the filter stack does this:
Step 1: Drop even lines, for step 3.
Step 2: Drop odd lines, for step 3.
Step 3: Combine both top lines to one field (odd lines) and both bottom lines to bottom field (even lines) at half resolution. (A simple downscale would blend all four lines together a little, which is worse.
Step 4: Deinterlace the half-resolution "reinterlaced" file, 2xYADIF (1280x360p50)
Step 5: Upscale to 1280x720p50
Step 6: Null Transform with an Output Name, for troubleshooting, not strictly necessary
Step 7: Load a separately made mask file for the merge layer filter, RGB24 uncompressed AVI, which is a 100GB 1280x720p50 video of alternating black lines, like so:
Odd frames:
White
White
Black
Black
Even frames:
Black
Black
White
White
This allows the appropriate original field lines to be blended on top of the downscaled deinterlaced video. That is: Odd frames; lines 3 and 4, even frames; line 1 and 2.
Step 8: I invert the mask because it's the wrong way around and I'm not sure why and it's late and I'm tired
Step 9: Null Transform with an Output Name, for troubleshooting, not strictly necessary
Step 10: I double the framerate of the original video from 720p25 to 720p50 so the framerate matches the new deinterlaced video, simply repeating each frame twice.
Step 11: Null Transform with an Output Name, for troubleshooting, not strictly necessary
Step 12: Finally, I merge the layers together:
First layer: The frame doubled video from step 10
Second layer: The upscaled (step 5) deinterlaced (step 1-4) video
Third layer: The mask that allows the original lines to be overlayed over the interpolated lines, where there are original lines to be had.

A lot of the filters (null transforms) and filter names/inputs are unnecessary so it can be streamlined a bunch.

I'm pretty sure flickeriness is happening in the downscale/upscale process; at half resolution it's looking at 3 vertical pixels for upscaling, which is actually 6 pixels because of the line doubling mess. Nearest neighbor doesn't look at enough pixels, though. Hmmm...
Or I messed up the mask. Or the deinterlace order. Or something else. I'll figure it out eventually!

I'm going to try to find the time to document some more of my deinterlacing experiments (and improve this one) so future generations of video restorers have a reference, now that I think I know how.
In case somebody else wants to rescue old messed up files, hopefully I'll be helpful too!
Attached Images
 

Last edited by Goggen240; 6th October 2019 at 00:38. Reason: more detail
Goggen240 is offline   Reply With Quote