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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd March 2014, 16:13   #1  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
Help with bizzarre interlacing

Hi,

I have a problem with the interlacing of something i'm trying to encode, and i think i need some help with the deinterlacing on this.
The source seems to be interlaced AAABBABBAAABBAAABBAAABBABBBBBABBA

Note that the above is probably wrong, it just seems too bizzarre, the souce seems like a mix of interlacing and the animator drawing a clear picture with a weaker picture on top to better animate movements, but i'm not sure.

After deinterlacing it with this script:
Code:
DGDecode_mpeg2source("C:\VTS_05_1.d2v", info=3, cpu=6)

crop( 4, 58, -4, -58)

tfm(order=0).tdecimate(hybrid=1)


ColorMatrix(interlaced=true)
ConvertToYV12()
I get results like this, where the color is shifted, and there are still seemingly interlaced frames left as well.

I also found this (Not included in the clip of the source under), so there is definitely something wrong:

Here is a clip of the source:
https://mega.co.nz/#!WdUjhRjS!veAKis...LPUuYKrjBz39ZA

Is anyone able to find out how it's interlaced and possibly a solution to it?
eriler is offline   Reply With Quote
Old 22nd March 2014, 16:36   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
is your clip yuy2? if it is use ConvertToYV12(interlaced=true), if not (yv12) u need to remove chroma blend
feisty2 is offline   Reply With Quote
Old 22nd March 2014, 17:10   #3  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
It seems it already is YUV 4:2:0, so i shouldn't be using ConvertToYV12 at all, though that doesn't really change anything on the encode visual-wise.

Edit:

When deinterlacing with (This was just an experiment, i know it's probably not best to deinterlace with this):
Code:
tdeint()
AssumeTFF()
Telecide(guide=1,chroma=true)
I get this:


Instead of what i'd get with the script in the first post:

Last edited by eriler; 22nd March 2014 at 17:24.
eriler is offline   Reply With Quote
Old 22nd March 2014, 17:31   #4  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
upload the sample that you are talking about.
lansing is offline   Reply With Quote
Old 22nd March 2014, 17:38   #5  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
Quote:
Originally Posted by lansing View Post
upload the sample that you are talking about.
Quote:
Originally Posted by eriler View Post
I posted it in the first post.
eriler is offline   Reply With Quote
Old 22nd March 2014, 20:45   #6  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by eriler View Post
I posted it in the first post.
post a sample that shows the obvious problem. The one you put up is a bad sample because people can't really see what's going on with those dot pattern in the way.
lansing is offline   Reply With Quote
Old 22nd March 2014, 21:34   #7  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
The first sample contains the first frame i posted an image of, which does show the problem, but i've cut out another sample for you which shows the frames where the girl with the frog is (At about 30 seconds in), this doesn't have any dots, so it should be easier to analyze. The first few frames in the sample seems to have been slightly corrupted by the video cutting software i used, so disregard them, but everything else should be proper.

https://mega.co.nz/#!zAEDQDrb!ijAIuB...7UNpTk0pULu2Ho
eriler is offline   Reply With Quote
Old 22nd March 2014, 22:13   #8  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
your source is anime, so 99% of the time you will need ivtc, not deinterlace. And you should not crop the video before ivtc.

I ran the common ivtc and it looks perfect to me, I didn't see any chroma blend in the sample
Code:
mpeg2source("abc.d2v")
tfm().tdecimate()
lansing is offline   Reply With Quote
Old 23rd March 2014, 08:21   #9  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Sorry, I was completely outta my tree, just ignore what I said before, u converted ur clip to yv12 after tfm and there's nothing wrong with it, so what u really need is deblend and do remove interlaced=true from color matrix cuz ur clip ain't interlaced any more after tfm

Last edited by feisty2; 23rd March 2014 at 08:27.
feisty2 is offline   Reply With Quote
Old 23rd March 2014, 08:48   #10  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
replace tfm.tdecimate with the script below
Code:
luma   = tfm(pp=0, slow=2)
chroma = vinverse().Srestore(omode="PP3", cache=10)

# manual sync: figure out which frame (previous,current aka p,c) of 'chroma' clip is most similar to current frame of 'luma' clip

# 46*log(|x-y|+1) uses the full [0,255]-range and scales little differences better than |x-y|*2
diffp = mt_lutxy(luma,chroma.selectevery(1,-1),"x y - abs 1 + log 46 *")
diffc = mt_lutxy(luma,chroma,                  "x y - abs 1 + log 46 *")

# average difference between compared frames
mp = mt_lutf(diffp,diffp,"avg",expr="x")
mc = mt_lutf(diffc,diffc,"avg",expr="x")

# build conditional masks based on the caculated comparisons
maskp = mt_lutxy(mp,mc,"x y < 255 0 ?")

# finally merge the luma of the tfm with the chroma of the srestore clip accordingly to the binary mask
MergeChroma(luma,chroma).mt_merge(chroma.selectevery(1,-1),maskp,luma=true,Y=2,U=3,V=3)
edit: sorry, can't remember where it's originally from

Last edited by feisty2; 23rd March 2014 at 08:51.
feisty2 is offline   Reply With Quote
Old 23rd March 2014, 10:58   #11  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
Quote:
Originally Posted by lansing View Post
your source is anime, so 99% of the time you will need ivtc, not deinterlace. And you should not crop the video before ivtc.

I ran the common ivtc and it looks perfect to me, I didn't see any chroma blend in the sample
Code:
mpeg2source("abc.d2v")
tfm().tdecimate()
Wow, it would seem it was having the crop in the wrong place was the cause of the chroma shift(?) / blend in all 3 places i used as examples, and i don't see any more anywhere. But i still have frames like these:

So it still seems to be telecined some places.

Quote:
Originally Posted by feisty2 View Post
replace tfm.tdecimate with the script below
Code:
luma   = tfm(pp=0, slow=2)
chroma = vinverse().Srestore(omode="PP3", cache=10)

# manual sync: figure out which frame (previous,current aka p,c) of 'chroma' clip is most similar to current frame of 'luma' clip

# 46*log(|x-y|+1) uses the full [0,255]-range and scales little differences better than |x-y|*2
diffp = mt_lutxy(luma,chroma.selectevery(1,-1),"x y - abs 1 + log 46 *")
diffc = mt_lutxy(luma,chroma,                  "x y - abs 1 + log 46 *")

# average difference between compared frames
mp = mt_lutf(diffp,diffp,"avg",expr="x")
mc = mt_lutf(diffc,diffc,"avg",expr="x")

# build conditional masks based on the caculated comparisons
maskp = mt_lutxy(mp,mc,"x y < 255 0 ?")

# finally merge the luma of the tfm with the chroma of the srestore clip accordingly to the binary mask
MergeChroma(luma,chroma).mt_merge(chroma.selectevery(1,-1),maskp,luma=true,Y=2,U=3,V=3)
edit: sorry, can't remember where it's originally from
I tried this script as well, but i couldn't get it to work well. For the script i needed srestore.avs, and all the requirements for that, but the latest version of srestore_2.7g.avsi wouldn't work, and the previous versions were giving me "Attempted to read or write protected memory, indication of corrupt memory" error messages.
Code:
LoadPlugin("C:\AviSynth\plugins\RemoveGrain.dll")
LoadPlugin("C:\AviSynth\plugins\TIVTC.dll")
import("C:\AviSynth\plugins\srestore.avs")
loadplugin("C:\AviSynth\plugins\average-codeblock\src\Release\Average.dll")
loadplugin("C:\AviSynth\plugins\GRunT.dll")

loadplugin("C:\AviSynth\plugins\masktools-v2.0a48\mt_masktools-26.dll")

loadplugin("C:\AviSynth\plugins\colormatrix.dll")
Import("C:\AviSynth\plugins\Vinverse.avsi")


LoadPlugin("C:\dgindex\DGDecode.dll")
DGDecode_mpeg2source("C:\VIDEO_TS\VTS_05_1.d2v", info=3, cpu=6)

luma   = tfm(pp=0, slow=2)
chroma = vinverse().Srestore(omode="PP3", cache=10)

# manual sync: figure out which frame (previous,current aka p,c) of 'chroma' clip is most similar to current frame of 'luma' clip

# 46*log(|x-y|+1) uses the full [0,255]-range and scales little differences better than |x-y|*2
diffp = mt_lutxy(luma,chroma.selectevery(1,-1),"x y - abs 1 + log 46 *")
diffc = mt_lutxy(luma,chroma,                  "x y - abs 1 + log 46 *")

# average difference between compared frames
mp = mt_lutf(diffp,diffp,"avg",expr="x")
mc = mt_lutf(diffc,diffc,"avg",expr="x")

# build conditional masks based on the caculated comparisons
maskp = mt_lutxy(mp,mc,"x y < 255 0 ?")

# finally merge the luma of the tfm with the chroma of the srestore clip accordingly to the binary mask
MergeChroma(luma,chroma).mt_merge(chroma.selectevery(1,-1),maskp,luma=true,Y=2,U=3,V=3)


crop( 4, 58, -4, -58)

ColorMatrix()
eriler is offline   Reply With Quote
Old 23rd March 2014, 11:27   #12  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
The latest srestore should work, the script needs strict linear access so just randomly jumping to some frame (like preview) will give u broken output, but encode the script should be okay
feisty2 is offline   Reply With Quote
Old 23rd March 2014, 12:17   #13  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
Right. It was the preview thing i was doing

I'll encode it and see.
eriler is offline   Reply With Quote
Old 23rd March 2014, 13:30   #14  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
I finished the encode with the script i posted above in post #11 and it isn't IVTC'ed, and the chroma blend still remains. Though oddly the girl with the frog didn't show chroma blending (Probably has something to do with the decimation from 29.97 to 23.976 fps that wasn't in the script).



eriler is offline   Reply With Quote
Old 23rd March 2014, 13:43   #15  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
after "xxxsource"
add "utoy ()" to your script and post the image you got then replace it with "vtoy ()" and post the image too
edit: if it isn't chroma blending, my guess would be plane y,u,v are running out of sync, you need to decimate 3 planes manually and separately to make them synchronized again

Last edited by feisty2; 23rd March 2014 at 13:55.
feisty2 is offline   Reply With Quote
Old 23rd March 2014, 14:11   #16  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
There is no "xxxsource" anywhere in the script. Did you mean after "DGDecode_mpeg2source("C:\VIDEO_TS\VTS_05_1.d2v", info=3, cpu=6)" ?

Code:
DGDecode_mpeg2source("C:\VIDEO_TS\VTS_05_1.d2v", info=3, cpu=6)
utoy()
??

This is how it ends up then:

Last edited by eriler; 23rd March 2014 at 14:14.
eriler is offline   Reply With Quote
Old 23rd March 2014, 14:38   #17  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
can you try to post an "interlaced" frame, i cant see anything wrong with this frame
feisty2 is offline   Reply With Quote
Old 23rd March 2014, 15:06   #18  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
Quote:
Originally Posted by feisty2 View Post
can you try to post an "interlaced" frame, i cant see anything wrong with this frame
Oh, it was supposed to be that small?

I checked both utoy and vtoy now, and nether look faulty or out of sync on the frame with the redhaired girl in post #14.

utoy:


vtoy:
eriler is offline   Reply With Quote
Old 23rd March 2014, 15:20   #19  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
I can see the issue now, the chroma is not blended but not synced to luma, you need to do a manual decimate to make luma and chroma synced, use "ovr" function in tdecimate
feisty2 is offline   Reply With Quote
Old 23rd March 2014, 16:17   #20  |  Link
eriler
Registered User
 
Join Date: Jun 2012
Posts: 44
To use an override file? But i have no idea how to make one that'll decimate chroma and luma separately and sync them. The help file for tdecimate doesn't specify it either.

Although, as lansing said, when IVTCing with just tfm().tdecimate() and where the crop part is after the IVTC part (See picture post #11), the chroma and luma were in sync, the only problem then was some telecined frames remaining because of the bizzarre telecining pattern this video has. Wouldn't the solution lie more towards tweaking a IVTC plugin to handle the unusual pattern (tdecimate, QTGMC, yadif)?

Last edited by eriler; 23rd March 2014 at 16:27.
eriler is offline   Reply With Quote
Reply


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 22:49.


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