Beginning to experiment with Avisynth - No clue what to do

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
User avatar
bloppyblue
Joined: Fri Dec 22, 2006 7:53 pm
Status: Can't edit for crap. But I can try :/
Org Profile

Beginning to experiment with Avisynth - No clue what to do

Post by bloppyblue » Sun Oct 24, 2010 9:53 pm

Alright, so... I have no idea how to clean this up.

http://img34.imageshack.us/img34/2408/examplebo.jpg
http://img816.imageshack.us/img816/4835/example2m.jpg

I tried Deen("w2d",4,6,9,min=0.9) and GradFun2db(2) and although it helped, it made other problems (such as messing up other scenes after it) Should I split up the source into separate pieces and apply filters to them individually?

I'm sorry for asking for something that seems pretty simple. I'm hoping that once I find the answer to this basic step, the rest of this Avisynth business will be a breeze :P

User avatar
Phantasmagoriat
Joined: Mon Feb 06, 2006 11:26 pm
Status: ☁SteamPunked≈☂
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by Phantasmagoriat » Mon Oct 25, 2010 12:20 am

So basically, you just want to filter that particular scene, but nothing else?
Check out applyrange():

Code: Select all

applyrange(100,200, "GradFun2db()", 2)
This will apply gradfun2db() with a value of 2 on frames 100 to 200 only... and leave the rest of the frames untouched.


Although applyrange is a little annoying to use if you have a lot of arguments like you've got for deen. I would actually suggest not using deen anyways in favor of fft3dgpu() or a cautious dfttest() in this case [I didn't test it].

An alternative would be to set some variables; split your video using trim(); apply your filters, and rejoin like so:

Code: Select all

video      = avisource("C:\path\to\your\video.avi")
firstframe = 0
startframe = 100
endframe   = 200
lastframe  = video.framecount()

video.trim(firstframe, startframe-1 )++\
video.trim(startframe, endframe     ).Deen("w2d",4,6,9,min=0.9).GradFun2db(2)++\
video.trim(endframe+1, lastframe    )
Hope this helps
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Painkiller"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by Qyot27 » Mon Oct 25, 2010 12:23 am

Beaten to it somewhat, but anyway...


To address these individually:

A) Those Deen settings are way too high, especially for stuff produced over the last, decade, almost - and arguably stuff released over the past decade, barring some rather horrendously botched authoring jobs or discs produced from bad or inadequate masters, something most discs less than ~6 years old don't generally have a problem with... (unless it's Manga Entertainment we're talking about). A radius of 4 is practically never necessary, as 4 on any of the modes is tantamount overkill, putting aside that you'll be getting other posts pretty soon equating Deen use in general with tantamount overkill.

B) While you could do better to reduce the problem by lowering your Deen settings or using a different smoother, it is possible to isolate sections in videos by using Trim(). To use Trim effectively for what you want to do, however, you need to be comfortable using variables in your script. Like so:

Code: Select all

v1 = YourSourceLoaderHere()
Trim(v1,0,199).YourFilteringChoicesA() ++ Trim(v1,200,399).YourFilteringChoicesB() ++ etc.
'v1' is the variable, although the name needn't actually be v1 - you could call it 'fuwafuwatime' for all AviSynth cares, although that would be rather cumbersome of a variable name to be lobbing around. What each instance of Trim is doing is loading 'v1', a.k.a. your source video, cutting out frames 0-199 or 200-399, and then applying some sort of filtering to them - the fact that AviSynth interprets periods between commands the same way it interprets having each command on a new line makes this possible. Also remember that it starts counting frames at 0, not 1, so if you wanted the first 200 frames you need 0,199 like I showed.

Obviously it requires some pre-planning to know what frame ranges you need. The ++ stitches the segments back together after you've applied filtering to them; in actuality, ++ is shorthand for AlignedSplice, which will maintain audio sync between segments. + is shorthand for UnalignedSplice, which doesn't take audio into account (and thus, + might preserve sync, or it might not; it depends on what you're feeding it).
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

Mister Hatt
Joined: Tue Dec 25, 2007 8:26 am
Status: better than you
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by Mister Hatt » Mon Oct 25, 2010 1:30 am

For starters, don't EVER use deen for anything ever. Also use PNG for screenshots, otherwise it's hard to tell what is in the video and what is due to jpeg compression. My first suggestion for that would be get a better source, followed by ttempsmooth().gradfunkmirror(). I don't think they need tweaking. Also ignore everyone who says use applyrange. You're better off just trimming like Qyot writes, although I prefer a different syntax to what he wrote. You might also want to look into a program called YATTA, it writes avisynth for you based on where you tell it to apply filter ranges. It's magic and VERY powerful, like the oldspice guy or Yukarin.

User avatar
Phantasmagoriat
Joined: Mon Feb 06, 2006 11:26 pm
Status: ☁SteamPunked≈☂
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by Phantasmagoriat » Mon Oct 25, 2010 11:35 am

Mister Hatt wrote:Also ignore everyone who says use applyrange.
What's wrong with applyrange?
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Painkiller"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by mirkosp » Mon Oct 25, 2010 11:38 am

Phantasmagoriat wrote:
Mister Hatt wrote:Also ignore everyone who says use applyrange.
What's wrong with applyrange?
Bad memory management. Using "fancy" trimming instead of applyrange will make the script faster for the same result.
Image

User avatar
Phantasmagoriat
Joined: Mon Feb 06, 2006 11:26 pm
Status: ☁SteamPunked≈☂
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by Phantasmagoriat » Mon Oct 25, 2010 12:56 pm

Hmm...

Then I'll make my own function using trim() :awesome:

Code: Select all

########### range() v1.0 by Phantasmagoriat #############
function range(
		\  clip     c
		\, int     "f1"
		\, int     "f2"	
		\, string  "filterchain")
{
filterchain = default( filterchain, """deblock().dfttest().blur(1.58)""" )
# default is a "quick fix" for areas that are hard to clean

f = eval("c." + filterchain)

c.trim(0,f1-1)++\
f.trim(f1, f2)++\
c.trim(f2+1,c.framecount())
}
So if you want to apply something like ttempsmooth().gradfunkmirror() to only frames 100-200 you can go:

Code: Select all

range(100, 200, """ttempsmooth().gradfunkmirror()""")
and it won't have the annoying argument problem that applyrange() had, so you can put anything in between the triple quotes-- parameters, arguments, and all. Or if you find a few frames that are really difficult to clean, just go:

Code: Select all

range(100, 105)
by default, deblock().dfttest().blur(1.58) will be used as a "quick fix"
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Painkiller"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by mirkosp » Mon Oct 25, 2010 1:01 pm

Phantasmagoriat wrote:Hmm...

Then I'll make my own function using trim() :awesome:

Code: Select all

########### range() v1.0 by Phantasmagoriat #############
function range(
		\  clip     c
		\, int     "f1"
		\, int     "f2"	
		\, string  "filterchain")
{
filterchain = default( filterchain, """deblock().dfttest().blur(1.58)""" )
# default is a "quick fix" for areas that are hard to clean

f = eval("c." + filterchain)

c.trim(0,f1-1)++\
f.trim(f1, f2)++\
c.trim(f2+1,c.framecount())
}
So if you want to apply something like ttempsmooth().gradfunkmirror() to only frames 100-200 you can go:

Code: Select all

range(100, 200, """ttempsmooth().gradfunkmirror()""")
and it won't have the annoying argument problem that applyrange() had, so you can put anything in between the triple quotes-- parameters, arguments, and all. Or if you find a few frames that are really difficult to clean, just go:

Code: Select all

range(100, 105)
by default, deblock().dfttest().blur(1.58) will be used as a "quick fix"
Thanks bro, I had always been too lazy to write it on my own (although I'll change the "quickfix" bit on my end >_>). :asd:
Cheers. :beer:
Image

User avatar
Phantasmagoriat
Joined: Mon Feb 06, 2006 11:26 pm
Status: ☁SteamPunked≈☂
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by Phantasmagoriat » Mon Oct 25, 2010 1:08 pm

No problem ;)
I've been meaning to do that for a while too.

the "quickfix" bit is just a last resort... I mean, what else can you do when a few frames look like crap?
Image
Org Profile | AMVGuide | Phan Picks! | THE424SHOW | YouTube | "Painkiller"

"Effort to Understand; Effort to be Understood; to See through Different Eyes."

User avatar
mirkosp
The Absolute Mudman
Joined: Mon Apr 24, 2006 6:24 am
Status: (」・ワ・)」(⊃・ワ・)⊃
Location: Gallarate (VA), Italy
Contact:
Org Profile

Re: Beginning to experiment with Avisynth - No clue what to do

Post by mirkosp » Mon Oct 25, 2010 1:32 pm

Depends which frames and what kind of crap. Sometimes freezeframe, other times... yeah, nuking. But it's just that deblock().dfttest().blur(1.58) seems like some EXTREME nuking, I'd think that dfttest() on its own would suffice for most bad cases.
Image

Locked

Return to “AviSynth Help”