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 3rd August 2006, 20:40   #1  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
Deshaker in AviSynth, preroll parameter

Once again I'm trying to use Deshaker (the great Virtualdub-filter) in AviSynth.
I still have two problems:

1) pass1 works only when "video output" is set to "none". When using "motion vectors" it crashes (access violation). Well, after I found the reason, this is no big problem anymore. Strange, because here it seems it worked in the other case.

2) pass2 doesn't work (access violation) with the setting "use future frames" > 0.
I tried different values for the "preroll" parameter in the LoadVirtualdubplugin function - no effect. It even seems as if this argument is completely ignored.

Has someone else tried this?
WarpEnterprises is offline   Reply With Quote
Old 3rd August 2006, 21:42   #2  |  Link
smok3
brontosaurusrex
 
smok3's Avatar
 
Join Date: Oct 2001
Posts: 2,392
not yet, can you post your avs?
smok3 is offline   Reply With Quote
Old 3rd August 2006, 22:47   #3  |  Link
guth
Registered User
 
Join Date: Apr 2003
Location: Uppsala, Sweden
Posts: 157
Yes, please post your avs and I'll look into it. I never really use Deshaker from AviSynth so I may very well have missed something.

Btw, if you find bugs in Deshaker, email them directly to me instead. I don't want the whole world to see how crappy my software is!
guth is offline   Reply With Quote
Old 4th August 2006, 07:47   #4  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
@guth: I will do so if I actually find any bugs. This looked like AviSynth-related to me.

Here is the script:
Code:
LoadVirtualDubPlugin ("C:\Programme\VirtualDubAVS\plugins\deshaker.vdf", "deshaker", preroll=0) #version 1.9

Version.ConvertToRgb32.Trim(0,100).BilinearResize(352,288)	#testvideo

#pass1, no motion vectors --> works
#deshaker("8|1|30|4|1|0|1|0|640|480|1|2|1|400|400|400|1500|4|0|1|2|5|40|300|4|C:\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|0|0|30|30|0|100|0|0|1|0|0")

#pass1, motion vectors --> Avisynth read error: Avisynth: caught an access violation at 0x.... attempting to read from 0x00000000
#deshaker("8|1|30|4|1|0|1|0|640|480|1|2|1|400|400|400|1500|4|1|1|2|5|40|300|4|C:\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|0|0|30|30|0|100|0|0|1|0|0")

#pass2, 0 future frames --> works
#deshaker("8|2|30|4|1|0|1|0|640|480|1|2|1|400|400|400|1500|4|1|1|2|5|40|300|4|C:\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|1|1|30|0|0|100|0|0|1|0|0")

#pass2, 2 future frames --> Avisynth read error: Avisynth: caught an access violation at 0x.... attempting to read from 0x00000000
deshaker("8|2|30|4|1|0|1|0|640|480|1|2|1|400|400|400|1500|4|1|1|2|5|40|300|4|C:\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|1|1|30|2|0|100|0|0|1|0|0")
- it does not matter what preroll value is used
- many other combinations of parameters worked flawlessly

(of course, I commented out all but the tested of the four case above...)
WarpEnterprises is offline   Reply With Quote
Old 4th August 2006, 11:01   #5  |  Link
guth
Registered User
 
Join Date: Apr 2003
Location: Uppsala, Sweden
Posts: 157
A VirtualDub filter has the option to output graphics on the output video using a "device context" that is sent to the filter from VirtualDub. This allows the filter to draw text and stuff using functions built into Windows. But this device context doesn't seem to be valid when using AviSynth. I think I can check for this and not output any text or motion vectors when using AviSynth. It will be fixed in the next version to be released in a week or so.

But you will probably still want to get that preroll to do what we want. In the AviSynth manual it sounds as though it would do what we want, but I can't see that it does anything. Does anybody know what it's supposed to do?
guth is offline   Reply With Quote
Old 4th August 2006, 12:10   #6  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
Then the crashes in pass2 do not come from the use of future frames but from the warning output ?

Maybe it then works with the preroll as supposed to:
At requested frame n the VD-Filter is called min(n, preroll) times with the frames n-preroll, n-preroll+1 and so on. There is no delay introduced depending on preroll, only the possible delay from the VD-filter (in our case the future frames) comes through.

Shouldn't it be possible to disable the device context from AviSynth? I found the following code in plugins.cpp which looks like the place in question:
Code:
    if (src_needs_hdc || dst_needs_hdc) {
//      throw AvisynthError("VirtualdubFilterProxy: HDC not supported");
      vbSrc.hdc = vbDst.hdc = vbLast.hdc = GetDC(NULL);
    }
WarpEnterprises is offline   Reply With Quote
Old 4th August 2006, 13:44   #7  |  Link
guth
Registered User
 
Join Date: Apr 2003
Location: Uppsala, Sweden
Posts: 157
Right, both crashes were due to this device context thing.

I never saw that explanation of preroll. That's exactly how it works actually, but I still don't see how to use it properly. We want to start processing at frame x, where x is the number of future frames you have set. If you use preroll=x, AviSynth will call Deshaker with frames 0 to x for frame x, which is fine. But how do you make AviSynth start processing at frame x. The Trim function won't do, because that throws away the frames completely and we still need them in the preroll thing. But I'm no AviSynth expert, there's probably a way to do it.

The code you found doesn't make sense to me. I do tell VirtualDub that I need hdc for the destination, but that would mean that it is set to GetDC(NULL), which should never fail. And the hdc I get is NULL when using AviSynth. And setting hdc to GetDC(NULL) seems very weird. It wouldn't work if it really did that anyway.
I don't know what you mean by disabling the device context, but this is no big problem really. I just check if hdc is NULL and don't use it if it is. Which means no motion vectors or info texts of any kind.
guth is offline   Reply With Quote
Old 4th August 2006, 13:49   #8  |  Link
guth
Registered User
 
Join Date: Apr 2003
Location: Uppsala, Sweden
Posts: 157
Ahh... I just found out you can use the Trim function on the output too. So this should work fine I guess.
guth is offline   Reply With Quote
Old 12th August 2006, 13:37   #9  |  Link
guth
Registered User
 
Join Date: Apr 2003
Location: Uppsala, Sweden
Posts: 157
Now there's a new version of Deshaker available that (among other things) should fix the crashes when using it from AviSynth. Get it here.
guth is offline   Reply With Quote
Old 12th August 2006, 15:54   #10  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
thanks guth,
will try and compare with depan
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick 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 19:15.


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