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 18th August 2005, 15:51   #1  |  Link
techmule
Registered User
 
Join Date: Aug 2005
Posts: 127
Avisynth Script to determine filter results Vs Original Source

Hi,

I always wanted a way with avisynth, so as to determine what my video results would be without going through the long encoding process and vola!!!! after hours of reading heres how to go about it. I have used avisynth 2.5.

- Copy a small part of your avi from your source using vdubmod as your sample clip.
-Change your sample clip directory for Avisource() function
- load the plugins used (see my script below)
#
# Script begins here... #
#########################
#
# Loading plugins and functions... #
####################################
#
LoadPlugin("d:\Program Files\avisynth plugins\AutoCrop.dll")
LoadPlugin("d:\Program Files\avisynth plugins\avsmon25a.dll")
LoadPlugin("d:\Program Files\avisynth plugins\blockbuster.dll")
LoadPlugin("d:\Program Files\avisynth plugins\Convolution3DYV12.dll")
LoadPlugin("d:\Program Files\avisynth plugins\DctFilter.dll")
LoadPlugin("d:\Program Files\avisynth plugins\descratch.dll")
LoadPlugin("d:\Program Files\avisynth plugins\ffavisynth.dll")
LoadPlugin("d:\Program Files\avisynth plugins\FrameDbl.dll")
LoadPlugin("d:\Program Files\avisynth plugins\MipSmooth.dll")
LoadPlugin("d:\Program Files\avisynth plugins\MPEG2Dec3.dll")
LoadPlugin("d:\Program Files\avisynth plugins\RemoveDirtSSE2.dll")
LoadPlugin("d:\Program Files\avisynth plugins\RemoveGrainSSE2.dll")
LoadPlugin("d:\Program Files\avisynth plugins\Sampler.dll")
LoadPlugin("d:\Program Files\avisynth plugins\STMedianFilter.dll")
LoadPlugin("d:\Program Files\avisynth plugins\UnDot.dll")
LoadPlugin("d:\Program Files\avisynth plugins\UnFilter.dll")
LoadPlugin("d:\Program Files\avisynth plugins\VSFilter.dll")


#Filters Go below
#########################
Avisource("D:\big\test.avi",false)
blindPP(quant=2,cpu=4)
Blockbuster(method="noise",detail_min=1,detail_max=3,variance=0.3,seed=1)
removegrain(mode=1)
#descratch(mindif=60)
mipsmooth(preset="MovieHQ")
filtered= last

# If source video starts at different frame
frameadjust=0

# Videos to compare: (v1 is original, v2 is the re-encoded(after applying filter))
v1 = Avisource("D:\big\test.avi",false).trim(frameadjust,0)
v2 = filtered
sub = v1.subtract(v2)
substrong = sub.levels(122,1,132,0,255)

return StackVertical(StackHorizontal(v1.subtitle("original"),v2.subtitle("encoded")),StackHorizontal(sub.subtitle("Difference"),substrong.subtitle("Difference amplified")))

### End of Script

Save the script as name.avs and run this using your media player (I used WMP). Now you can see the effects of the filters as scripted by you Vs Source and change dynamically till it meets your expectations.

I also want to thank all avisynth forums and ppl who posted their scripts in them. Since I am very new to avisynth (5-10 days), those scripts have helped me to understand the functions better and helped me in creating this script to my needs.
techmule is offline   Reply With Quote
Old 18th August 2005, 16:59   #2  |  Link
Prodater64
Registered User
 
Join Date: Mar 2004
Posts: 266
Here another by Dialhot from kvcd.net:

Quote:
source=Mpeg2Source(...)

left=source.script1()
right=source.script2()

width=left.width()/2
height=left.height()

left=crop(left,0,0,width,height)
right=crop(right,width,0,width,height)

StackHorizontal(left.subtitle("Script1"),right.subtitle("Script2"))

function script1(clip c) {
c
#----- ENTER CODE OF SCRIPT ONE HERE -----

#----- END OF CODE OF SCRIPT ONE-----
}

function script2(clip c) {
c
#----- ENTER CODE OF SCRIPT TWO HERE -----
Greyscale()
#----- END OF CODE OF SCRIPT TWO-----
}
__________________
Prodater64
Prodater64 is offline   Reply With Quote
Old 18th August 2005, 19:08   #3  |  Link
tedkunich
Potentate
 
Join Date: Mar 2003
Posts: 219
Quote:
Originally Posted by techmule
Hi,

I always wanted a way with avisynth, so as to determine what my video results would be without going through the long encoding process and vola!!!! after hours of reading heres how to go about it. I have used avisynth 2.5.

<snip>

For my money, interleaving the original and filtered videos is the most accurate way to compare. You can single step through the frames and see the differences quite readily. Stacking (horizontal or vertical) will work too, but it is hard to see subtle changes that way....


T
tedkunich is offline   Reply With Quote
Old 18th August 2005, 22:32   #4  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
I would add a proviso to all of this... there are different kind of noise and different kinds of distortion caused by filters, and the appropriate method to bring these out varies with the kind of phenomenon in question. I would say that whatever else you try you should use a least one method which involves playing the clip. (E.g. because strong spatial filters might yield frames which individually looked very good but which do not match the neighbouring frames closely enough to give a fluid result.)


I generally use two playback methods: one method which applies a filter to the right-hand side only (similar to the method in the second post), and one method which switches the filtering on and off every few seconds. I would personally avoid simple stacking methods because the requisite subsequent resizing will make it hard to notice a lot of phenomena. Subtract is useful in learning where distortion might occur so that you can look for it in the filtered clip, but once you have an idea of that I would switch it off, if no other reason than because you can't look at the subtract clip and the original/filtered clips at the same time.
__________________
a.k.a. Clouded. Come and help by making sure your favourite AVISynth filters and scripts are listed.
mg262 is offline   Reply With Quote
Old 19th August 2005, 02:21   #5  |  Link
askol
Registered User
 
Join Date: Jul 2005
Posts: 4
AMVApp has a few nice scripts in it called BeforeAfter and BeforeAfterLine.

An example of BeforeAfter can be seen here: http://www.amvwiki.org/index.php/Ima..._edgeenhan.png

And hey, here are the scripts:

http://www.amvwiki.org/index.php/BeforeAfter
http://www.amvwiki.org/index.php/BeforeAfterLine
askol is offline   Reply With Quote
Old 19th April 2006, 09:56   #6  |  Link
adrianmak
Registered User
 
Join Date: Apr 2006
Posts: 127
what is the difference between BeforeAfter and BerforeAfterLine script ?
adrianmak is offline   Reply With Quote
Old 19th April 2006, 13:47   #7  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,556
BeforeAfterLine adds a thin line between them. (That's a heckuva lot more robust than my sxs!)
foxyshadis is offline   Reply With Quote
Old 19th April 2006, 15:14   #8  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
I made a similar function some time ago... ^^


Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 20th April 2006, 04:58   #9  |  Link
adrianmak
Registered User
 
Join Date: Apr 2006
Posts: 127
I tried all the above methods, basically all of them are splitting the original source into half, one half keep untouch and another half is applied filter(s) and then combine them back as one . However, the filtered half and unfilter half are two different portion of same scene and it is a little bit hard to compare the different how good or how bad of the filtered portion.

So is it possible to put unfilter and filtered portion as one
e.g.
all previous method
Scene was divided into two parts, A and B
A|B ---> A|B(filtered)

new method should be
A|B -----> A|A(filtered) or B|B(filtered)

Hope yours unstand my question
adrianmak is offline   Reply With Quote
Old 20th April 2006, 10:27   #10  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Like this?
Code:
# _______________________________________________________
#
# SBSC | Side By Side Compare 
# _______________________________________________________
#					
#  Another lame function by Soulhunter... \m\ ^_^ /m/
# _______________________________________________________
#
#
# Usage examples: 
#
# Original = AviSource("C:\Path\to\Source.avi")
# Filtered = Original.FFT3DFilter(Sigma=1)
# SBSC(Original,Filtered)
#

Function SBSC(Clip ClipA,Clip ClipB)
{

OX	= ClipA.Width
OY	= ClipA.Height

ClipB	= ClipB.Lanczosresize(OX,OY)

ClipA 	= ClipA.Crop(0,0,OX/2,OY).Subtitle("ClipA")
ClipB	= ClipB.Crop(0,0,OX/2,OY).Subtitle("ClipB")

StackHorizontal(ClipA,ClipB)

}
Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 20th April 2006, 10:47   #11  |  Link
Inc
Squeeze it!
 
Inc's Avatar
 
Join Date: Oct 2003
Location: Germany
Posts: 472
As you already add a Lanczosresize on the filtered so it matches the same pic size of the source .... think about this:
Code:
Function SBSC_Interleaved(Clip orig,Clip filtered)
{

OX	= ClipA.Width
OY	= ClipA.Height

ClipB	= ClipB.Lanczosresize(OX,OY)

ClipA 	= ClipA.Subtitle("Clip Orig")
ClipB	= ClipB.Subtitle("Clip Filtered")

Interleave(ClipA,ClipB)

}
So you can just use the frame step button in Vdub etc. to switch between the orig/filtered. Its like in Photoshop "layer on/off".
When switching between layers diffs will be more recognisable for human eyes compared to a horizontal stacked pic alignment.

Last edited by Inc; 20th April 2006 at 10:51.
Inc is offline   Reply With Quote
Old 20th April 2006, 23:25   #12  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
maybe my ClipComp script could help you ? (with default settings, look frame by frame in vdubmod for instance)
Alain2 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 03:06.


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