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 > General > Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th April 2019, 12:28   #1  |  Link
sebastiang
Registered User
 
Join Date: Jan 2019
Posts: 13
How to deinterlace PAL TV recording of a NTSC TV show

How do I properly deinterlace video recorded from PAL DVB-T of a NTSC TV show without ghosting?

Sample: https://mega.nz/#!2BJlyaxJ!fwvqDNLJr...1imx24fyuR4qhY

Thank you for help.
sebastiang is offline   Reply With Quote
Old 26th April 2019, 17:33   #2  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
I think the following simple script does a pretty good job on this clip (except for the first couple of frames, but this is probably due to editing a Transport Stream).

Quote:
DSS2("test.ts")
AssumeTFF()
Yadif(mode=1)
Srestore()
Of course you can use different source filters and a better bobber. And if you need a PAL result you have to speed up the 23.976 frame rate to 25.


Cheers
manolito

Last edited by manolito; 26th April 2019 at 17:35.
manolito is offline   Reply With Quote
Old 26th April 2019, 19:37   #3  |  Link
sebastiang
Registered User
 
Join Date: Jan 2019
Posts: 13
Thank you for help, but when I use your script I can still see noticeable ghosting:



Sample with this scene: https://mega.nz/#!yQoR3AaZ!EbbopgJDD...GNSfd-u6hCx4cI

Is it possible to get rid of it totally?
sebastiang is offline   Reply With Quote
Old 26th April 2019, 20:36   #4  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
You could play with the Srestore parameters. You should check the double blend removal feature. In another thread I found a post by hello_hello, he used these pasrameters:
Quote:
SRestore(mode=-1,omode="pp3", thresh=12, speed=-1, cache=10)
Good luck
manolito
manolito is offline   Reply With Quote
Old 29th April 2019, 08:53   #5  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Oh God...
You see, those are the bad things of legacy hardware encoders.



When I tried to index it with FFMpegSource2, it reported the wrong framerate as 50fps, while it's really 25i.
LWLibavVideoSource actually got it right as 25i.
When I tried to bob it to get 50fps progressive, I quickly noticed what they have done: blending.



Basically, I believe that this was originally at a lower framerate (23.976fps I think) and that it has been brutally field blended to 25i. (50fps).

You have three choices:

Choice #1:
You can bob-deinterlace it to 50fps progressive and get it exactly as people saw it on TV when it went on air:

Code:
#Indexing
video=LWLibavVideoSource("test.ts")
audio=LWLibavAudioSource("test.ts")
AudioDub(video, audio)

#Bobbing
QTGMC()
If you think that it's too slow, you can try with tdeint:

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, opt=4)
if you still think that it's too slow you can try with Bob:

Code:
Bob()

Choice #2:
You can deinterlace it to 25fps progressive and at least get less blending, but it's still gonna be annoying every second:

Code:
#Indexing
video=LWLibavVideoSource("test.ts")
audio=LWLibavAudioSource("test.ts")
AudioDub(video, audio)

#Deinterlace
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, opt=4)

Choice #3:
Deinterlace it to 25fps and then use SRestore to try to recover the original 23.976fps. It may not be perfect, but it's worth giving a shot (even though the default parameters fail to properly detect blending in this case, so you are better off with the ones provided by Manolito).


Code:
#Indexing
video=LWLibavVideoSource("test.ts")
audio=LWLibavAudioSource("test.ts")
AudioDub(video, audio)

#Deinterlace
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, opt=4)

#Decimating
SRestore(frate=23.976)
By the way, for this kind of interlaced .ts sources, one of the best indexers is DGDecode.




Choose your preferred option.
If you ask me, I would bob it to 50fps and stick with blending as it's not too painful to watch or better still, keep it interlaced while re-encoding it.
As to the problem you've got in your screenshot, that's only because of screwed up fields that have been improperly deinterlaced; I bet that DirectShowSource fucked up while decoding it (and if you drop something in an interlaced source, that's what happens).

Cheers,
Frank.

Last edited by FranceBB; 29th April 2019 at 09:06.
FranceBB is offline   Reply With Quote
Old 1st May 2019, 02:15   #6  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by FranceBB View Post

Choice #3:
Deinterlace it to 25fps and then use SRestore to try to recover the original 23.976fps.
You have to double rate deinterlace (to 50fps in this case) for srestore to work correctly . It has to choose from the remaining blends . If you discard 1/2 of them before it chooses, it won't make the correct choice

It works ok a good source filter is used (not directshow) . But there is a slight blend when a cleaner frame could have been chosen on the screenshot in post#3 using default settings. Perhaps settings could be tweaked, or manual override could be specified. But it's hardly noticable during playback since it's right before the scene change

Quote:
As to the problem you've got in your screenshot, that's only because of screwed up fields that have been improperly deinterlaced; I bet that DirectShowSource fucked up while decoding it (and if you drop something in an interlaced source, that's what happens).
Yes, post #3 is most likely a directshow decoding problem
poisondeathray is offline   Reply With Quote
Old 3rd May 2019, 12:04   #7  |  Link
sebastiang
Registered User
 
Join Date: Jan 2019
Posts: 13
Thank you guys for help!

Quote:
Originally Posted by poisondeathray View Post
Yes, post #3 is most likely a directshow decoding problem
I was actually using DGIndexNV and DGSource there.
sebastiang is offline   Reply With Quote
Old 3rd May 2019, 19:39   #8  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,823
Maybe try the another indexer/decoder, because it looks fine here.

LWLibavVideoSource("D:\ghost.ts.lwi")
Yadif(mode=1)
SRestore()
Info()

hello_hello is offline   Reply With Quote
Old 24th May 2019, 11:12   #9  |  Link
sebastiang
Registered User
 
Join Date: Jan 2019
Posts: 13
Quote:
Originally Posted by sebastiang View Post
Thank you for help, but when I use your script I can still see noticeable ghosting:



Sample with this scene: https://mega.nz/#!yQoR3AaZ!EbbopgJDD...GNSfd-u6hCx4cI

Is it possible to get rid of it totally?
It wasn't DGIndexNVs fault, it was me being stupid (deinterlacing after resizing... )

I'm currently messing with QTGMC, but I'm getting low fps and I don't know if I should tune QTGMC or just wait. Is there much difference between QTGMC presets for SD content?

My script: (don't know if I choose right MT parameters, I'm getting 100% CPU usage on my i7 2600)
Code:
SetMTMode(5, 8)
SetMemoryMax(1024)
LoadPlugin("E:\DVBT\Megui\tools\dgindexnv\DGDecodeNV.dll")
DGSource("I:\tmp\DVBT\vip\S03E18 - TV6-21052019-1054_cut.dgi")
SetMTMode(2)
QTGMC(Preset="Slower", EdiThreads=4)
SRestore()
crop(4, 10, 0, 0)
Spline36Resize(640,462) # Spline36 (Neutral)
With x264 settings:
Code:
x264.exe "script.avs" --level 4.1 --preset veryslow --tune film --crf 21.0 --vbv-bufsize 78125 --vbv-maxrate 62500 -o asd.264
I'm getting ~12fps, with:
Code:
x264.exe "script.avs" --level 4.1 --preset ultrafast --tune film --crf 21.0 --vbv-bufsize 78125 --vbv-maxrate 62500 -o asd.264
~19fps, so I guess QTGMC is the bottleneck. With same x264 settings, but QTGMC preset Slow I get ~30fps.

Is there something else I could tweak to get more fps? Maybe MT parameters? Thanks for help.

EDIT:
I don't know why, but I get much less ghosting when using Yadifmod2(mode=1, order=1)+SRestore, than QTGMC+SRestore, for example:
Frame after frame: (QTGMC)







Frame after frame: (Yadifmod2)






What am I doing wrong?

Last edited by sebastiang; 24th May 2019 at 16:11.
sebastiang is offline   Reply With Quote
Old 25th May 2019, 20:43   #10  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Quote:
Is there something else I could tweak to get more fps? Maybe MT parameters? Thanks for help.

EDIT:
I don't know why, but I get much less ghosting when using Yadifmod2(mode=1, order=1)+SRestore, than QTGMC+SRestore, for example:
Whenever I feel that QTGMC is too slow I use a script which was recommended by tritical himself after I asked him what would give me the best quality vs speed ratio (i.e. bang for the buck).

Quote:
AssumeTFF() # Specify source field order
PointResize(width,height+8,0,-4,width,height+8)
yadifmod(mode=1, edeint=tdeint(mode=1, mthreshL=0,mthreshC=0))
Crop(0,4,-0,-4)
AssumeTFF() # Specify target field order
Srestore()
It is quite fast, and IMO the quality is a lot better than using YADIF by itself. It uses TDeint as the interpolator for YadifMod, plus it it uses padding (thanks to Didée).


Cheers
manolito
manolito is offline   Reply With Quote
Old 29th May 2019, 21:02   #11  |  Link
sebastiang
Registered User
 
Join Date: Jan 2019
Posts: 13
Thanks for help, with this script I'm getting ~20fps and results are great, but out of curiosity, why padding is used?
sebastiang is offline   Reply With Quote
Old 29th May 2019, 23:21   #12  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
Padding removes the blinking lines at the top and the bottom of a clip when using YADIF as a bobber. See this thread:
https://forum.doom9.org/showthread.p...74#post1325574
manolito is offline   Reply With Quote
Old 31st May 2019, 11:47   #13  |  Link
sebastiang
Registered User
 
Join Date: Jan 2019
Posts: 13
I want to give QTGMC a try, but I can't get rid of ghosts. Why am I getting them in the encode, even though I don't see any when I preview my script in AvsPmod? Example, same frame: (screeshots from AvsPmod)
Code:
SetMTMode(5, 8)
SetMemoryMax(1324)
LoadPlugin("E:\DVBT\Megui\tools\dgindexnv\DGDecodeNV.dll")
DGSource("I:\tmp\DVBT\vip\TV6-29052019-1054_cut.dgi")
AssumeTFF()
SetMTMode(2)
QTGMC()
AssumeTFF()
SRestore()
crop(6, 10, 0, 0)
Spline36Resize(640,464)

Code:
LoadPlugin("E:\DVBT\Megui\tools\dgindexnv\DGDecodeNV.dll")
DGSource("I:\tmp\DVBT\vip\encode.dgi")


What am I doing wrong?
sebastiang is offline   Reply With Quote
Old 1st June 2019, 21:13   #14  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Why the two AssumeTFF calls? Do you need them? (I haven't looked at the sample.)
manono is offline   Reply With Quote
Old 2nd June 2019, 02:01   #15  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,078
I think the two AssumeTFF() calls come from my example script...
The first one makes sure that the bobber gets the correct source field order from AviSynth, and the second call is not needed in this case (but I think it also does no harm).

It is a leftover from my standard conversion script which reinterlaces after resizing.
Quote:
AssumeTFF() # Specify target field order
SeparateFields()
SelectEvery(4,0,3)
Weave()
Specifying the target field order before reinterlacing makes it possible to always use "SelectEvery(4,0,3)" which is much less error prone than using different params for SelectEvery.


Cheers
manolito
manolito is offline   Reply With Quote
Old 3rd June 2019, 03:48   #16  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by sebastiang View Post
What am I doing wrong?
Maybe nothing. SRestore needs some time to lock in the cadence so you have to kind of 'sneak up' on the place you really want to check.

If you begin maybe a hundred frames back, are those trees still ghosted? Alternatively, have you actually encoded it yet and found problems afterwards? It probably won't be perfect, especially at scene changes. Blame the geniuses that created the abomination.

Last edited by manono; 3rd June 2019 at 03:50.
manono 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 09:20.


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