Deinterlacing

Anything related to video and my tools that is not a support request.
Post Reply
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Deinterlacing

Post by Mat1926 »

Hi guys,

I am new to all this, and recently I started using avisynth. I did some basic stuff with it and now I am at the stage where I would like to deinterlace my videos.

My sources are DVDs and Blu-Rays. In the meantime, I am working on a 25 fps 1080i video (as reported by media info), what shall I do in order to investigate the video and deinterlace it properly?

Thnx
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

The first thing to understand is that just because MediaInfo reports something as interlaced, it may not really be interlaced. It is a question of flagging versus the actual content. You have to identify the true nature of the video before deciding how to process it. That processing may be deinterlacing, IVTC, field shifting, or nothing at all. So how do you identify the nature of the video? See here:

http://rationalqm.us/faq.html

Then when you have decided what needs to be done you can:

Interlaced: Use DGSource() with deinterlace=1 or deinterlace = 2, or the DGBob() built in to DGDecodeNV.dll.
Telecined: Use fieldop=1 for soft telecine, or use DGTelecide() and DGDecimate() for hard telecine.
Field shift: Avisynth+ script.

For specific help, post about a specific video, rather than asking in general terms.
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

Thanks for the reply. I'll check the link and post back if I needed further help with more details about my source... :salute:
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

admin wrote:
Thu Mar 29, 2018 7:02 am
http://rationalqm.us/faq.html
Hey, Thnx for the link. I am currently working on a DVD, the frame rate is 29.970, and according to the link you provided -AssumeTFF(), SeparateFields()- it is showing aaa bb ccc dd pattern -i.e. 3:2 pulled-down- Does this make any sense at all? Shall I bring the frame rate down to 23.976? if so, how?

Thnx

*edit*
It seems my case is Telecined, so you did say "Telecined: Use DGTelecide() and DGDecimate()", so how can I use those? Are there alternatives?!

*edit2*
This "DGTelecide().DGDecimate()" crashed AvsPmod, and this "TFM().TDecimate()" did not crash it...what is the difference between the two? And which one is best?

again thnx
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

Let's address the crashing then talk about undoing telecine afterwards. Please anser these questions:

1. What version of DGDecNV are you using (version and slipstream number, get from Help/About). You should be using 2053.0.0.147.

2. What is your nVidia card and driver version?

3. Please show your complete script.

4. What happens if you drop the script on VirtualDub?

5. Avspmod works fine for me with DGSource().DGTelecide().DGDecimate(). What version of Avspmod are you using and what error message are you seeing?
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

1. What version of DGDecNV are you using (version and slipstream number, get from Help/About). You should be using 2053.0.0.147.

I am still on 132. It does not crash any more...

2. What is your nVidia card and driver version?

1080Ti

3. Please show your complete script.

Code: Select all

LoadPlugin("Q:\dgdecnv2053\DGDecodeNV.dll")
DGSource("MyDVD.dgi").DGTelecide().DGDecimate()
Crop(8, 4, -2, -10)
4. What happens if you drop the script on VirtualDub?

Works!

5. Avspmod works fine for me with DGSource().DGTelecide().DGDecimate(). What error message are you seeing?

I don't have any errors any more. I was doing something like this

Code: Select all

DGSource("MyDVD.dgi")
DGTelecide().DGDecimate()
Which did not work. Then I did this

Code: Select all

DGSource("MyDVD.dgi").DGTelecide().DGDecimate()
and now it works...
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

What are the disadvantages of using "TFM().TDecimate()" ?

And now there is another issue which is entirely not related to your awesome work, but I will ask you might give me a hint why this is happening...

In the past x264 Launcher worked w/o issues, and today it is reporting error x264 couldn't read input file '0'! Any clues why am I getting this? My input file is the one I showed you in my previous post...
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

One thing at a time!

First, you did not give your nVidia driver version. I need that.

Second, you should update to the latest DGDecNV slipstream 147. I'm reluctant to support older versions.

DGSource("MyDVD.dgi")
DGTelecide().DGDecimate()

This should not crash and does not for me. Do you want to try again and follow up on it, or do you want to move on to your other questions?
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

admin wrote:
Sun May 06, 2018 9:41 am
This should not crash and does not for me. Do you want to try again and follow up on it, or do you want to move on to your other questions?
I'll update to the latest, test and report back...Just give me few minutes to sort this out...

Thnx a lot
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

Take your time to do things carefully.
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

admin wrote:
Sun May 06, 2018 9:41 am
Second, you should update to the latest DGDecNV slipstream 147. I'm reluctant to support older versions.
I just updated to the latest 147 version, and like you said nothing fails now, having the commands on separate lines also works...Regarding the NVIDIA driver number, now I am updating to the latest one 397.31....
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

OK, cool. Does that also mean x264 launcher is not failing now too?

About undoing telecine. First we need to know if it is soft or hard telecine. Load the source in DGIndexNV and then save project. What is the film percentage reported at the bottom of the DGI file?
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

admin wrote:
Sun May 06, 2018 10:09 am
OK, cool. Does that also mean x264 launcher is not failing now too?

About undoing telecine. First we need to know if it is soft or hard telecine. Load the source in DGIndexNV and then save project. What is the film percentage reported at the bottom of the DGI file?
No X264 launcher does not work!

Code: Select all

Simple x264 Launcher (Build #1124), built 2018-02-27
....
....
x264 [error]: could not open input file `0'
The film % is 0.00.
What are the expected values here?!

Thnx
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

Please give the exact steps you do to get this error in SimpleLauncher. Also give the full log from SimpleLauncher. It works fine for me without error.

Telecining stuff comes after we resolve this error.
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

admin wrote:
Sun May 06, 2018 10:24 am
Please give the exact steps you do to get this error in SimpleLauncher.

Telecining stuff comes after we resolve these errors.
The issue is in the new custom preset that I just made :facepalm:, I used an older one that worked in the past and the x264 launcher now works w/o issues at all. I need to investigate the changes I made to this preset. Now there are no issues with the x264 launcher...

Thnx
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

OK, on to inverse telecining.

Because you have 0% film, that is hard telecining and you will need to use IVTC filters rather than just fieldop=1 in DGSource(). If this is not making any sense to you, you'll have to do some research on it on your own. Other video forums can be very helpful in this regard. This forum is for support of my tools and related matters.

DGTelecide().DGDecimate():

The advantage here is that it is CUDA-accelerated and so it will be faster and leave more CPU for encoding.

TFM()/TDecimate():

The advantage here is that it is more flexible with additional parameters for tweaking.

If DGTelecide().DGDecimate() is not meeting your needs, I'd love to hear more about it with a view to enhancing it as needed.
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

admin wrote:
Sun May 06, 2018 10:42 am
If DGTelecide().Telecide() is not meeting your needs, I'd love to hear more about it with a view to enhancing it as needed.
You said this "DGTelecide().Telecide()", is this what you really meant ?!
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

Of course not.

DGTelecide().DGDecimate()
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

After finding out the field order, do we still need AssumeTFF() in our code ?

Code: Select all

AssumeTFF()
DGTelecide().DGDecimate()
Also, what if some interlacing artifacts were detected at the edges after our previous step, do you think something like this is needed?

Code: Select all

QTGMC(preset="fast").SelectEven()
Thnx
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

You should not need an AssumeFPS() call, as DGSource() sets it for Avisynth+. It is harmless to include, however, as long as it is set correctly.

You have telecined material (unless you are now talking about a different source). You can't sensibly use QTGMC on it.

If you have artifacts with DGTelecide/DGDecimate, please link to an unprocessed sample video and give your script.
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

How can I extract a sample w/o processing that is reasonable in size for you? What method is best?

Thnx

*edit*
I also would like to PM you some screens, I prefer not to put them in public...is that okay?!

Thnx
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

Open the stream in DGIndexNV. Set a range around the desired sample area with the [ and ] buttons. Go into Demux and enable video demuxing. Save project. You will get an M2V file (assuming your source is still VOB).

A possible host is tinyupload.com (50MB max).

Yes, go ahead and PM me the screens.
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

Next time please give a much larger sample, 25-50 MB.

You have two problems. First your cropping is invoking the Chroma Upsampling Error (CUE). You have to crop in multiples of 4. So do this:

Crop (8, 8, -24, -4)

You can use the DGIndexNV cropping filter if you like, instead of the Avisynth internal Crop(). It will enforce multiples.

Second, you have noisy fields, which can look like interlacing. Suppose the pattern is:

a a a b b c c c d d ...

The three a fields should be identical (after vertical alignment), but when stepping through by fields you can see that they differ by noise and other distortions. If the residual combing caused by this bothers you (to me it looks too small to be visible when viewed at normal size and speed) then you can tweak the postprocessing.

I will tell you again that this 3:2 telecined stream is not suitable for QTGMC and won't comment any further on that. Also, it won't return your frame rate to 23.976.
DAE avatar
Mat1926
Posts: 13
Joined: Thu Mar 15, 2018 9:16 am

Re: Deinterlacing

Post by Mat1926 »

admin wrote:
Tue May 08, 2018 5:55 pm
You have to crop in multiples of 4. So do this:
Always multiple of 4, or for some special cases? I always used multiple of 2...
User avatar
admin
Posts: 4554
Joined: Thu Sep 09, 2010 3:08 pm

Re: Deinterlacing

Post by admin »

Post Reply