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 10th January 2012, 19:19   #1  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 949
Deinterlacing Hard Telecine Animation

Once in a while I stumble upon one of these sources(11mb); they look like blended telecine. By following the guidelines of manono's post I found that it is in fact hard telecine, as dgindex flags it as interlaced and there is a clear 3:2 pulldown, so it can be ivtc'ed. But I couldn't ivtc it, output has lots of combing and blending.

What is rare is when fields are inspected, each one is different (field,blendedfield,...) in this pattern f,f,Bf,f,Bf
what I normally do is bob deinterlace and srestore, and it seems to work, but I would like to know if this is correct because by deinterlacing I'd be harming the source too much in case it's not necessary. And related to deinterlacing I'm very interested on what would be your take on this since QTGMC seems not to be appropiate for not pure interlaced content, and much less anime, maybe MCBob or is it in the same league? tdeint? Or can this hard telecine really be fixed by using tfm? (I never got to understand its parameters beyond "order=")

what I can do is take the unblended fields:
SeparateFields()
selectevery(5,0,2,3)
by 2 being a dup of 3 I can drop it and I get 23.976fps output:
selectevery(5,0,3)
But these are fields so... now what? (they shimmer a lot)
Dogway is offline   Reply With Quote
Old 10th January 2012, 19:25   #2  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,924
Quote:
Originally Posted by Dogway View Post
Once in a while I stumble upon one of these sources(11mb)
Where did you stumble upon that source?
Guest is offline   Reply With Quote
Old 10th January 2012, 19:32   #3  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 949
Quote:
Originally Posted by neuron2 View Post
Where did you stumble upon that source?
is:
bob deinterlace
srestore(23.976)
OK?

and if so, which bob deinterlacer? QTGMC is not suited for not pure interlaced content, and much less animation. I'm not sure if this is also true for MCBob and tdeint. Yadif gives me horrible results.

Last edited by Dogway; 10th January 2012 at 19:34.
Dogway is offline   Reply With Quote
Old 10th January 2012, 20:56   #4  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 619
Maybe you could use animeivtc.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Nvidia GTX750 2GB DDR5 + SSD Vertex 4 256 GB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 10th January 2012, 23:15   #5  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,924
[bump after re-open]
Guest is offline   Reply With Quote
Old 10th January 2012, 23:29   #6  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 949


Ok now?
Dogway is offline   Reply With Quote
Old 11th January 2012, 12:20   #7  |  Link
librarian
Registered User
 
Join Date: Nov 2011
Posts: 63
Deblending isn't too difficult:

Code:
MPEG2SOURCE("VTS_05rrr.demuxed.D2V")
blur(0,1)
Srestore(omode="pp2")
Tdecimate()
But motion is really jerky.
librarian is offline   Reply With Quote
Old 11th January 2012, 16:17   #8  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 619
Code:
animeivtc(mode=1,aa=0,killcomb=2, blend=true)
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Nvidia GTX750 2GB DDR5 + SSD Vertex 4 256 GB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 11th January 2012, 17:28   #9  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 949
Thanks overdrive80.
That code is not working for me. Lots of blending and artifacts.

librarian's code kinda works, but I used vinverse instead of blur(0,1). Still it has a fade of blending.

animeivtc(50mb) | srestore(omode="pp2")(50mb) | qtgmc(50mb)

Deblending wise, the best I get is the qtgmc route:
Code:
qtgmc(thsad1=300,blocksize=8,TR0=1,TR1=1,TR2=0,lsb=true,chromamotion=false,edithreads=2)
Srestore(23.976)
But I might be doing it wrong by deinterlacing a source that doesn't need to be deinterlaced, besides QTGMC is not suited for animation nor not pure interlaced content. MCBob is a "dinosaur", and tdeint... I don't know, it's too old and nobody have stated whether it works for animation.
Dogway is offline   Reply With Quote
Old 11th January 2012, 22:55   #10  |  Link
librarian
Registered User
 
Join Date: Nov 2011
Posts: 63
Yes, QTGMC is not suited for IVTC or blending(see also this specific thread). Tdeint is a good (and very tweakable) deinterlacer, for "normal" animation (it is usually telecined, not interlaced) a field matcher (Telecide, TFM) is the right tool. Srestore, at the end of the day, is a fieldmatcher.
As to blur(0,1), in my script, it is used to cause a damage (double blending) that Srestore(omode="pp2") can recover (with bobber+Srestore I didn't get a good output). For this specific use - IMHO - a vertical blur is a better choice than Vinverse (I think there is a post of Didée about this blur(), but I cannot find it now).
As to doing wrong, set aside the technicalities, there is only one final judge: our taste. What we like better is the perfect solution. Moreover there is a Murphy's Law: as soon as a person finishes a long and difficult encode this person will find a better solution:-)

Last edited by librarian; 11th January 2012 at 23:13.
librarian is offline   Reply With Quote
Old 12th January 2012, 04:37   #11  |  Link
Sapo84
Registered User
 
Join Date: May 2008
Posts: 41
Loaded in YATTA.
Patterne Guidance actually finds a pattern, but that doesn't solve the real problem.
Still, I think the blendings have somewhat of a pattern.

This
Code:
DGDecode_Mpeg2Source("D:\VTS_05rrr.demuxed.d2v")
FieldHint(ovr="D:\VTS_05rrr.demuxed.d2v.fh.txt")
TelecideHints(NNEDI3())
#pattern is NccnnNcc...

range(2,2,nnedi3(0))
range(7,7,nnedi3(0))
range(12,12,nnedi3(0))
range(4,4,nnedi3(1))
range(9,9,nnedi3(1))
range(14,14,nnedi3(1))
...
TDecimate(mode=1,cycle=5,ovr="D:\VTS_05rrr.demuxed.d2v.dec.txt")
Basically: decimated frame, ivtc (progressive frame), bob(0), ivtc (next frame), bob(1)(of the next frame), then repeat every 5 frames.

Edit:
Something like this
Code:
DGDecode_Mpeg2Source("D:\VTS_05rrr.demuxed.d2v")
fields=SeparateFields()
prog=fields.selectevery(10,2,3).Weave()
n=fields.selectevery(10,7,8).Weave()
nnedi0=Selectevery(5,2).nnedi3(0)
nnedi1=Selectevery(5,0).nnedi3(1)
return Interleave(nnedi1,prog,nnedi0,n).Trim(2,0)
The nnedied frames look like crap, a good bobber may give better results.

Last edited by Sapo84; 12th January 2012 at 05:12.
Sapo84 is offline   Reply With Quote
Old 12th January 2012, 16:21   #12  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
My attempt :

Code:
al = 0.15   # Luma blend
ac = al     # Chroma blend
g = 3

# Deblending with pseudo-gamma correction
edi = nnedi3 (field=-2)
s1 = " 16 - 219 / 0 max "+String(1.0/g)+" ^ "
s2 = " 0 max "+String(g)+" ^ 219 * 16 + "
fix = mt_lutxy (edi, edi.SelectEvery (1, -1),
\	yexpr="x "+s1+String(1+al)+" * y "+s1+String(al)+" * -"+s2,
\	expr="x "+String(1+ac)+" * y "+String(ac)+" * -",
\	y=3, u=3, v=3)
fix = fix.SeparateFields ().SelectEvery (4, 0, 3)

# Replaces only the blended fields with their fixed counterparts
Interleave (last.SeparateFields (), fix)
SelectEvery (10, 0, 2+1, 4, 6, 8+1)   # Comb pattern here
Weave ()

# Usual IVTC + light postprocessing for residual combing
TFM (PP=0)
Vinverse ()
TDecimate (mode=1)
It may exhibits occasional artifacts. I'm not sure about the values or the formulas, but it's a decent starting point.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding

Last edited by cretindesalpes; 18th January 2012 at 12:33. Reason: 219 instead of 239 and 0 max before ^
cretindesalpes is offline   Reply With Quote
Old 12th January 2012, 16:32   #13  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 949
Thanks librarian, I know it is interlaced by 2 facts, combing, and field blending. And a confirmation by dgindex. That's ok but, don't you see a 3:2 pulldown as I do? how can they interlace a telecine source (this is what fooled me)? how can that be done and why do they do it?

It's strange because I got less blending with bob+srestore(23.976) than with your code, even using blendbob has less blending (but more than bob+srestore):
Code:
nnedi3(field=-2)
blendbob()
selectevery(5,0,1,2,4)
@Sapo84
I rearranged the code to understand it better.

Code:
fields=SeparateFields()

nnedi1  =Selectevery(5,0).nnedi3(1)    # fields 0,1  keep 0 drop 1
prog    =Selectevery(5,1)              # fields 2,3
nnedi0  =Selectevery(5,2).nnedi3(0)    # fields 4,5, drop 4 keep 5
w=fields.Selectevery(10,7,8).Weave()   # fields 7,8
#                  0,     2,3,  5,  7,8
return Interleave(nnedi1,prog,nnedi0,w).Trim(2,0)
What this means is that not blended hard telecine shouldn't be deinterlaced? I suppose that after this a decomber is necessary in my case at least. And as you say a better deinterlacer for the nnedi1 and nnedi0 lines. Actually this is my main question, what is a good bobber for animation? in the 2 nnedi lines one field is clean and the other is blended, isn't there a smartdeinterlacer that only deinterlace spatially where there is blending?

PD: Thanks cretindesalpes, had to post this after a few hours building the post. But I'm gonna test and analyse/understand your code
Dogway is offline   Reply With Quote
Old 12th January 2012, 20:21   #14  |  Link
librarian
Registered User
 
Join Date: Nov 2011
Posts: 63
Yes the source is definitely telecined. I am not so experienced to imagine what they did to this poor footage, why they did so is simple: to save time and money.
When I tried bob+srestore I got an unsatisfactory output, therefore I used the script posted above (pointing out the jerky motion).
I like your solution, I often use nnedi3(field=2)+blendbob but never on this type of problem, well something to learn and remember, thank you.
I quickly tried the script of cretindesalpes and it seems really effective.
Now choose your poison and good enconding.

Last edited by librarian; 12th January 2012 at 20:40.
librarian is offline   Reply With Quote
Old 12th January 2012, 21:30   #15  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 949
Thanks for all the help.
Yes after some more hours analysing cretindesalpes code I definitely don't understand it lol
Well, I understand the structure, it kinds of deconstruct-->deblend-->reconstruct back to unblended hard telecine-->IVTC

easy to imagine, hard to get done, so thanks a lot cretindesalpes. I wondered about the sporadic black artifact but you corrected it with the 219 value. Other than that more than enough really, since this needs a denoiser on top of it as well. No shimmer, preserves full resolution (practically) and deblends more than decent.
I learned a lot, still I would like to know if there exists a smartbobber that is OK (technically correct) for animation when source is interlaced (not as hard telecine)
Dogway is offline   Reply With Quote
Old 12th January 2012, 23:51   #16  |  Link
mandarinka
Registered User
 
mandarinka's Avatar
 
Join Date: Jan 2007
Posts: 659
My way of dealing with these telecine+blending sources is to ivtc with tfm (pp off and you can get rid of some blends in static parts by using mmsco=false, but take care, I think it can cause a wrong decision sometimes) and decimating, then finally get rid of the annoying combs by spline36resize(width,height*3/2).daa().spline36resize(width,height). The blending will stay but it isn't that annoying if it isn't combed/aliased. Make sure you are using nnedi3 in daa btw, that makes a lot of difference.

The other option is qtgmc and srestore, which will eliminate a lot of the blending, but isn't as friendly to detail as the above (based on my opinion/experience/preference).
Using other bobbers I wouldn't even consider, for the same reason.
mandarinka is offline   Reply With Quote
Reply

Tags
animation, anime, deinterlace, hard telecine, ivtc

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 17:46.


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