Log in

View Full Version : Please review my script


turnipzoink
25th September 2009, 12:44
Hi
I'm converting low quality mp2 vhs to h264. Total novice here.
I'm happy with the results of this script, but maybe it could be better. Is there anything I'm missing, or maybe the order of things should be different for better compression.
What do you think?





# Includes
function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode)
}


DGDecode_mpeg2source("D:\~\g1,AV_2008-10-02_12-27-27.d2v", info=3)
ColorMatrix(hints=true, interlaced=true, threads=0)
ConverttoYV12(interlaced=true)

# Inverse Telecine with field matching and decimate functions
tfm()
tdecimate()

# Remove Dirt
RemoveDirt()

AutoCrop(mode=0,wMultOf=16,hMultOf=16)

Guest
25th September 2009, 14:19
It's impossible to answer you without knowing details about your source video. That you ask this without realizing this shows you have a lot to learn about video processing.

The ConvertToYV12 is not needed as it comes out of MPEG2Source() already in YV12.

thewebchat
25th September 2009, 15:45
In addition, the ColorMatix is *probably* not needed and *definitely* not needed if you don't know what it does.

Keiyakusha
25th September 2009, 15:55
IMHO Autocrop is not needed. Its always better to crop manually.

turnipzoink
30th September 2009, 10:35
Hi
Yes I'm converting these for a friend but its really not my field. I appreciate the help.

The ColorMatrix call comes by default. MeGui's AviSynth Script Creator 'Filters' tab has 'MPEG2 Source' pane with Colour Correction option checked. Should I take it out?
I see another member of the forum Steptoe was doing the same thing and used ColorMatrix(mode="Rec.601->Rec.709",hints=true)
Do I need this function?

I tried doing a second pass with RemoveDirt, and it does some amazing things with the static, but for the rest of the video, especially motion bits, its just too aggressive.


Here's Mediainfo, the video section

Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, Matrix : Default
Duration : 53s 149ms
Bit rate mode : Constant
Bit rate : 4 816 Kbps
Nominal bit rate : 5 000 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Colorimetry : 4:2:0
Scan type : Interlaced
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.464
Stream size : 30.5 MiB (92%)

thewebchat
30th September 2009, 16:54
Like I said, if you don't know what ColorMatix does, you most certainly do not need it.