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 23rd September 2005, 14:33   #1  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
New Filter: Stabiliser (like DePanStabilise, DeShaker)

Demonstration

You will need both the filter -- which only takes YV12 and requires SSE2:
Cel Background, 23 September 2005

...and a script file:
Cel Stabilise, 23 September 2005

Usage:
LoadPlugin("CelBackground_23Sep05.dll")
Import("CelStabilise.avs")

#load clip here
Stabilise(capabsolutemetric(15))
#crop(4, 4, -4, -4) #or as appropriate to remove borders created by stabilisation


It's fairly slow at present, although speeding it up is on my to do list; if a frame is requested non-sequentially, it will motion-compensate all the intermediate frames (if they haven't been calculated already) -- so it will freeze for a few seconds.

This filter has lots of options but I have found the hard way that no one will look at a filter with too much documentation, especially if there aren't any pretty pictures! So I shall give lots of little examples slowly over time, or if people express interest. Next will probably be the built-in scene detection, and then after that automatic selection of still scenes to stabilise.

Edit: I should have said that this is primarily meant for animation, especially old animation, although as far as I can see it should work on live material if the background is reasonably still; if you have trouble with this, post a clip.

Last edited by mg262; 24th September 2005 at 17:46.
mg262 is offline   Reply With Quote
Old 23rd September 2005, 14:43   #2  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Quote:
Originally Posted by mg262
This filter has lots of options but I have found the hard way that no one will look at a filter with too much documentation!
Sounds a bit like an excuse that you can't be bothered to properly document it. No offense intended.

My suggestion: Provide a quick start guide for beginners and a full reference manual for power users. That's how you maximize your user base.

Thanks for the new filter. Source code?

Last edited by Guest; 23rd September 2005 at 14:45.
Guest is offline   Reply With Quote
Old 23rd September 2005, 14:48   #3  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
Quote:
Sounds a bit like an excuse that you can't be bothered to properly document it.
It's not that... it's that I haven't had a single piece of feedback suggesting that anyone has actually used the corresponding Foreground filter, which has been quite thoroughly documented. (Edit: including a split into basic and advanced material.) I should have put up the HTML at the start, but even allowing for that, I felt there was too much material and it overwhelmed people.

Edit: hence also putting the script in a .avs file so users don't have to look at/understand it if they don't want to. Source is still very much incomplete and in flux. Stabilisation is really a side-effect of the filter, but I decided it was useful enough in itself to release at this stage.

Edit: I have just discovered that (for some reason which I don't understand), pixels with luma below 16 (and some chroma values) are rendered as white rather than black on my system. So I have modified the filter to produce only luma values of 16 and above.

Last edited by mg262; 23rd September 2005 at 16:42.
mg262 is offline   Reply With Quote
Old 23rd September 2005, 19:43   #4  |  Link
Tommy B.
in love with x264
 
Join Date: Jun 2004
Location: Germany
Posts: 89
Looked at the example, interesting.

Tried it my self, well, didn't work. There is no function named "capabsolutemetric".

What's wrong?
Tommy B. is offline   Reply With Quote
Old 23rd September 2005, 20:03   #5  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
I just re-downloaded the plug-in and checked with the following script:

LoadPlugin("CelBackground_23Sep05.dll")
capabsolutemetric(blankclip().converttoyv12(),15)

and it doesn't produce an error message... would you mind posting your script? Also please try putting the full path to the DLL in the LoadPlugin command.

(And if anyone else is getting the same error message, please let me know...)than a

Edit: My version of AVISynth is not case sensitive, but perhaps yours is for some reason... so please try changing the capitalisation to CapAbsoluteMetric

Last edited by mg262; 23rd September 2005 at 20:34.
mg262 is offline   Reply With Quote
Old 23rd September 2005, 20:46   #6  |  Link
Tommy B.
in love with x264
 
Join Date: Jun 2004
Location: Germany
Posts: 89
Code:
Import("C:\Programme\AviSynth 2.5\plugins\CelStabilise.avs")

LoadPlugin("CelBackground_23Sep05.dll")
capabsolutemetric(avisource("sta.avi").converttoyv12(),15)
I'm using avisynth 2.5.5 and put the "CelBackground_23Sep05.dll" into the plugins folder (so it is loaded automaticly).

When I try loading the dll manualy (using LoadPlugin("C:\Programme\AviSynth 2.5\plugins\CelBackground_23Sep05.dll"), it reports with an error (Unable to load "CelBackground_23Sep05.dll").

BTW, when using your code, I get some strange cryptic sings (see attachment).

And I also tried the case sensitive thing, didn't work either.
Attached Images
 
Tommy B. is offline   Reply With Quote
Old 23rd September 2005, 21:00   #7  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
I just tried putting it in the plug-ins directory and that also seems to work for me on 2.5.5. The attachment isn't approved yet, but I think I know the error message you mean -- it happens when you try and LoadPlugin with an invalid path.

This is very strange... whatever it is, I'm sorry. One more thing to try if you haven't run out of patience:

Remove it from the autoload directory, put it in the same directory as both CelStabilise.avs and your script file, rename it to something shorter without any underscores or numbers (e.g. Background.dll), and load it manually.

Would someone else be kind enough to try downloading the filter and telling me if they get an error?

EDIT: Are you loading the plugin after you import the script? If so, please switch them round.

Last edited by mg262; 23rd September 2005 at 21:04.
mg262 is offline   Reply With Quote
Old 23rd September 2005, 21:20   #8  |  Link
Tommy B.
in love with x264
 
Join Date: Jun 2004
Location: Germany
Posts: 89
I put anything into one folder. deleted the dll and avs from the plugins directory. The script:

Code:
LoadPlugin("s.dll")
Import("s.avs")

blankclip = avisource("sta.avi")

capabsolutemetric(blankclip().converttoyv12(),15)
Hmmm... say, I just had some thoughts about sse2 on Athlon XP... and after some research on google it seems as if only Pentium 4 supports it. Great. That's it for me then. Back to VirtualDub and deshaker
Tommy B. is offline   Reply With Quote
Old 23rd September 2005, 21:37   #9  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
I am sorry... I was using particular quirks of sse2 to pull out speed; it would be horrendously slow without. In this case adapting it to MMX isn't entirely straightforward but I will have a go at it when I have time.

Edit: I have also fixed a problem occurring when the framework couldn't support allocation of a very thin frame. (Thanks, Myrsloik!)

Last edited by mg262; 23rd September 2005 at 21:39.
mg262 is offline   Reply With Quote
Old 23rd September 2005, 21:40   #10  |  Link
Tommy B.
in love with x264
 
Join Date: Jun 2004
Location: Germany
Posts: 89
No problem. There are some alternatives to stabilize video.

Keep it up, you're creating the first avisynth filter of this kind
Tommy B. is offline   Reply With Quote
Old 24th September 2005, 14:26   #11  |  Link
krieger2005
Registered User
 
krieger2005's Avatar
 
Join Date: Oct 2003
Location: Germany
Posts: 377
@Tommy B.: And what's about the depan-filter?
krieger2005 is offline   Reply With Quote
Old 26th September 2005, 22:27   #12  |  Link
Tommy B.
in love with x264
 
Join Date: Jun 2004
Location: Germany
Posts: 89
I'll try that. Thank you.
Tommy B. is offline   Reply With Quote
Old 26th September 2005, 22:53   #13  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
Yes. For what it's worth, these are the distinctive features of this filter:

1. It takes masks specifying regions to ignore.
2. It works on a scene by scene basis and tries to stabilise still scenes completely rather than applying a filter to reduce the motion.*
3. The sensitivity to different luma-differences is specifiable.

*This isn't "better" than the alternatives -- they're suitable for different tasks.

3. is a bit cryptic, so here is some explanation. When you try to stabilise the motion, you are roughly doing this: take frame n+1, put it on top of frame n, and slide it around until you find a good match. (Think of n+1 as semitransparent.) The standard ways to judge how good a match is are a) to add up the differences of the luma values* and b) to add up the squares of the differences of the luma values. So you slide around n+1 to try and make this number as small as possible.

*i.e. of each pair of pixels that lie on top of each other.

Both methods say that a white object "matches" a black background much worse than a grey object does -- whereas in fact, they are equally bad. Above a certain level, depending on noise but always relatively small, bigger differences don't mean anything... so the filter lets you specify the "penalty" for each luma difference. (+this has subtler uses which I won't go into now.)

Last edited by mg262; 26th September 2005 at 22:56.
mg262 is offline   Reply With Quote
Old 29th September 2005, 18:34   #14  |  Link
trolltuning
Registered User
 
Join Date: Dec 2003
Posts: 215
Quote:
Originally Posted by mg262
(edit)
*This isn't "better" than the alternatives -- they're suitable for different tasks.
Would some one please explain when you would use DePan and when you would use this?
trolltuning is offline   Reply With Quote
Old 30th September 2005, 11:28   #15  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
I'm a bit reluctant to start a full-out comparison because it will be difficult for me to be unbiased. For the tasks I was working on, I couldn't obtain sufficiently stable motion using DePanStabilise or DeShaker -- but that might reflect my inability to use those tools correctly rather than any limitation built into them. So, I will write something, but give me a bit to try and phrase it sensibly. The other thing is, if you happen to have a clip that you're trying to stabilise, I could use a section of it!

Life is pretty hectic at the moment but when things calm down I will put out an iSSE version.
mg262 is offline   Reply With Quote
Old 30th September 2005, 13:26   #16  |  Link
trolltuning
Registered User
 
Join Date: Dec 2003
Posts: 215
@mg262
Thanks I'll try to upload one over the weekend. (This one came out perfect using DePan (much to my surprise as I'm pretty sure I hadn't followed all the instructions right.)
How many frames do you want? (29.97 FPS)
trolltuning is offline   Reply With Quote
Old 30th September 2005, 13:37   #17  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
At least one complete scene, if you can manage it -- more if it's convenient. But I have other material to test the filter on, so don't worry if you want to leave it now you have it sorted out! If you do upload some, could I also have the DePan parameters (and, if relevant, inverse telecine settings), please?

Thanks, M.
mg262 is offline   Reply With Quote
Old 10th March 2006, 09:53   #18  |  Link
Derailed
Registered User
 
Join Date: Mar 2004
Posts: 12
Is there any developement going on with this filter? I used it on an old anime sample that I had, but for some reason, a quarter of the original frame remained, and the other three quarters of the frame were white. So only a corner of the original frame remained.

Here is the script I used:

Code:
loadplugin("CelBackground_23Sep05B.dll")
loadplugin("CelBackground_22Oct05.dll")
loadplugin("Cel_Background_06Jan06.dll")
import("CelStabilise.avs")
avifilesource("O:\Anime\test.avi").converttoyv12()
Stabilise(capabsolutemetric(15))
crop(6,6,-6,-6).lanczosresize(720,480)
[EDIT] I would also like to let you know, that I did try depanstabilizer and deshake, but I wasn't getting any of the frames with those filters.

Last edited by Derailed; 10th March 2006 at 09:59.
Derailed is offline   Reply With Quote
Old 10th March 2006, 10:01   #19  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
I think you should load only the latest plugin, not all of them.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 10th March 2006, 10:16   #20  |  Link
Derailed
Registered User
 
Join Date: Mar 2004
Posts: 12
I tried that, but then I got an error.

Quote:
"There is no function called AccumulateMotion"

Last edited by Derailed; 10th March 2006 at 10:22.
Derailed 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 00:00.


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