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 2020, 13:48   #1  |  Link
Nyard
Registered User
 
Join Date: Jun 2020
Posts: 7
Bad frameblending in anime source

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)

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:

Code:
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?
Nyard is offline   Reply With Quote
Old 3rd August 2020, 03:18   #2  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
Quote:
Originally Posted by Nyard View Post
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 can snip chunks of video and export it. Use the "[" and "]" buttons.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 3rd August 2020, 07:50   #3  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
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.
manono is offline   Reply With Quote
Old 3rd August 2020, 12:10   #4  |  Link
Nyard
Registered User
 
Join Date: Jun 2020
Posts: 7
Quote:
Originally Posted by Asmodian View Post
DGIndex can snip chunks of video and export it. Use the "[" and "]" buttons.
Thanks.
I hope I've done it right. I was using "Save Project and Demux Video" for this.

@manono
Doing exactly what you suggested:
Code:
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.
Is there anything to be done about this?
Nyard is offline   Reply With Quote
Old 3rd August 2020, 23:29   #5  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
This seems not bad. Only 2-3 blends left
Code:
tfm()
srestore()
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 3rd August 2020 at 23:31.
ChaosKing is offline   Reply With Quote
Old 4th August 2020, 08:10   #6  |  Link
Nyard
Registered User
 
Join Date: Jun 2020
Posts: 7
Quote:
Originally Posted by ChaosKing View Post
This seems not bad. Only 2-3 blends left
Code:
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?
Nyard is offline   Reply With Quote
Old 4th August 2020, 08:46   #7  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
How about this?
Code:
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.
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 4th August 2020, 09:15   #8  |  Link
Nyard
Registered User
 
Join Date: Jun 2020
Posts: 7
So right now my script looks like this:

Code:
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...
Nyard is offline   Reply With Quote
Old 4th August 2020, 09:33   #9  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
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...
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 4th August 2020, 09:42   #10  |  Link
Nyard
Registered User
 
Join Date: Jun 2020
Posts: 7
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:
Code:
yadifmod(mode=1, edeint=nnedi3(field=-2))
SRestore(frate=23.976)
Method 2:
Code:
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.
Nyard is offline   Reply With Quote
Old 4th August 2020, 11:04   #11  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
You most likely need to live with a tradeoff between no blends and missing frames or some blends but less.

Code:
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
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 4th August 2020, 13:04   #12  |  Link
Nyard
Registered User
 
Join Date: Jun 2020
Posts: 7
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
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.
Nyard is offline   Reply With Quote
Old 5th August 2020, 07:44   #13  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by Nyard View Post
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.
manono is offline   Reply With Quote
Old 5th August 2020, 08:52   #14  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
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:

Code:
NNEDI3(field=-2, qual=2)
d=ReduceBy2()
Srestore(frate=23.976, speed=-1, dclip=d)
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...

Last edited by Boulder; 5th August 2020 at 14:59.
Boulder is offline   Reply With Quote
Old 5th August 2020, 14:12   #15  |  Link
Nyard
Registered User
 
Join Date: Jun 2020
Posts: 7
Quote:
Originally Posted by manono View Post
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
Nyard is offline   Reply With Quote
Old 5th August 2020, 14:59   #16  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,733
Quote:
Originally Posted by Nyard View Post
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.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Reply

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 01:07.


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