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 11th August 2020, 21:31   #1  |  Link
skywalker
Registered User
 
Join Date: Sep 2017
Posts: 37
Help with de-interlace frame by frame.

I have been studying and researching avisynth, but as English is not my official language, I feel that I have difficulty understanding some documentation.

So the problem is:

I'm using TFM (order = 1, mode = 5, slow = 2) .Vinverse () to de-interlace my clip videos, as I'm getting a result without much change from the real, sharp video. I really like the output of the videos I'm getting about this.

However, I realized that some isolated frames were not de-interlaced.

How can I manually de-interlace these isolated frames? Frame by frame. It is possible?

Last edited by skywalker; 11th August 2020 at 21:40.
skywalker is offline   Reply With Quote
Old 11th August 2020, 23:48   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Have you tried bob de-interlacing? It de-interlaces 29.97fps sources to 59.94fps, and 25fps sources to 50fps. Motion should look smoother.
QTGMC is probably the best bob de-interlacer, but there's other options. QTGMC de-interlaces the whole frame so it should never leave any combing. It's quite slow, but once you have it working, adding the following to a script for bob de-interlacing should look pretty good.

QTGMC()

For TFM,
cthresh is used to adjust the threshold for combing detection. The default is cthresh=9. Lower values might help it detect more combing. When cthresh=-1, everything is deinterlaced.
MI adjusts how much combing there needs to be inside each picture "block" for it to be considered combed. The default is MI=80. Lower values will also detect more combing. When MI=0, everything is deinterlaced.

TFM has other settings but they're the two you'd want to start with. You can also use an over-rides file to force TFM to de-interlace some frames, if you can be bothered looking for the frame numbers.

TFM(order=1, mode=5, slow=2, cthresh=9, MI=80, ovr="D:\OverFile.txt")

Quote:
55,81 +
234 +
658 +
The above for the over-rides file tells TFM to de-interlace frames 55 through to 81, frame 234 and frame 658.

If you want to try bob deinterlacing instead, TDeint is from the same guy as TFM and has similar options.

Or you could try one of the functions below to bob deinterlace with TFM. They'll both output 59.94fps for NTSC and 50fps for PAL. The second one takes pixels from a clip de-interlaced by QTGMC instead of TFM doing the de-interlacing itself. You can still use cthresh and MI etc to adjust the combing detection.

Quote:
function TFMBob(clip Vid) {
GetParity(Vid) ? \
Interleave(TFM(Vid, field=1), TFM(Vid, field=0)) : \
Interleave(TFM(Vid, field=0), TFM(Vid, field=1)) }
Quote:
function TFMQBob(clip Vid) {
DeintClip = Vid.QTGMC()
DeintClip1 = DeintClip.SelectEven()
DeintClip2 = DeintClip.SelectOdd()

GetParity(Vid) ? \
Interleave(TFM(Vid, field=1, Clip2=DeintClip1), TFM(Vid, field=0, Clip2=DeintClip2)) : \
Interleave(TFM(Vid, field=0, Clip2=DeintClip1), TFM(Vid, field=1, Clip2=DeintClip2)) }
hello_hello is offline   Reply With Quote
Old 12th August 2020, 00:12   #3  |  Link
skywalker
Registered User
 
Join Date: Sep 2017
Posts: 37
Hey, helo helo,
Thank you so much. I'll do the tests and come back to tell.

I've used several functions of QTGMC and it's true that it de-interlaces everything. What I don't like is that it always changes the appearance of the video, especially the edges. It is amazing, but I wanted a deinterlace that would not change the appearance too much, that would keep the grain and the edges like the original. Or at least the closest to that, as TFM does in the frames that it works well with deinterlacing.

But I will continue to try the QTGMC. Maybe I will find something, because it has an incredible variety of functions, I still can't understand them all.

Thank you for your help.

Last edited by skywalker; 12th August 2020 at 00:14.
skywalker is offline   Reply With Quote
Old 12th August 2020, 00:19   #4  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,902
Quote:
Originally Posted by skywalker View Post
as English is not my official language, I feel that I have difficulty understanding some documentation.
Oh... that's a bit unexpected coming from a Skywalker...


(Sorry, I had to make that joke xD)

Jokes aside, Hello_Hello already suggested QTGMC and I definitely agree with him. It is slow, but it's worth it.
You can actually use QTGMC without the heavy built-in filtering it has; for instance, you can add tr2=0 to skip the degraining part.
Otherwise you can try with other deinterlacing filters like TDeint (although they won't provide the same quality as QTGMC):


Code:
tdeint(mode=2, order=-1, field=-1, mthreshL=6, mthreshC=6, map=0, type=2, debug=false, mtnmode=1, sharp=true, cthresh=6, blockx=16, blocky=16, chroma=true, MI=64, tryWeave=true, link=1, denoise=true, slow=2)
or bobbing like so:

Code:
tdeint(mode=1, order=-1, field=-1, mthreshL=6, mthreshC=6, map=0, type=2, debug=false, mtnmode=1, sharp=true, cthresh=6, blockx=16, blocky=16, chroma=true, MI=64, tryWeave=true, link=1, denoise=true, slow=2)
There's also Yadif as another deinterlacing filter: http://avisynth.nl/index.php/Yadifmod2

Last edited by FranceBB; 12th August 2020 at 00:26.
FranceBB is offline   Reply With Quote
Old 12th August 2020, 01:00   #5  |  Link
skywalker
Registered User
 
Join Date: Sep 2017
Posts: 37
Quote:
Originally Posted by FranceBB View Post
Oh... that's a bit unexpected coming from a Skywalker...


(Sorry, I had to make that joke xD)
I love people in a good mood, so you don't need to apologize. Haha

Thank you so much France and Helo Helo. I'm going to test all of these options and come back to tell you what seemed to be the best for me.

Thank you brother.
skywalker is offline   Reply With Quote
Old 12th August 2020, 02:45   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
TFM is NOT a deinterlacer. It is only used for 24 fps film that was encoded into a 29.97 fps NTSC video stream. If your goal is to deinterlace material that started out as 29.97 fps interlaced video and did not originate as film, they you should not be using TFM at all.
johnmeyer is offline   Reply With Quote
Old 12th August 2020, 19:26   #7  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
Quote:
Originally Posted by johnmeyer View Post
TFM is NOT a deinterlacer. It is only used for 24 fps film that was encoded into a 29.97 fps NTSC video stream. If your goal is to deinterlace material that started out as 29.97 fps interlaced video and did not originate as film, they you should not be using TFM at all.
TFM IS a de-interlacer.
It's both a field matcher and de-interlacer. How else could it handle hybrid sources (combinations of 23.976fps telecined film and 29.97fps interlaced video)?

To force it to effectively work as a de-interlacer only for interlaced sources, you could limit it's field matching to the current field of the opposite parity. By default it checks the current and next field. Failing that, it can check the previous field and even choose to not use the field it was originally trying to match from, and match from the previous or next one instead. Limiting it's field matching with mode=0 means it can only try to match the current field of the opposite parity, and de-interlace rather than look for alternatives if there's combing.

TFM(mode=0, micmatching=0)

The default of mode=1 though, at least gives TFM a chance to match fields that are out of phase, but not really interlaced, instead of just blindly de-interlacing them as I assume most de-interlacers would.
TDeint is a de-interlacer with a couple of field matching options. It's also from the author of TFM.

From the TFM help file, these are the de-interlacing choices:

PP =
0 - nothing (don't even look for combed frames)
1 - find/hint combed frames but don't deinterlace
2 - dumb blend deinterlacing
3 - dumb cubic interpolation deinterlacing
4 - dumb modified-ela deinterlacing
5 - motion-adaptive blend deinterlacing
6 - motion-adaptive cubic interpolation deinterlacing
7 - motion-adaptive modified-ela deinterlacing

Last edited by hello_hello; 13th August 2020 at 09:12.
hello_hello is offline   Reply With Quote
Old 12th August 2020, 19:41   #8  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
skywalker,
Here's a trick for when you're playing with TFM's settings.

Normally the Clip2 argument is specified for TFM to take pixels from a de-interlaced clip where it detects combing, rather than de-interlace itself, but it can also be handy for checking what's actually being de-interlaced. By simply using a very bright version of the video rather than a de-interlaced version, it can help to see where TFM is detecting combing and what it's missing. In the pic below, the white pixels are where TFM will be de-interlacing, once the Clip2 argument is removed.

DeintClip = Tweak(Bright=200)
TFM(Clip2=DeintClip)



The default for the PP argument is 6. When PP is less than 5 and a clip is specified for Clip2, instead of replacing just the combed pixels in a frame, TFM replaces the entire frame with the frame from the de-interlaced clip, when combing is detected.

For example:
DeintClip = Tweak(Bright=200)
TFM(Clip2=DeintClip, PP=1)

Last edited by hello_hello; 12th August 2020 at 20:21.
hello_hello 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 14:08.


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