Log in

View Full Version : Need advice on Avisynth filters to clean source


nasakido
20th April 2015, 10:56
I have been using MeGUI throughout the years on and off but recently found a program, Hybrid, that I really like and am happy with the results for most my videos and like the layout most of all so I do not wish to change software.

I recently have been trying to work with my DVD Facing The Giants and there is a 20 second section about 1 hour and 17 minutes into the film where the source is pretty poor. This movie is Progressive 3:2 Pulldown and I have already pulled it up in VirtualDub-MPEG so I could look at the .vob files to confirm the pattern of 3:2 pulldown. TIVTC works perfectly to remove the pulldown to where only 1 frame out of the entire movie has to be deinterlaced using the QTGMC deinterlacer that I select along side of TIVTC in Hybrid. But there is this 20 second section that is proving difficult to work with. Before any TIVTC is applied and the source viewed through VirtualDub, there is combing around the eyes and mouth on quite a few of the 3 good frames in the 3:2 pulldown pattern. I can't seem to clean this up by using anything I am familiar with, e.g. QTGMC, vinverse, a denoiser, etc. and am not sure if anything can be done. It just annoys me that this section was poorly edited for the DVD.

Can someone recommend a filter and it's settings that I can use in the custom Avisynth script section of Hybrid that may help in cleaning up this source?

I had talked to Selur about this on his forum, but did not have the 10 seconds available to upload for him. He gave me a lot of good suggestions to try and it did help some. I have also tried adding all the QTGMC dll's into the customer script too, but that did not change anything, so for reference only, the below script is what I am trying to work with. I want to TIVTC the whole movie using QTGMC as the deinterlacer along side the TIVTC. Then I want to section out the 20 seconds and clean it up using Trim if this is possible to do in the manner I have the script. Since I noticed that he also posts here from time to time, I thought I would post here and kill two birds with one stone so I can get all the help I can. Here is what I had come up with so far after talking with him. Anything else that can be suggested would be much appreciated and again this is just for reference but this script reveals my intentions.

First, here is a link to a 10 second preview of this 20 second section so someone can help me: Facing The Giants (https://www.dropbox.com/s/ls87d5zr8dzic28/Facing_The_Giants.7z?dl=0)

And second, here is an example of the script I am working on. I do believe in the custom section I have to add whatever dll's I need to load of the filter I am using; this at least what I understood Selur to be saying. So you will notice I did not do that for the QTGMC filter because it would have made this post way longer than it already is; to shorten things up I removed those dll's from the custom section just for this posting.


SetMemoryMax(768)
SetMTMode(2,8) # change MT mode
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\LoadDll.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\DGDecode.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\TIVTC.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\unblock.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\AddGrainC.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\dfttest.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\DirectShowSource.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\EEDI2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\eedi3.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\FFT3DFilter.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\mvtools2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\nnedi.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\nnedi2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\nnedi3.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\SSE2Tools.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\TDeint.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\VerticalCleanerSSE2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\RepairSSE2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\RemoveGrainSSE2.dll")
LoadCPlugin("C:\Program Files\Hybrid\avisynthPlugins\ffms2.dll")
LoadCPlugin("C:\Program Files\Hybrid\avisynthPlugins\yadif.dll")
LoadDll("C:\Program Files\Hybrid\avisynthPlugins\libfftw3f-3.dll")
LoadDll("C:\Program Files\Hybrid\avisynthPlugins\fftw3.dll")
Import("C:\Program Files\Hybrid\avisynthPlugins\QTGMC-3.33.avsi")
# loading source: C:\Users\Nathan\Videos\Facing_The_Giants\VIDEO_TS
MPEG2Source(d2v="C:\Users\Nathan\Videos\HYBRID\TEMP\6694353507b0d8d75334ac8b5405edc2a7865fb64_27593.d2v")
# deinterlacing
A2 = last
A2 = A2.QTGMC(Preset="Very Slow", ediThreads=2, FPSDivisor=2)
TFM(slow=2,clip2 = A2)
TDecimate(hybrid=1)

# CUSTOM SCRIPT PART - position: cropping - START
function croppingCustom(clip clp) {
last=clp
SetMTMode(2)
Import("C:\Program Files\Hybrid\avisynthPlugins\QTGMC-3.33.avsi")
RequestLinear(rlim=50,clim=50)
video=last
v1=video.Trim(0,110782)
v2=video.Trim(110783,111312).QTGMC( Preset="Placebo", FPSDivisor=2)
v3=video.Trim(111313,0)
last = v1+v2+v3
}
# CUSTOM SCRIPT PART - position: cropping - END

croppingCustom() #loading custom script content
# cropping
Crop(0,8,0,-6)
return last

Reel.Deel
20th April 2015, 13:56
I see that you uploaded a sample but you should really upload an unprocessed sample from the original DVD. Use DGIndex to cut a small sample and upload it.

nasakido
20th April 2015, 20:36
This was a 10 second portion clipped from VirtualDub-MPEG, will this not work or do I still need to do it from DGIndex? I tested the download and the sample shows the 3:2 pulldown pattern when you step through the frames. If I do need to use DGIndex, I have never used it manually to strip out a section of video.

Great Dragon
20th April 2015, 23:18
300+ Mb for 10 sec? Have you saved it in RGB or what?

Open original file with DGIndex, trim 10 secs with [ ] buttons, go to File -> Save Project and Demux Video.

nasakido
21st April 2015, 00:05
I did not think much about it when I saved it from VirtualDub to .avi. I trimmed out that section from DGIndex and have corrected the link in my previous post. But, here (https://www.dropbox.com/s/ls87d5zr8dzic28/Facing_The_Giants.7z?dl=0) is the new link just in case. Thank you for your assistance.

Great Dragon
21st April 2015, 06:39
I don't see any reason using TFM after QTGMC. There is no improvement in a picture because QTGMC output is progressive.

Frame #27 in your sample looks the same to me with this:

MPEG2Source("D:\Temp\VTS_01_4.demuxed.d2v", cpu=0)
QTGMC( Preset="slow", FPSDivisor=2)
Tdecimate()

nasakido
21st April 2015, 11:09
I have uploaded a longer section of the video (https://www.dropbox.com/s/hu04xz5bgj95xrt/FTG.demuxed.demuxed.m2v?dl=0) if it helps to see the differences between the news cast (17 second beginning part of the upload) and what the rest of the movie looks like, e.g. frame 8, 18, 23 and 34 the lower lip area, frame 15 and 34 the eyes. I could be wrong and way off, but it almost looks as though this part of the movie was interlaced because of the way it was filmed and then before adding the 3:2 pulldown they tried to clean up the interlacing but did a bad job of it.

Would you still recommend those settings? If so, with the TDecimate() would you recommend using Hybrid=1 or keeping it default as in "do nothing", with blending frames that is?

LemMotlow
23rd April 2015, 21:12
Seems to me GreatDragon has a suitable answer for those first 22 seconds in post #6. Using that method on your FTG sample:

v1=MPEG2Source("Drive\path\to\FTG.d2v")

v1a=v1.Trim(0,676).QTGMC(Preset="slow", FPSDivisor=2).Tdecimate()
v1b=v1.Trim(677,0).TFM().TDecimate()

v2=v1a+v1b
return v2
v1a and v1b will both be 23.976 progressive. Without the audio track it's difficult to tell where the actual movie starts during the blackout. I cut "v1a" at the end of a GOP in the original m2v sample.


Why are you cropping? On 16:9 playback the aspect ratio will be stretched vertically.

nasakido
1st May 2015, 02:16
@LemMotlow, the reason for cropping was just removing black borders. Since I use MPC-HC I have never had the problem with the film stretching vertically since I watch this on my laptop and Nexus only. I see I left that info out, so if I were indeed watching this on a t.v. I see your point. That does give me something to consider in the future if we ever decide to purchase a t.v.

@Great Dragon, thank you for your help. Between your suggestions and "Selur" from his own site, I settled on the script below. Everything in the film plays smooth and works great, but those few frames where the mouth and eyes are bad I am just going to have to live with. That is because those frames are the 3 good frames in the Progessive 3:2 where the editors removed the interlacing from this fully interlaced portion (why they did not just leave it as is I do not know) and then applied the Progessive 3:2 over the whole film. If they would have left this portion all interlaced I could have worked with it and I believe cleaned it up better, but that is okay. Anyway, here is what I did and it plays really smooth:

SetMemoryMax(768)
SetMTMode(2,8) # change MT mode
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\LoadDll.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\DGDecode.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\AddGrainC.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\dfttest.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\DirectShowSource.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\EEDI2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\eedi3.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\FFT3DFilter.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\mt_masktools-26.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\mvtools2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\nnedi.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\nnedi2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\nnedi3.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\SSE2Tools.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\TDeint.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\VerticalCleanerSSE2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\RepairSSE2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\RemoveGrainSSE2.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\TIVTC.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\Average.dll")
LoadCPlugin("C:\Program Files\Hybrid\avisynthPlugins\ffms2.dll")
LoadCPlugin("C:\Program Files\Hybrid\avisynthPlugins\yadif.dll")
LoadDll("C:\Program Files\Hybrid\avisynthPlugins\fftw3.dll")
LoadDll("C:\Program Files\Hybrid\avisynthPlugins\libfftw3f-3.dll")
Import("C:\Program Files\Hybrid\avisynthPlugins\QTGMC-3.33.avsi")
Import("C:\Program Files\Hybrid\avisynthPlugins\Srestore.avsi")
# loading source: C:\Users\Nathan\Videos\Facing_The_Giants\VIDEO_TS
MPEG2Source(d2v="C:\Users\Nathan\Videos\HYBRID\TEMP\6694353507b0d8d75334ac8b5405edc2a7865fb64_27593.d2v")
# deinterlacing
QTGMC(Preset="Fast", ediThreads=2)
# removing ghosting
srestore(frate=23.976,omode=6)

# CUSTOM SCRIPT PART - position: cropping - START
function croppingCustom(clip clp) {
last=clp
SetMTMode(2)
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\TIVTC.dll")
TFM()
}
# CUSTOM SCRIPT PART - position: cropping - END

croppingCustom() #loading custom script content
crop(0, 8, 0, -6)
return last