Jump to content
Karyuuni

Deinterlace anime avisynth...

Recommended Posts

I'm having problems on the deinterlace of an anime, problems like the image, I've used the config down below, it worked for most of the animes I've tested it with few scenes having artefacts, but in that particular source almost all scenes look bad, I don't have experience with deinterlace, so I was configuring just the way that looked better for me. There is a way to fix that?

 

QTGMC(Preset="Medium", Sharpness=0, InputType=3, SourceMatch=3, FPSDivisor=1, ShowSettings=False, TR0=0, TR1=1, TR2=1, Rep0=0, Rep1=0, Rep2=0, RepChroma=false, Lossless=2)

 

Spoiler

SHwKC89.pnguxIm3s7.pngINSPsP2.pngbMjEKXp.png

 

Edited by Karyuuni

Share this post


Link to post
Share on other sites

Inverse telecine and deinterlacing problems cannot be diagnosed and solved from still frames. Post a sample of the VOB to videohelp.com and you'll get the help you need.

 

I can tell you that if you're actually deinterlacing and you still get ghosting then the source is field blended. In that case your options become very limited. 

Edited by SaurusX

Share this post


Link to post
Share on other sites

There are two main types of interlacing I think your source might be. Here you are some AviSynth code that works for each of them.

 

Pull Down (every X interlaced frames, there are Y non-interlaced frames) (the following method is known as pull down removal, inverse telecine, or field matching + decimating)

#Input: 29.970 fps
TFM()
TDecimate(mode = 1) #mode = 1 is for anime
#Output: 23.976 fps

For these two functions you need the TIVTC plugin: https://github.com/pinterf/TIVTC/releases/

 

Field blended (all frames are interlaced)

#Input: 29.970 fps
##Use any bob deinterlacer here: Yadif(mode=1), QTGMC(preset="Medium",Sharpness=0), ... (one that outputs double framerate video)
srestore(24.000/1.001)
#Output: 23.976 fps

You can find srestore here: https://pastebin.com/raw/PgnSUB2E. You've got to save that text as an .avsi file.

 

It's necessary that you specify the right field order (AssumeTFF() / AssumeBFF()) before using any of these filters. Specially if your source is .AVI, because AviSynth will assume it's BFF (Bottom Field First) and it might be TFF (Top Field First) instead. So try both of them to see if any fixes your problem. Having the wrong field order assumed will make all deinterlacers work badly.

 

Regarding the interlacing type (pull down or field blended) you might want to try the inverse telecine solution first, since it does'n need to process the video heavily (it can be executed in real time). In this case, interlaced video is like a puzzle of frames which can be solved. Thus, this method provides the best quality since the picture won't look filtered at all and no ghosting will be generated. You are just obtaining the original 23.976 fps footage. But if the video still looks interlaced, you have to try the other way.

 

There are companies who decide to interlace in the cheapest way: field blending. Your only solution is using a expensive deinterlacer. But you have to use srestore after the bobber to delete the frames with blends and keep the neatest ones, in a process that selects the frames closest to the ones in the original 23.976 fps footage. This process is slow and the quality depends on the bob deinterlacer you use. But it also works well in sources with pull down, so you are spending time and losing quality if you just do this to any interlaced anime without thinking of inverse telecine first.

 

If you apply a bob deinterlacer but don't decimate to 23.976 fps (what srestore does) you will have blends in any kind of source, be it a pull down interlaced or a field blended. However, blends in a field blended source would be way more abundant.

 

Speaking of quality, Yadif(mode=1) runs in real time but provides low quality. QTGMC's quality depends on the preset. A bob deinterlacer with very good quality and designed for anime sources is sanimebob(1), but installing all the plugins it requires is a pain in the ass. Anyway, you can find most of them here, in case you want to try. Here is a comparison between Yadif(mode=1) and sanimebob(1).

 

One a side note, there are deinterlacers that keep the input framerate, such as Yadif(mode=0). Most times, using these in anime is a massacre, since they can degrade the quality a lot and generate judder and other artifacts.

Edited by magiblot
  • Like 1

Share this post


Link to post
Share on other sites

Keep in mind that if it's fully field blended (as in a 29.97fps -> 25fps conversion) then srestore will not work. And it's very picky as to what parameters you set.  In the event that it was a 24fps -> 25fps (without speed up) you'd need:

 

srestore(frate=23.976)  #trying to use 24/1001 doesn't work in m experience

 

or for a 25fps -> 29.97fps you'd need:

 

srestore(frate=25)

 

As you see, you're always changing the frame rate back to what it was before the conversion.  The best advice is to not use PAL at all, but some NTSC DVD's use PAL sources, so it may be unavoidable.  Really though, since this is anime, just get the R2 disc.  All your headaches will disappear.

 

Share this post


Link to post
Share on other sites
2 hours ago, SaurusX said:

trying to use 24/1001 doesn't work in m experience

24/1001 is a thousand times smaller than 24/1.001. Forgetting the dot also forces an integer division without remainder so the result is roughly zero. But using 23.976 will just work the same as 24/1.001.

 

My example code above might not be very clear, but srestore has to be used after a bob deinterlacer. Applying srestore directly on the interlaced video won't work. But Bobber+srestore(23.976) works fine in 23.976->29.970 field blending (which I guess is the most common in NTSC field blends).

 

However, for PAL 29.970->25 field blends from a NTSC master it won't work that well. A frame-accurate quality solution for this would be:

 

#Input: 25 fps fieldblended from 29.970 fps telecined from 23.976 fps
AnimeIVTC(mode=2,bbob=4,edimode="NNEDI3",normconv=true) #bbob=4 uses QTGMC
#Output: 23.976 fps

However, you can expect ghosting and artifacts from the NTSC to PAL conversion.

I hope you are not in such case!

 

Edited by magiblot

Share this post


Link to post
Share on other sites

You're right about the frame rate divisor. I meant what you wrote. But in the case of that last code example, you're better off not running srestore at all and just using the 25fps source if you absolutely have to. There are many cartoon series like this (e.g. RoboCop and Inhumanoids). Only use srestore if it's possible to return to some semblance of progressive video. 

Share this post


Link to post
Share on other sites
20 minutes ago, SaurusX said:

But in the case of that last code example, you're better off not running srestore at all and just using the 25fps source if you absolutely have to. There are many cartoon series like this (e.g. RoboCop and Inhumanoids). Only use srestore if it's possible to return to some semblance of progressive video. 

 

I'm a bit confused by your reply :/. Are you talking about the 29.970->25 fps case? My code about this case doesn't mention srestore explicitly. Can you share a sample script of what you would do? Because srestore is only part of the process and it does not deinterlace, so I don't exactly understand the result you are aiming for without it (apply just the bob deinterlacer? apply a deinterlacer that doesn't change the framerate?)

Share this post


Link to post
Share on other sites

Yes, I'm talking about the 29.97—> 25 case.  Animeivtc(mode=2) is srestore, but it's parameters are chosen for you.

 

The entire point of srestore is to be a deblender for norm conversions. If you cannot ever return to a progressive clip (like in the case of a telecined 29.97 -> 25 PAL DVD) then srestore is useless. Every field in the PAL DVD is going to be a blend of fields from the NTSC source.

 

My solution in that case would be to deinterlace with QTGMC and use fpsdivisor=2. That's the best you can do by eliminating the interlacing artifacts, but the blends cannot be removed. 

Edited by SaurusX

Share this post


Link to post
Share on other sites
57 minutes ago, SaurusX said:

Animeivtc(mode=2) is srestore

 

Excuse me, I wasn't sure that you knew it. :)

 

57 minutes ago, SaurusX said:

My solution in that case would be to deinterlace with QTGMC and use fpsdivisor=2. That's the best you can do by eliminating the interlacing artifacts, but the blends cannot be removed.

 

Ok, I get what you mean. But I don't agree with you: srestore in field blended sources is useful for removing judder (aka jerkiness), because it selects the frames that were more likely to be part of the original 23.976 fps animation. Actually, I use it because I have seen it suggested in Doom9 forums a couple of times.

 

https://youtu.be/E1GKoG1-MJM?t=1m43s

https://youtu.be/BQM7Q1krPKc?t=1m17s

 

This example here has lots of additional ghosting because it's a bad VHS release, though.

 

EDIT: Well, this really isn't a very good example to prove anything. I should go find some NTSC DVD field blended content for studying this more. I don't expect anything good from PAL field blends because it's a two-step interlacing.

 

What harm could srestore do?

Edited by magiblot

Share this post


Link to post
Share on other sites
23 minutes ago, magiblot said:

What harm could srestore do?

True. It MAY be able to choose a better sequence of frames compared to simply taking the top field of every frame. I can see it going that way, but it's a bad situation no matter what and really comes down to personal preference. 

Edited by SaurusX
  • Like 1

Share this post


Link to post
Share on other sites
11 hours ago, magiblot said:

Regarding the interlacing type (pull down or field blended) you might want to try the inverse telecine solution first, since it does'n need to process the video heavily (it can be executed in real time). In this case, interlaced video is like a puzzle of frames which can be solved. Thus, this method provides the best quality since the picture won't look filtered at all and no ghosting will be generated. You are just obtaining the original 23.976 fps footage. But if the video still looks interlaced, you have to try the other way.

 

For the Kage Kara Mamoru DVDs, IVTC is perfect for slow-motion ones but looks terrible during high-motion scenes so I was planning on merging different scenes de-interlaced differently using frame-rate conversion. For the high motion scenes I was going to use:

 

#source is 29.97 interlaced

QTGMC()  #29.97->59.94 progressive

selectEven() #29.97 progressive

ConvertFPS(24000/1001) #change framerate (by dropping frames) to match rest of stream

 

It is helpful to know that I should play around with the AssumeTFF() and AssumeBFF() before QTGMC().

 

So my question is that from your post you are advocating using QTGMC and then srestore(24000/1001) but srestore seems to have something to do with blending or ghosting or something? 

 

The wiki page says "conditional frame evaluation" ...what? If you are trying to remove blended frames, then would that not be a non-issue if using QTGMC() since QTGMC basically takes the existing fields and creates frames out of them using magic according to my reading of the documentation page: http://avisynth.nl/index.php/QTGMC, so either progressive scan or motion compensation or similar black magic. I can't see a single blended frame using QTGMC(preset=placebo).selectEven() so what does srestore really do?

 

It also doesn't handle motion any better as far as I can tell. QTGMC().selectEven().ConvertFPS() looks perfectly smooth to me, so I do not view that as a point of contrast. I could test that more I guess?

 

I will test the practical effects of it later but what is the theoretical point of srestore? I don't get it.

 

Maybe if I had literally-blended frames from an analog LD I could use srestore to pick out the non-blended frames? At that point tho, I might as well dump the stream to a series of images, stitch the blended frames together photoshop and re-animate them in Premier. So...what is srestore for again?

Share this post


Link to post
Share on other sites

The point of strestore is that it does frame decimation by analyzing which frames have more blending and which less. SelectEven()+ChangeFPS() is a dummy way of doing this since they only rely on the frame number. If you are lucky, the result can still be good, though.

 

QTGMC (a motion compensated bob deinterlacer) does not do any black magic (but it's quite close to it :)). To understand what it does, call SeparateFields() after importing the video and comment out everything else. You will see the original fields of half the vertical resolution of the video (there are two fields per frame, so now the framerate is twice the original). So, a bob deinterlacer tries to generate a full-height frame out of every field by gathering information from the adjacent fields. That's why the framerate it's doubled. The math inside QTGMC makes it possible to get a good quality result.

 

When the interlacing is due to a framerate conversion, some fields might have blending and others not. Srestore would try to pick the ones with less blending, what you did doesn't, yet you don't get blended frames by chance.

 

Regarding the field order, the whole video should be the same. If you are importing a VOB through DGIndex it should be okay without any of the Assume functions.

Edited by magiblot
  • Like 1

Share this post


Link to post
Share on other sites

An important thing to note is that you can't seek in an AviSynth script that uses srestore. It will only work well if going forward.

Edited by magiblot

Share this post


Link to post
Share on other sites

I'll try the video help, I have no idea if I'm not doing it right or the source is really bad.

 

If someone with time wants to try, I have the complete ISO link, I will not send it because I do not remember if I can post links here.

Edited by Karyuuni

Share this post


Link to post
Share on other sites

I'm having, ghosts, traces, white lines, duplicates, all bad when doing deinterlace. I used the filters below, one at a time, combined, among others and all are very problematic. I do not really know how to make it work, I'll leave a sample of each video below.

 

AssumeTFF()
#TFM(pp=0)
#TDecimate(mode=1, hybrid=0)
#AssumeFPS(24)
#QTGMC(Preset="slow", Sharpness=0.0, InputType=3, SourceMatch=3, ShowSettings=False, TR0=0, TR1=0, TR2=3, Rep0=0, Rep1=0, Rep2=0, RepChroma=false)
#eedi3()
#QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3)
#eedi3()
#QTGMC(Preset="placebo", Sharpness=0.0, InputType=3, SourceMatch=3, ShowSettings=False, TR2=3, lossless=1)
#daa()
#srestore(frate=25)

 

 

Video 1: http://www.mediafire.com/file/q9jc1c5m9lm7d8y/Total_Drama(00h00m00s-00h02m00s)-001.mkv
Video 2: http://www.mediafire.com/file/c3u1o556deinyje/Samurai_Sho(00h07m00s-00h09m00s)-002.mkv

 

 

Edited by Karyuuni

Share this post


Link to post
Share on other sites

For the Total Drama episode this is the best solutiion, I think:

 

assumetff()
QTGMC(preset="slower",sourcematch=3,lossless=2,tr2=0,edimode="nnedi3")
srestore(frate=23.976,speed=-1, cache=10)

 

Not much you can do regarding the ghost lines.  It's a bad PAL transfer.

Share this post


Link to post
Share on other sites
36 minutes ago, SaurusX said:

For the Total Drama episode this is the best solutiion, I think:

 

assumetff()
QTGMC(preset="slower",sourcematch=3,lossless=2,tr2=0,edimode="nnedi3")
srestore(frate=23.976,speed=-1, cache=10)

 

Not much you can do regarding the ghost lines.  It's a bad PAL transfer.

There really is not much to do anyway, right? The source is bad. Well, thanks for the help, I'll leave it that way.

Share this post


Link to post
Share on other sites
On 9/1/2017 at 2:20 PM, YukinoAi said:

 

For the Kage Kara Mamoru DVDs, IVTC is perfect for slow-motion ones but looks terrible during high-motion scenes so I was planning on merging different scenes de-interlaced differently using frame-rate conversion. For the high motion scenes I was going to use:

 

#source is 29.97 interlaced

QTGMC()  #29.97->59.94 progressive

selectEven() #29.97 progressive

ConvertFPS(24000/1001) #change framerate (by dropping frames) to match rest of stream

 

It is helpful to know that I should play around with the AssumeTFF() and AssumeBFF() before QTGMC().

 

So my question is that from your post you are advocating using QTGMC and then srestore(24000/1001) but srestore seems to have something to do with blending or ghosting or something? 

 

The wiki page says "conditional frame evaluation" ...what? If you are trying to remove blended frames, then would that not be a non-issue if using QTGMC() since QTGMC basically takes the existing fields and creates frames out of them using magic according to my reading of the documentation page: http://avisynth.nl/index.php/QTGMC, so either progressive scan or motion compensation or similar black magic. I can't see a single blended frame using QTGMC(preset=placebo).selectEven() so what does srestore really do?

 

It also doesn't handle motion any better as far as I can tell. QTGMC().selectEven().ConvertFPS() looks perfectly smooth to me, so I do not view that as a point of contrast. I could test that more I guess?

 

I will test the practical effects of it later but what is the theoretical point of srestore? I don't get it.

 

Maybe if I had literally-blended frames from an analog LD I could use srestore to pick out the non-blended frames? At that point tho, I might as well dump the stream to a series of images, stitch the blended frames together photoshop and re-animate them in Premier. So...what is srestore for again?

So I am curious, are you using QTGMC with avisynth? When I try to use it this way it just kills my computer. Perhaps my AMD FX-4300 Quad overclocked at 4.3MHz isn't fast enough? It is what I rather assumed when I got no result other than seemingly locked sessions.

Share this post


Link to post
Share on other sites

Yes, I am using QTGMC with AviSynth. I suppose I could do it in VapourSynth, since the filter has been ported, but there is no real reason to. I have an FX 8350 @ 3.4 Ghz (throttled) and it runs slowly, but does not lock up.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

  • Similar Content

    • By Pi7on
      So, it's a while no that I'm trying to use Avisynth, but every time there seems to be a different error, so I figured I'd just ask here a few question to get rid of some doubts and to better understand the software. (I'm obviously a beginner so be patient 😅)
       
      Ok, this is what I have installed now:
      - Avisynth 2.6.0
      - Avisynth +
      - AvsPmod
       
      Here's the things I still don't understand that I think are preventing me from using the program correctly:
      1. When I download some new plugins, in what folder am I supposed to put them? In the plugins folder of Avisynth, or in the plugins folder of Avisynth +?
          And if its Avisynth +, witch of the 3 plugins folder?? (+ , 64, 64+)

      2. When I load a source, how do I know which decoder to chose? (LWLibavVideoSource , DirectShowSource, etc..) 

      3. Should I aim for 32 or 64 bit plugins?
    • By Maynard
      Hi-dee-ho, Maynard here
       
      I'm looking to remaster The Angry Beavers using the Shout Factory DVDs and AviSynth filters TComb and WarpSharp.
      Here are some samples of the filters in effect:
      http://screenshotcomparison.com/comparison/123278
      http://screenshotcomparison.com/comparison/123279
       
      There's just one problem standing in the way.
      The filter I'm using to remove the Dot Crawling seems to be merging with the wrong frame:
       
      Each frame in the original footage has an identical one right after that, where if you blend them together, their individual dots cancel each other out. Is there any way to blend the frames with their identical variations instead of the different frame after?
       
      I'm looking only to restore Seasons 3 & 4, as 1 & 2 don't have these issues, and are just blurry (as if the camera was near-sighted.)
       
      On a side note: Are there any other filters I should add?
    • By -Lousy
      I was wondering if anyone could point me in the right direction getting started with color correction with staxrip and either VapourSynth or AVIsynth. I have experiencescripting with them before, but it was mainly for encoding not actual mastering of a video.
       
      Thanks
    • By Karyuuni
      It's possible to convert to "native" 10 bits on avisynth? Because even with filters modified to high bit depth, after extracting lossless a 8bit archive comes out, and using a 10 bit output of some filters like flash3kyuu deband, it duplicates the height, but the duplicated half is odd, and even that way, a 10bit RAW doesn't come. How can I proceed? I want it necessarily on avisynth, and not the conversion to 10bits that it's possible to do with the x264 codec during the conversion.
       
      Double height bug example:
       
       
    • By Nikolai Smirnof
      Hey everyone, I'm attempting to encode videos into higher framerates through frame interpolation. Currently, I use Smooth Video Project 4 (SVP 4) to prerender the given video file up to 144 fps (limited by my monitor's refresh rate), which is temporarily stored in RAM during playback.
       
      If possible, I would like to use Interframe, an AviSynth script, to increase a given video's framerate by an integer multiple of my choice through video encoding. While I would be interested in learning how to achieve this through 10 bit HEVC, I'd be perfectly fine figuring out encode interpolation using 8 bit AVC. Does anyone have ideas on how this can be achieved?
×