Log in

View Full Version : Bad frameblending in anime source


Nyard
2nd August 2020, 13:48
Hello everyone, I've been working with a particularly poor quality Anime DVD recently and it does seem to have pretty bad frameblending. It is from a NTSC Dvd - so this was quite surprising for me.

Regular IVTC only eliminates some of the telecining, and I've tried to get rid of the rest of them by using Cdeblend, which was a considerable improvement however still hasn't gotten rid of everything.

Here are some example clips. (Goes without saying that you should download and not use the google drive preview function) (https://drive.google.com/drive/folders/10N-f2nwuXm6bFIFuAYHHT1Kb-ykp-1Ce?usp=sharing)

If there is any way to make an uncompressed clip available for testing purposes then I don't know it unfortunately, excuse me in that case.
However these clips should show you the issue.

Here's my script:


MPEG2Source("%source_file%")
Trim(11518,12518)

AssumeTFF()
Telecide(guide=1)
Decimate()

import("C:\Program Files (x86)\AviSynth\plugins64\Cdeblend.avs")
Cdeblend(omode=2)


Does anyone have any suggestions what to do about this issue?
I am also worried about Cdeblend because it might mess with the animation at times and make it more jittery or recreate/discard wrong frames: is this worry based in reality?

Asmodian
3rd August 2020, 03:18
If there is any way to make an uncompressed clip available for testing purposes then I don't know it unfortunately, excuse me in that case.

DGIndex (https://www.videohelp.com/software/DGMPGDec) can snip chunks of video and export it. Use the "[" and "]" buttons.

manono
3rd August 2020, 07:50
You can't IVTC it as it was never telecined. It was field-blended to bring it up to 29.97fps from a PAL 25fps source. The usual procedure is to bob it followed by using SRestore to unblend it.

LWLibavVideoSource("raw_footage.mkv")
AssumeTFF()###might not be necessary for the complete video
yadifmod(mode=1, edeint=nnedi3(field=-2))###or your favorite bobber
SRestore(frate=25)

https://www.sendspace.com/file/o291zp

And, as Asmodian suggested, provide a sample untouched from the source, not something you reencoded.

Nyard
3rd August 2020, 12:10
DGIndex (https://www.videohelp.com/software/DGMPGDec) can snip chunks of video and export it. Use the "[" and "]" buttons.

Thanks.
I hope I've done it right. (https://drive.google.com/file/d/14tU3y5xUFkCYPYVVu8RADaqFbeldkJrR/view?usp=sharing) I was using "Save Project and Demux Video" for this.

@manono
Doing exactly what you suggested:
AssumeTFF() #Force Top Field First
yadifmod(mode=1, edeint=nnedi3(field=-2))###or your favorite bobber
SRestore(frate=25)

I still get frequent frames like this (https://i.imgur.com/RC2vLIy.png).
Is there anything to be done about this?

ChaosKing
3rd August 2020, 23:29
This seems not bad. Only 2-3 blends left
tfm()
srestore()

Nyard
4th August 2020, 08:10
This seems not bad. Only 2-3 blends left
tfm()
srestore()

Thanks ChaosKing!
I tried to append this to the previous code snippets that were posted here.
Unfortunately there is still blending present in scenes with a lot of motion.
And now the fps is at 11.988fps, i would like to restore the appropriate 23.976fps afterwards without losing any of the original pacing of the animation.
Is there any risk here?

ChaosKing
4th August 2020, 08:46
How about this?
tfm()
d = vsTBilateral()
Cdeblend(omode=2, dclip=d)
d = vsTBilateral()
srestore(frate=23.976, speed=-5, dclip=d)

https://github.com/Asd-g/AviSynth-vsTBilateral
or use any other denoiser, it's just to improve blend detection.

Nyard
4th August 2020, 09:15
So right now my script looks like this:

yadifmod(mode=1, edeint=nnedi3(field=-2))
SRestore(frate=25)
tfm()
d = vsTBilateral()
Cdeblend(omode=2, dclip=d)
d = vsTBilateral()
srestore(frate=23.976, speed=-5, dclip=d)

I tried it, however I am losing a huge amount of animation. Sometimes up to two Keyframes in a row are completely lost in the process. - I think this mainly occurs in heavily blended scenes. But even then some blending remains...

ChaosKing
4th August 2020, 09:33
Because your script does not make sense. yadif and tfm do essentially the same. Also the srestore(25) can (should) not be combined with the rest like you did.
Use either the first version or the second, but don't combine them...

Nyard
4th August 2020, 09:42
Thanks for correcting my rookie mistake here.

I have now removed the first two lines accordingly. However i am still losing keyframes.

Furthermore comparing the two methods
Method 1:
yadifmod(mode=1, edeint=nnedi3(field=-2))
SRestore(frate=23.976)

Method 2:
tfm()
d = vsTBilateral()
Cdeblend(omode=2, dclip=d)
d = vsTBilateral()
srestore(frate=23.976, speed=-5, dclip=d)

Both Method 1 and Method 2 still have some blending but always on different frames.
Method 2 however removes some keyframes entirely.

ChaosKing
4th August 2020, 11:04
You most likely need to live with a tradeoff between no blends and missing frames or some blends but less.

tfm()
d =crop(16,8,-16,-8).vsTBilateral()
srestore(frate=23.976, speed=-5, dclip=d, omode=4)

omode=4 seems to be not a bad tradeoff.

You could also try different thresh values and see if it helps.
http://avisynth.nl/index.php/Srestore

Maybe some deblend expert has some better ideas :D

Nyard
4th August 2020, 13:04
Thank you, but I think in my case I'd rather have more blends than missing keyframes. Anime already barely has any keyframes so taking some away does not feel appropriate :p
So I guess I'm looking into finding just the right settings for that.

But I'd be really curious about what a deblend expert might be able to say about this.

manono
5th August 2020, 07:44
Is there anything to be done about this?
There's just too many blended fields/frames to be able to get rid of them all. In addition, the pattern changes from time to time as it was edited as video, and it takes SRestore a few frames to latch onto a new pattern. However, after thinking about what ChaosKing provided, I decided he's right that it was field blended from a 23.976fps source, not a PAL 25fps source.

So, I modified my script a bit:

yadifmod(mode=1, edeint=nnedi3(field=-2))
Srestore(23.976)

But your source is pretty bad, even if it is from a retail DVD.

Boulder
5th August 2020, 08:52
I've sometimes created an analysis clip with ReduceBy2() and it has worked better than just denoising the original one.
I'd also just use NNEDI3 to bob, so my attempt would be like this:


NNEDI3(field=-2, qual=2)
d=ReduceBy2()
Srestore(frate=23.976, speed=-1, dclip=d)

Nyard
5th August 2020, 14:12
But your source is pretty bad, even if it is from a retail DVD.

It is. Infamously bad. There's a bluray version of that movie with great quality however it is cropped. So i wanted to see what I can make of the uncropped DVD version.

@Boulder that does seem to be the best rate of success so far! I think I'll go with that. Thanks

Boulder
5th August 2020, 14:59
It is. Infamously bad. There's a bluray version of that movie with great quality however it is cropped. So i wanted to see what I can make of the uncropped DVD version.

@Boulder that does seem to be the best rate of success so far! I think I'll go with that. Thanks

Sorry, I messed up a bit. The detection clip part must be after bobbing with NNEDI3 but you probably figured it out already.