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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th January 2016, 21:05   #1  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 158
Printing variables on video

I'm working on a script and would find it terribly useful to print various values onto the video frame from AviSynth's internal functions. For example, here's my na´ve attempt:
Code:
Subtitle(YDifferenceFromPrevious(last).String())
...which results in an error of: "Plane Difference: This filter can only be used within run-time filters." Looking around I see that whenever these are used with more than just a simple comparison operator, people just tend to dump the value to a file and read it from there, but is there a simple way to draw the values on the video?

Also, somewhat related, is it possible to return a variable (not a video/audio clip, but int, float, etc.) from an external filter? Looking at the avisynth.h header, this doesn't seem possible short of just dumping the data to a file, but maybe I'm missing something.
__________________
My filters: DupStep | PointSize
`Orum is offline   Reply With Quote
Old 29th January 2016, 21:32   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,296
This should probably be in Avisynth Usage Forum.

Code:
Colorbars.ConvertToYV12
ScriptClip("""Subtitle(YDifferenceFromPrevious(last).String())""")
Quote:
is it possible to return a variable (not a video/audio clip, but int, float, etc.) from an external filter?
A filter returns a video clip, what is it that you are trying to do (ie return what to what)?
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 29th January 2016, 21:47   #3  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,057
Functions exported from plugins can return any AVSValue-compatible type. If you can accept only being compatible with yourself you can also pretend env->NewVideoFrame() is malloc(), treat the video frame buffer as just another bit of memory and put whatever you want in a clip. (A surprising number of plugins actually do this, regardless of how terrible an idea it really is.)
TheFluff is offline   Reply With Quote
Old 29th January 2016, 21:49   #4  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 158
Quote:
Originally Posted by StainlessS View Post
This should probably be in Avisynth Usage Forum.
Ah, sorry. Anyway, thanks for pointing me to ScriptClip, I've never used it before.

Quote:
Originally Posted by StainlessS View Post
A filter returns a video clip, what is it that you are trying to do (ie return what to what)?
I'm writing a plugin that calculates a metric for use in other filters, and I was hoping I could just return this value--in this case, a double--and use that numeric value immediately in a script. From what I've seen all plugins that ever output something other than a frame just dump this into a file as it looks like you're forced to return a clip and not a variable.

That's fine and I can work around that, but it's inconvenient at best and error-prone at worst.

Edit: Thanks Fluff, that's probably the lesser of two evils in this case, though I can probably make it return only internal types for 99% of what I hope to do.
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 29th January 2016 at 22:01.
`Orum is offline   Reply With Quote
Old 29th January 2016, 22:27   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,296
OK, then maybe OK in developer forum.
Suggest try look up "non clip function" in avisynth SDK docs, in avisynth install, need tick option to include extra files, or can
download Avisynth compressed help file (*chm) with sdk, in data folder in mediafire link in my sig below.

Edit: search "non-clip sample"
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 30th January 2016 at 02:34.
StainlessS is offline   Reply With Quote
Old 29th January 2016, 23:14   #6  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 158
Quote:
Originally Posted by StainlessS View Post
Edit: search "non-clip sample*
Thanks, that's exactly what I needed! Now to get back to coding...
__________________
My filters: DupStep | PointSize
`Orum 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 11:00.


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