VideoHelp.com Forum
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Member
    Join Date: Mar 2008
    Location: United States
    I want to display a variable value in Avisynth for debuggin purpose but this does not work.

    varfirsquarter=top_banner.FrameCount*.25

    return combined.Subtitle(varfirsquarter , text_color=$000000, x=25, y=11, font ="Arial", size=60, first_frame =0, last_frame = 200, lsp=30, align=7, spc =62, halo_color=$ffffff)

    How does one display variable values for debugging?
    Quote Quote  

  2. Member AlanHK's Avatar
    Join Date: Apr 2006
    Location: Hong Kong
    Originally Posted by lindylex
    I want to display a variable value in Avisynth for debuggin purpose but this does not work.
    What do you mean "does not work?
    Is there an error message?
    If so, what?

    And please post the entire script, the fragment you posted refers to undefined things. I can't tell if your variables refer to numbers, functions, clips or what.

    Also for esoteric Avisynth questions the best place to ask is the
    Doom 9 forum.
    Quote Quote  

  3. Member
    Join Date: Mar 2008
    Location: United States
    This is one possible solution. I am interested in how others output variables for debugging?

    AlanHK, sorry you do not understand.

    I have a variable named "varfirsquarter" I want to store the first quarter in length of the movie "top_banner" in that variable. To do that I do this.

    varfirsquarter=top_banner.FrameCount*.25

    I wanted to see what the variable value was. So I decided to use the "Subtitle" method but it only takes strings. So I had to convert the number in my variable to a string by doing this "string (varfirsquarter)".

    This is a solution.

    return combined.Subtitle(string (varfirsquarter), text_color=$000000, x=25, y=11, font ="Arial", size=60, first_frame =0, last_frame = 200, lsp=30, align=7, spc =62, halo_color=$ffffff)

    Does anyone have a different, better way of checking variable values for debgging?

    Thanks Lindylex
    Quote Quote  

  4. Member AlanHK's Avatar
    Join Date: Apr 2006
    Location: Hong Kong
    Originally Posted by lindylex
    Does anyone have a different, better way of checking variable values for debugging?
    I think "Subtitle" is the only way in general.

    But if you're just debugging, you don't need to bother with all the parameters of subtitle.

    Just:
    Code:
    BlankClip(500)
    top_banner=last
    varfirsquarter=top_banner.FrameCount*.25 
    Subtitle(string (varfirsquarter))
    Or define your own function if you want to set different subtitle defaults.
    Quote Quote  

  5. Member
    Join Date: Mar 2008
    Location: United States
    AlanHK, thanks I was just using one of my previous used subtitle method calls. It definitely did not need so many parameter to display my variable value.

    Thanks
    Quote Quote  

  6. Member
    Join Date: Mar 2008
    Location: United States
    It looks like you can use the following to help debug also.

    filename = "c:\myprojects\output.txt"
    # create a test video to get frames
    Version()

    # the expression here is only a variable, which is evaluated and put in the file
    # you will get a file with the framenumber in each line


    WriteFile(filename, "current_frame")

    # this line is written when the script is opened
    WriteFileStart(filename, """ "This is the header" """)

    # and this when the script is closed
    WriteFileEnd(filename, """ "Now the script was closed" """)

    ////// AND ScriptClip method //////

    .ScriptClip(" Subtitle(String(current_frame)) ")
    Quote Quote  

  7. Member AlanHK's Avatar
    Join Date: Apr 2006
    Location: Hong Kong
    Yes, I forgot those.

    And if you aren't already using AvsP, get it immediately.
    It has many useful features for editing Avisynth scripts.
    Quote Quote  

  8. Member
    Join Date: Mar 2008
    Location: United States
    I currently use it or maybe even under use it. I'm sure there are good primer out there? What do you recommend?
    Quote Quote  

  9. Member AlanHK's Avatar
    Join Date: Apr 2006
    Location: Hong Kong
    Originally Posted by lindylex
    I currently use it or maybe even under use it. I'm sure there are good primer out there? What do you recommend?
    The author's documentation is quite good.

    Otherwise browse the topic in Doom 9.
    http://forum.doom9.org/showthread.php?t=129385

    Unfortunately, after an initial period of rapid development, the author appears to have stopped work on it.
    But its extensibility, allowing you to add your own functions and macros, makes it very flexible.
    Quote Quote  

  10. Member
    Join Date: Jul 2009
    Location: Spain
    Originally Posted by lindylex
    ScriptClip(" Subtitle(String(current_frame)) ")
    I know this is probably just an example, but if all you want to do is show the current frame number, you can just use ShowFrameNumber().
    Quote Quote  

  11. Member
    Join Date: Dec 2005
    Location: none
    Gavino, do you know how to get the current frame number as a variable? For example, I want to do something like:

    Crop(FrameNumber,0,720,480)

    to pan across a large frame.
    Quote Quote  

  12. Member
    Join Date: Jul 2009
    Location: Spain
    The variable current_frame is available inside run-time filters like ScriptClip.

    But something like panning is best done by using Animate, applied either to Crop or to a resizer with the extra cropping parameters (smoother because of sub-pixel movement).
    Quote Quote  

  13. Member
    Join Date: Dec 2005
    Location: none
    Originally Posted by Gavino
    The variable current_frame is available inside run-time filters like ScriptClip.
    I must be missing something. Whenever I try to use current_frame I get an error message: "I don't know what current_frame means".

    Code:
    AviSource("uncompressed rgb.avi")
    Crop(current_frame,0,320,240)
    Ah, nevermind. I see you have to use ScriptClip() (or one of the other special runtime functions):

    Code:
    AviSource("uncompressed rgb.avi")
    ScriptClip("Crop(current_frame,0,320,240)")
    And it doesn't like it if the returned clip dimensions are different. Guess I have some more reading to do...
    Quote Quote  

  14. Member
    Join Date: Jul 2009
    Location: Spain
    Yes, outside the 'run-time environment', the concept of the 'current' frame makes no sense, because it's dealing with entire clips.

    Your example could be written as
    Animate(0, frameCount-1, "Crop", 0, 0, 320, 240, frameCount-1, 0, 320, 240)
    which varies the first parameter from 0 to frameCount-1 over the length of the video.
    Quote Quote  

  15. Member
    Join Date: Dec 2005
    Location: none
    Originally Posted by Gavino
    Your example could be written as
    Animate(0, frameCount-1, "Crop", 0, 0, 320, 240, frameCount-1, 0, 320, 240)
    which varies the first parameter from 0 to frameCount-1 over the length of the video.
    Yes, but I was just using Crop() as a simple example of where one could use the current frame number. I've had other reasons for wanting conditional processing based on frame number in the past.

    Thanks for steering me in the right direction...
    Quote Quote  

  16. Member
    Join Date: Jul 2009
    Location: Spain
    You're more than welcome - glad to be able to help.

    If you get into serious use of ScriptClip and friends, you might be interested in my GRunT plugin, which addresses some of their usability problems, particularly inside script functions.
    Quote Quote  




Similar Threads

  1. Replies: 2
    Last Post: 9th Apr 2011, 21:41
  2. Avisynth script built in path variable
    By a1s2d3f4 in forum Newbie / General discussions
    Replies: 9
    Last Post: 15th Nov 2010, 00:44
  3. AViSynth to display two video files in sync: specific requirements
    By a1s2d3f4 in forum Newbie / General discussions
    Replies: 19
    Last Post: 12th Nov 2010, 12:59
  4. Playing Video on display 2 and display 1 goes black
    By sidewaysdriver in forum Software Playing
    Replies: 2
    Last Post: 3rd Aug 2010, 00:36
  5. How to get pixel values of MB in x.264
    By polovn in forum Newbie / General discussions
    Replies: 0
    Last Post: 2nd Mar 2009, 03:19
Search   Contact us   About   Advertise   Forum   RSS Feeds   Statistics   Tools