Log in

View Full Version : Anime Deinterlacing Problem


Akatsuker
16th September 2007, 18:54
Sorry for bad english.
I don't know what's going on... I'm trying to rip a animeDVD interlaced to a h264-mp4 video stream, and I'm using meGUI for doing this. My script makes something good (I've got clean frames, really good), but there's a lot of frames that aren't encoded (just like on AvsP Preview, that shows the same).
This is what happens: in a moving scene, some frames seem to be duplicated, and so I've got some "pauses".
The Script is:

DGDecode_mpeg2source("C:\DVD 2Rip\movie.d2v",info=3)
ColorMatrix(hints=true,interlaced=true)
tfm(order=1,field=-1,mode=1,pp=6,cthresh=8)

crop( 2, 0, -2, -4)

LanczosResize(640,480) # Lanczos (Sharp)
#denoise

Using TFM, almost perfect. I'm a AVISynth newbie as you can see, and I tried searching for answers in the forum, but got nothing.

Appreciate your help.
Thanks.
Akatsuker

Demi9OD
16th September 2007, 18:56
You need to decimate frame matches with tdecimate().

Akatsuker
16th September 2007, 19:00
Sorry for Bad English, again.
Thanks a lot, Demi9OD! Can you suggest me something for my script? Like I said, I'm starting with AVISynth, and some of the filters I can't use yet, 'cause I don't understand. How do I do what you said on TDecimate?
Akatsuker

Demi9OD
16th September 2007, 19:11
Try putting this between TFM and Crop.

TDecimate()
or
TDecimate(mode=1,hybrid=1)

There are alot of different settings, and it depends on your source.

Akatsuker
16th September 2007, 19:42
Ok. I'll try the diferent settings in documentation overview, and I'll come back soon with the results.
If anyone can suggest me something to do, I'm accepting.
Thanks!
Akatsuker

Akatsuker
16th September 2007, 20:08
One more info: these "freezings" happens to each 30~32 frames. The original FPS of the video is 29.970, and so I'm gonna make a mp4/h264 29.970 video too.

TheRyuu
16th September 2007, 22:47
You don't want or need pp=6 with tfm. Just keep it simple. The defaults work fine in most cases for IVTCing.

mpeg2source("C:\DVD 2Rip\movie.d2v",info=3)
assumetff() #or assumebff() depending on source
tfm(d2v="C:\DVD 2Rip\movie.d2v").tdecimate()
colormatrix(hints=true)

That should get the job done and return the original 23.976fps video that you want.
And you don't want the encoded video to be 29.97fps. It's gonna be 23.976fps like it should be.

This same script can be used on 99.9% of all American released anime.

Also, when decimating, I like putting colormatrix after it. If it was pure interlaced though, then I'd put it before deinterlacing with interlaced=true flag.

Akatsuker
16th September 2007, 23:04
After the Demi9OD tips, I've got a new result.
My new script is:

DGDecode_mpeg2source("C:\DVD 2Rip\movie.d2v",info=3)
ColorMatrix(hints=true,interlaced=true)
tfm(order=1,field=-1,mode=1,pp=0)
TDecimate(mode=1,hybrid=1,vidThresh=200,dupThresh=20,sceneThresh=25,conCycle=2,vidDetect=3,nt=0,blockx=2048,blocky=2048,batch=true)

crop( 2, 0, -2, -4)

LanczosResize(640,480) # Lanczos (Sharp)
#denoise


I have encoded a trimmed one, 355 frames, just for you to see. It has h264/mp4/1679 KB, and no audio.

DOWNLOAD: http://rapidshare.com/files/56208896/temp.mp4.html

Until the frame 110, the video has this problem. Passed this, and it's just fine.
It makes me think that Demi9OD was right, the sollution for the problem is right on the TDecimate code. But, although I've tried all this afternoon (and I'll keep trying), I couldn't find a combination that makes the perfect result. I really need your help.
Thanks.

EDIT:

Wizboy11, I'll try this now! Thanks a lot!

TheRyuu
16th September 2007, 23:38
After the Demi9OD tips, I've got a new result.
My new script is:

DGDecode_mpeg2source("C:\DVD 2Rip\movie.d2v",info=3)
ColorMatrix(hints=true,interlaced=true)
tfm(order=1,field=-1,mode=1,pp=0)
TDecimate(mode=1,hybrid=1,vidThresh=200,dupThresh=20,sceneThresh=25,conCycle=2,vidDetect=3,nt=0,blockx=2048,blocky=2048,batch=true)

crop( 2, 0, -2, -4)

LanczosResize(640,480) # Lanczos (Sharp)
#denoise


I have encoded a trimmed one, 355 frames, just for you to see. It has h264/mp4/1679 KB, and no audio.

DOWNLOAD: http://rapidshare.com/files/56208896/temp.mp4.html

Until the frame 110, the video has this problem. Passed this, and it's just fine.
It makes me think that Demi9OD was right, the sollution for the problem is right on the TDecimate code. But, although I've tried all this afternoon (and I'll keep trying), I couldn't find a combination that makes the perfect result. I really need your help.
Thanks.

EDIT:

Wizboy11, I'll try this now! Thanks a lot!

You don't need all that tdecimate or tfm code. Just use mine and it works just as good and is a lot simpler.

I always like to keep things as simple as possible.

Akatsuker
17th September 2007, 00:33
Thanks again, Wizboy11! I tried it with your code, and the results unfortunately aren't good enough yet. I'll show you:

Here's what I have to achieve:

http://img513.imageshack.us/img513/406/h11kt1.jpg

Here's what your code does:

http://img165.imageshack.us/img165/883/h1wg7.jpg

About the FPS, as long as the video seems pretty good, it could be 23.976! I really don't care. BTW, in case 23.976, there could be fine. But I'm worried about the quality, that's all. What I do now, man?

It's a japanese DVD (anime), NTSC, 29.970 fps. That's the source.

foxyshadis
17th September 2007, 00:46
10-30s of source, clipped with dgindex, will help pin down whatever's wrong here.

Akatsuker
17th September 2007, 00:48
10-30s of source, clipped with dgindex, will help pin down whatever's wrong here.

Foxyshadis, if you don't mind, can you explain it to me? Misunderstood... :confused:

foxyshadis
17th September 2007, 01:06
Directions: http://forum.doom9.org/showthread.php?p=1037652#post1037652

Akatsuker
17th September 2007, 01:25
Ok, just tell me if i got that right: so you're saying to me to do different configurations (one for the problematic, and other for the good) and so concatenate both on the same final stream?

BTW, Thanks!

TheRyuu
17th September 2007, 01:35
Post a clip. Use dgindex to do it.
Use the directions that foxyshadis posted to do it.

Upload the clip to somewhere like "sendspace" or something.
Should only be like 10-30seconds of were the problem is visible.

Akatsuker
17th September 2007, 14:12
Ok! I'm doing this!

Akatsuker
17th September 2007, 19:08
Wizboy11 & Foxyshadis, here's the clip:
http://www.sendspace.com/file/iqvn3a


1MB, mp4/h264, no audio.
It's encoded with the Wizboy11's 23.976 script:
mpeg2source("C:\DVD 2Rip\movie.d2v",info=3)
assumetff() #or assumebff() depending on source
tfm(d2v="C:\DVD 2Rip\movie.d2v").tdecimate()
colormatrix(hints=true)

I'll wait for your suggesting! Thank you!

Guest
17th September 2007, 19:11
No! Don't encode it. Post the raw M2V.

Akatsuker
17th September 2007, 19:38
Neuron2, I'm really sorry, man, but I am not understanding what do you want. I'm serious, I'm just starting with AVISynth, and I'm embarrassed because I don't even know why you want a m2v file.
If you don't mind to explain to me why do you want the m2v, and how i can have it, I'll be happy to upload it for you to see.

Sorry... =\

TheRyuu
17th September 2007, 19:52
Neuron2, I'm really sorry, man, but I am not understanding what do you want. I'm serious, I'm just starting with AVISynth, and I'm embarrassed because I don't even know why you want a m2v file.
If you don't mind to explain to me why do you want the m2v, and how i can have it, I'll be happy to upload it for you to see.

Sorry... =\

Fox posted directions already:
http://forum.doom9.org/showthread.php?p=1037652#post1037652

You can start by reading the DGIndex user manual.

I'm feeling mellow right now, though, so I'll help you.

Position the timeline so that the first frame you want is displayed. Then hit [. Now move the timeline so that the last frame you want is displayed. Then hit ]. Now do Save project and demux video. Your M2V will contain just that range.

Am I nice or what?
10-30s of source, clipped with dgindex, will help pin down whatever's wrong here.

Akatsuker
17th September 2007, 20:19
Ok, here's the raw m2v, from the VOBs:

http://www.sendspace.com/file/qwxk6c

EDITED: I'm talking about the problematic clip, ok?

foxyshadis
17th September 2007, 22:26
Neuron2, I'm really sorry, man, but I am not understanding what do you want. I'm serious, I'm just starting with AVISynth, and I'm embarrassed because I don't even know why you want a m2v file.
If you don't mind to explain to me why do you want the m2v, and how i can have it, I'll be happy to upload it for you to see.

Sorry... =\

There's information in the original that's lost when re-encoding, plus it allows us to start from the source without the possibility of any fundamental errors creeping in.

The segment you linked is fully progressive right up until the last couple of frames, which are fully interlaced - a smart deinterlacer would look better than a fieldmatcher like tfm. If I had to hazard a guess based on just this, I'd say Securebob with Smoothdeinterlace would work well. A somewhat longer snip would be nice, 4 seconds is a little short to see what happens, particularly if it's the scene transitions and not the scenes themselves that are the problem.

Overall, it looks like it might just be VFR, and you have to live with jerkiness, blending, or some manual labor: http://avisynth.org/mediawiki/VFR

Prim3
17th September 2007, 23:31
Off-topic: May I ask what anime that is?

On-topic: If you're planning to do VFR manually, I advise you that only do it if you want 100% perfection as it's somewhat of a long process.

Akatsuker
17th September 2007, 23:58
If you don't mind, Foxyshadis, I clipped one more, with a couple more seconds for you to download and so confirm your opinion or not.

http://www.sendspace.com/file/4i60ui

16,94MB, a new m2v.

There's information in the original that's lost when re-encoding, plus it allows us to start from the source without the possibility of any fundamental errors creeping in.
Thanks for the explanation! Understood! o>

The segment you linked is fully progressive right up until the last couple of frames, which are fully interlaced - a smart deinterlacer would look better than a fieldmatcher like tfm. If I had to hazard a guess based on just this, I'd say Securebob with Smoothdeinterlace would work well. A somewhat longer snip would be nice, 4 seconds is a little short to see what happens, particularly if it's the scene transitions and not the scenes themselves that are the problem.

I think I got everything now. One more thing: could you please give me an example of script? It does not have to be exact, of course; It's just for having some idea of what I'll have to do now. Like I said on the beginning, I'm just starting with AVISynth, and I don't know so much... If you don't mind, I'll need it. Thanks a lot...

And the possibility of making many things diferent, and so doing "concatenating" on a final script, for a final stream? What do you think of this? Weird? Wrong...? Impossible?


Prim3, I think it is called "Seinto Seya", on japan, or something. I'm doing some tests with encoding this kind of DVDs ^^'
And all i know how to do is the mp4/h264/AAC (nero encoder) encoding. Any process that feels different, and I'll need help too.
I'm here just to listen to you. ^^

DeathAngelBR
18th September 2007, 02:47
Saint Seiya - The Hades chapter. :p

Akatsuker
18th September 2007, 03:07
hehe, so.

foxyshadis
18th September 2007, 11:18
Ah, the beginning mixes pure 30p with stuff that's been edited post-telecine, with the cycles out of sync. There's no way to fix that (well, no one's written a fix for it yet). All of the deinterlacers I tried had some artifacts (spots, blurry kanji, blending, or jitter), so I guess that's out. Of everything I tried, TFM() alone looks best by far, you just have to decide if you want to decimate it or not. I assume the main episode is normal and doesn't suffer from this.

If you decimate the opening, then it'll be jerky but needs no further effort. If not, it'll be slightly jerky on telecined areas but look smoother on the fades, and it'll be more complex. You can create two scripts and two encodes at different framerates and merge them together later (mp4 and mkv support this), combine them and use a timecode file afterward to reset their timestamps, or generate a timecode with tdecimate mode 4/5, which means extra preprocessing passes but gives you the cleanest video in the end. Or you can blend the opening down to 24p, but that's a bit ugly and will really soak your bitrate. The VFR link should go over these in much more detail.