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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd August 2011, 08:07   #1  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Type of sources

Sorry to bother but, what is this?
Telecine, hybrid, progressive? Most of the source is slow pans, zooms where I see no interlacing or stutter...

65Mb
http://www.mediafire.com/?a7yw57ft1i65p52

This is DGindex log:

Code:
Stream Type: MPEG2 Program
Profile: main@main
Frame Size: 720x480
Display Size: 720x480
Aspect Ratio: 4:3 [2]
Frame Rate: 29.970030 fps
Video Type: NTSC
Frame Type: Interlaced
Coding Type: B
Colorimetry: SMPTE 170M
Frame Structure: Frame
edit: bob-deinterlace produces ugly artifacts (specially on zooms) and some local blending.


Here is another source, which I think is field blended telecine, is there any way to recover this? I also see left over combed frames, could this be interlaced too?

4 Mb
http://www.mediafire.com/?h12ccly94edg249
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 5th August 2011 at 20:54.
Dogway is offline   Reply With Quote
Old 5th August 2011, 20:50   #2  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Anyone please? is it fu material or are them fixeable? should I make another thread for the second sample?
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 5th August 2011, 23:24   #3  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
For the first sample, it's 100 % interlaced. I think QTGMC().SelectEven() is your best bet, despite a bit of ghosting. The parity gets reversed at some moment on the scene with the flag, so you'll have to take care of that too.

For the second funny sample, you could try something like this:
Code:
FFVideoSource ("VTS_02_0.demuxed.m2v")

x01 = SelectEvery (5, 0)
x67 = SelectEvery (5, 3)
x89 = SelectEvery (5, 4)

b = nnedi3 (field=-2)
x2 = b.SelectEvery (10, 2)
x3 = b.SelectEvery (10, 3)
x4 = b.SelectEvery (10, 4)
x5 = b.SelectEvery (10, 5)

# y   = 32 115 198 278 354 440
# dif =   83  83  80  76  86 
blend_fnc = x01.mt_lutspa (
\   mode="relative",
\   expr="y 32 480 / - 82 480 / / pi * sin 128 * 128 +",
\   y=3, u=3, v=3)

x2b = mt_lutxyz (x01, x2, blend_fnc, "y 256 * z 256 - x * + z 0.01 + /", y=3, u=3, v=3)
x3b = mt_lutxyz (x01, x3, blend_fnc, "y 256 * z x * - 256 z - /", y=3, u=3, v=3)
x23 = mt_merge (x3b, x2b, blend_fnc, luma=true)

x4b = mt_lutxyz (x67, x4, blend_fnc, "y 256 * z x * - 256 z - /", y=3, u=3, v=3)
x5b = mt_lutxyz (x67, x5, blend_fnc, "y 256 * z 256 - x * + z 0.01 + /", y=3, u=3, v=3)
x45 = mt_merge (x4b, x5b, blend_fnc, luma=true)

x2345 = mt_average (x23, x45, y=3, u=3, v=3)

Interleave (x01, x2345, x67, x89)
It handles only the deblending part and would need tuning and optimisation (scene changes, various artifacts, get rid of the lutxyz...), but you've got something to start with.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 6th August 2011 at 07:27. Reason: Fixed mt_lutspa + unnecessary deinterlacing
cretindesalpes is offline   Reply With Quote
Old 6th August 2011, 00:56   #4  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Oh man, you are a genius!! I never thought it could be fixed so badass. I think it's the nearest thing of magic Im going to find in this forum

Besides not understanding a thing of the RPN, mt_lutspa is one of those masktools functions I never got to grasp.

Ill get my hands on tomorrow, I already have the scripts blocked for the 2 sources in regards of denoising, etc, the only difficulties I was having was the blending artifact in the first source, and the field-blending in the second.

So for changing parity in the first one, I would need to work on trims, right?
As for the second I will have a closer look tomorrow to play and see what I can do.

These are pretty rare animations so thanks a lot.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 6th August 2011, 08:11   #5  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Let me explain what is done here for the second sample: I first used a plain Bob() to analyse the fields, to check if some were blended or repeated. I deduced we have a regular 3:2 pattern with field blending instead of combing. The clean frames look actually clean (no residual blending from the other frames). The reconstituted frame I called x2345 was blended with x01 in fields 2 and 3 and x67 in fields 4 and 5. But the blending is weird: instead of being fixed or more or less progressive along the Y axis, it follows a sine-like curve! And this blending curve is reversed for each second field. I really don't know why it was telecined this way.

I loaded the bobbed video in a software showing the pixel coordinates under the mouse cursor (Aegisub) and tried to find the sine characteristics, namely the zero-crossings to identify the phase and frequency. Zero-crossing happens where vertical features look almost static when you switch quickly between fields 2 and 3 or 4 and 5. I wrote down the Y positions (first one at 32) and deduced their average distance (82). This eventually gave the blending mask formula:
m = sin (pi * (Y - 32/480) / (82/480)) * 128 + 128
with Y in range 0-1. This is what is written in RPN in the mt_lutspa. The mask was applied during telecine like in a standard mt_merge, with source pictures swapped for each field.

So I just tried to invert the blending:
blend = source1 + (source2 - source1) * (m/256)
=>
source2 = (blend + source1 * ((m/256) - 1)) / (m/256)
But when source1 weight is low, the result is pure garbage, so I tried to select the best parts of each field pair with the blend mask again.

Finally, both results for frame x2345 are averaged to reduce the most prominent artifacts.

For the first sample, the .d2v probably has information about parity change, but I don't know how QTGMC handles it. So if it don't work out of the box, you'll have to trim (or use ReplaceFramesSimple with one QTGMC instance per field parity).
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 6th August 2011 at 08:23. Reason: typos
cretindesalpes is offline   Reply With Quote
Old 7th August 2011, 05:44   #6  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
That was brilliant
jmac698 is offline   Reply With Quote
Old 9th August 2011, 19:06   #7  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Awesome, when strict maths are required Im out, but I understood better with the explanation. Since it is the most demanding one I will leave it later after I process the first source.

I found out (and already posted on the specific thread) that QTGMC is not suited for anime, in that sense I was about to use MCBobUv5, but I guess that since this is not an usual anime source, being 30fps and mostly zoom and pans, I can get by with qtgmc which delivers better results, and use mcbob only where I find ghosting problems. I think the source is frame based, and I read there's no way to read any parity tag from the source to fix parity change, and the nature of the source makes it almost impossible to accurately spot this by eye, so I will fix them after the first pass (deinterlace to lossless) if I find something strange.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Reply

Tags
hybrid, interlaced, progressive, telecine

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:32.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.