VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. I need to know how to format current_frame variable to pad left to zeroes.

    Something like this won't work, also tested a dozen more combinations.

    HTML Code:
    ScriptClip("""Subtitle(string("current_frame","%05.0f"))""")
    Convert frame 27 to something like 0000027.

    edit: I think this can't be done since I saw RT_WriteFile with formatted strings as a feature, belongs to RT_Stats pack.
    Last edited by Dogway; 13th Apr 2015 at 06:47.
    Quote Quote  
  2. Remove the quotes around current_frame.

    Code:
    ScriptClip("""Subtitle(string(current_frame,"%07.0f"))""")
    Quote Quote  
  3. Thanks jagabo, made it work, slow day

    Code:
    WriteFileIf(last, "Statistics.txt", "YPlaneMin<10", """string(current_frame,"%07.0f")""", """ ":" """, "YPlaneMin")
    Last edited by Dogway; 13th Apr 2015 at 06:57.
    Quote Quote  
  4. It's been long since I made some heavy avisynth work. I got another question, hopefully not as bland.
    I'm making some functions for cleaning film gate frames and black borders from the output of stab() and whatnot (hopefully a release in a few days). For the latter I'm trying to write out a statistics file of a variable within the script, while at the same time using the main script as the clip output. The problem is I can not do both at the same time.

    Code:
    o=last
    c=somefilter()
    WriteFileIf(c,""+path+"\FindBlackBorders - Statistics.log", "YPlaneMin<"+string(thr)+" ", """ "CHAPTER00=" ""","FFFormatTime(round((current_frame * 1000) / framerate()))", """ "|" """, "YPlaneMin")
    o
    This won't process the WriteFile in the background. I recall some plugin of some sorts that could render several threads in a scripts, maybe just my imagination...
    Quote Quote  
  5. I worked around the above question with WriteFile, but I would like to know regardless if there's a more straight way.

    Also I have issues with this simple script:

    Code:
    c=last
    msk=mt_lut("255")
    mt_merge(msk,c,msk,luma=true)
    This is supposed to show the source intact yet something odd happens as it looks a tad darker.
    Dither_merge16_8() is ok, but doing 16bit work for this sounds like a bit too much?
    Quote Quote  
  6. Originally Posted by Dogway View Post
    Code:
    c=last
    msk=mt_lut("255")
    mt_merge(msk,c,msk,luma=true)
    This is supposed to show the source intact yet something odd happens as it looks a tad darker.
    It's a bit lighter on my computer. Adding Interleave(c, last).Histogram() provides a hint. It looks like a rounding error where everything below 128 gets shifted up by one unit. Overlay(msk,c,mask=msk) does the same.

    Regarding your previous question -- I understand the question. What do you mean by "won't process the WriteFile in the background"?
    Last edited by jagabo; 14th Apr 2015 at 07:07.
    Quote Quote  
  7. Yes, as I suspected a rounding error. Probably the 255-256 thing?
    This is a game changer to be honest, I will probably avoid using mt_merge from now on.

    About WriteFile what I meant is that I wanted to use WriteFile for a variable within the script, but actually output another variable (not in the chain) as the clip.
    As in the example above, WriteFile won't write any file because the output is "o" clip.
    What I did to workaround that was to virtually include WriteFile in the thread chain by using mt_merge()

    Code:
    o=last
    c=somefilter()
    WriteFileIf(c,""+path+"\FindBlackBorders - Statistics.log", "YPlaneMin<"+string(thr)+" ", """ "CHAPTER00=" ""","FFFormatTime(round((current_frame * 1000) / framerate()))", """ "|" """, "YPlaneMin")
    mt_merge(c,mt_lut("255"),luma=true)
    Quote Quote  
  8. Originally Posted by Dogway View Post
    Yes, as I suspected a rounding error. Probably the 255-256 thing?
    This is a game changer to be honest, I will probably avoid using mt_merge from now on.
    Overlay() has the same problem. I suspect this is the source of the Chroma channels changing in the same way when using Stab(). It's especially bad with Stab() because frames that are shifted change colors, frames that aren't shifted don't change color. You end up with flickering colors.

    Originally Posted by Dogway View Post
    About WriteFile what I meant is that I wanted to use WriteFile for a variable within the script, but actually output another variable (not in the chain) as the clip.
    As in the example above, WriteFile won't write any file because the output is "o" clip.
    What I did to workaround that was to virtually include WriteFile in the thread chain by using mt_merge()

    Code:
    o=last
    c=somefilter()
    WriteFileIf(c,""+path+"\FindBlackBorders - Statistics.log", "YPlaneMin<"+string(thr)+" ", """ "CHAPTER00=" ""","FFFormatTime(round((current_frame * 1000) / framerate()))", """ "|" """, "YPlaneMin")
    mt_merge(c,mt_lut("255"),luma=true)
    Yes, you are right. If the output isn't used the chain isn't executed. Normally we think of filters passing data from the top of the script (input file) to the bottom (output). But AviSynth actually works the other way, it pulls data from the bottom. So any part of the script that isn't output isn't executed. The description of ConditionalFilter() explains this:

    http://avisynth.nl/index.php/ConditionalFilter
    Quote Quote  
  9. I didn't know about Overlay because I rarely use it, sometimes internal functions are buggy but I didn't expect the same with masktools, I was proved wrong I guess.
    What striked me was your comment on Stab() chroma issues, I never realized that. I originally was using Stabilise() a more primitive but astounding plugin, but it had issues with chroma shifting to a green hue (regardless of stabilization success), so I changed it for stab(). I really would like to find a robust stabilization plugin for avisynth. Solutions like Deshaker or other commercial ones involves too much intermediary files and render times.

    I thought the nature of the WriteFile filter had a different condition. I know the script is evaluated from bottom, but since WriteFile isn't a clip of any sorts (in nature I mean) I didn't think it had to be included in the chain. Well I worked around it but still wanted to know if there was something I was missing, thanks for the help Jagabo. Let's see what I can come up with the new Stabilization Tools, scriptclip is very very slow.
    Last edited by Dogway; 14th Apr 2015 at 07:52.
    Quote Quote  
  10. Originally Posted by Dogway View Post
    I didn't know about Overlay because I rarely use it, sometimes internal functions are buggy but I didn't expect the same with masktools, I was proved wrong I guess.
    seems mt_lut("255") output in tv range will be tv range

    and it seems mt_merge assume pc range for mask (or maybe everything), just like Overlay

    add
    Code:
    ColorYUV(levels="TV->PC")
    in 3rd clip (mask) will be almost like Dither_merge16_8

    and Dither_merge16_8 is
    Code:
    Function Dither_merge16_8 (clip src1, clip src2, clip mask, bool "luma", int "y", int "u", int "v")
    {
    	mask16 = StackVertical (mask, mask)
    	Dither_merge16 (src1, src2, mask16, luma=luma, y=y, u=u, v=v)
    }
    so that why if you use

    Code:
    Dither_merge16(msk.Dither_convert_8_to_16,c.Dither_convert_8_to_16,msk.Dither_convert_8_to_16,luma=true).DitherPost(mode=-1)
    will be like mt_merge
    Last edited by real.finder; 7th Sep 2015 at 07:41.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!