Guest User

ffms2.avsi with colors

a guest
Oct 14th, 2015
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.63 KB | None | 0 0
  1. # FFmpegSource 1.21 syntax compatibility
  2. # Created by TheFluff
  3. # added text_color and halo_color support to FFINFO() by SteinsGate 7/19/2012
  4. # ex. FFInfo(text_color=$FFFFFF, halo_color=$FFFFFF)
  5.  
  6. function FFmpegSource2(string source, int "vtrack", int "atrack", bool "cache", \
  7. string "cachefile", int "fpsnum", int "fpsden", string "pp", int "threads", \
  8. string "timecodes", int "seekmode", bool "overwrite", int "width", int "height", \
  9. string "resizer", string "colorspace", int "rffmode", int "adjustdelay", \
  10. bool "utf8", string "varprefix") {
  11.  
  12. vtrack = default(vtrack,-1)
  13. atrack = default(atrack,-2)
  14. cache = default(cache,true)
  15. cachefile = default(cachefile,source+".ffindex")
  16. fpsnum = default(fpsnum,-1)
  17. fpsden = default(fpsden,1)
  18. pp = default(pp,"")
  19. threads = default(threads,-1)
  20. timecodes = default(timecodes,"")
  21. seekmode = default(seekmode,1)
  22. overwrite = default(overwrite,false)
  23. width = default(width,-1)
  24. height = default(height,-1)
  25. resizer = default(resizer,"BICUBIC")
  26. colorspace = default(colorspace,"")
  27. rffmode = default(rffmode,0)
  28. adjustdelay = default(adjustdelay,-1)
  29. utf8 = default(utf8,false)
  30. varprefix = default(varprefix, "")
  31.  
  32. ((cache == true) && (atrack <= -2)) ? ffindex(source=source, cachefile=cachefile, \
  33. indexmask=0, overwrite=overwrite, utf8=utf8) : (cache == true) ? ffindex(source=source, \
  34. cachefile=cachefile, indexmask=-1, overwrite=overwrite, utf8=utf8) : nop
  35.  
  36. v = ffvideosource(source=source, track=vtrack, cache=cache, cachefile=cachefile, \
  37. fpsnum=fpsnum, fpsden=fpsden, pp=pp, threads=threads, timecodes=timecodes, \
  38. seekmode=seekmode, rffmode=rffmode, width=width, height=height, resizer=resizer, \
  39. colorspace=colorspace, utf8=utf8, varprefix=varprefix)
  40.  
  41. a = (atrack <= -2) ? blankclip(audio_rate=0) : ffaudiosource(source=source, \
  42. track=atrack, cache=cache, cachefile=cachefile, adjustdelay=adjustdelay, \
  43. utf8=utf8, varprefix=varprefix)
  44.  
  45. return audiodubex(v,a)
  46. }
  47.  
  48. function FFImageSource(string source, int "width", int "height", string "resizer", \
  49. string "colorspace", bool "utf8", string "varprefix") {
  50.  
  51. width = default(width,-1)
  52. height = default(height,-1)
  53. resizer = default(resizer,"BICUBIC")
  54. colorspace = default(colorspace,"")
  55. utf8 = default(utf8,false)
  56. varprefix = default(varprefix,"")
  57.  
  58. return FFVideoSource(source, cache=false, seekmode=-1, width=width, height=height, \
  59. resizer=resizer, colorspace=colorspace, utf8=utf8, varprefix=varprefix)
  60. }
  61.  
  62. function FFCopyrightInfringement(string source) {
  63. ################################################################
  64. # Violates copyright
  65. # * With audio
  66. # * No annoying lawyers
  67. # * Simple syntax
  68. # * Do not use on Britney Spears' music videos or sex tapes
  69. #
  70. # And whatever you do:
  71. # DO NOT TELL NEURON2 THAT YOU USED THIS FUNCTION
  72. ################################################################
  73. FFIndex(source=source)
  74. return audiodubex(FFVideoSource(source=source), FFAudioSource(source=source))
  75. }
  76.  
  77. function FFFormatTime(int ms) {
  78.  
  79. s = ms / 1000
  80. ms = ms % 1000
  81. m = s / 60
  82. s = s % 60
  83. h = m / 60
  84. m = m % 60
  85.  
  86. return string(h) + ":" + string(m,"%02.0f") + ":" + string(s,"%02.0f") + "." + string(ms,"%03.0f")
  87. }
  88.  
  89. function FFInfo(clip c, bool "framenum", bool "frametype", bool "cfrtime", bool "vfrtime", string "varprefix", int "text_color", int "halo_color") {
  90.  
  91. framenum = default(framenum,true)
  92. frametype = default(frametype,true)
  93. cfrtime = default(cfrtime,true)
  94. vfrtime = default(vfrtime,true)
  95. varprefix = default(varprefix, FFVAR_PREFIX)
  96.  
  97. c.frameevaluate("""
  98. fftempstring = ""
  99. varprefix = """" + varprefix + """"""")
  100.  
  101. framenum ? frameevaluate("""fftempstring = fftempstring + "Frame Number: " + string(current_frame) + " of " + string(framecount()) + "\n" """, after_frame=true) : nop()
  102. frametype ? frameevaluate("""fftempstring = fftempstring + "Picture Type: " + chr(eval(varprefix + "FFPICT_TYPE")) + "\n" """, after_frame=true) : nop()
  103.  
  104. cfrtime ? frameevaluate("""fftempstring = fftempstring + "CFR Time: " + FFFormatTime(round((current_frame * 1000) / framerate())) + "\n" """, after_frame=true) : nop()
  105. vfrtime ? frameevaluate("""fftempstring = fftempstring + "VFR Time: " + FFFormatTime(eval(varprefix + "FFVFR_TIME")) + "\n" """, after_frame=true) : nop()
  106.  
  107. #check whether text_color and halo_color are defined in parameter list
  108. text_color_string= (Defined(text_color)) ? "text_color="+string(text_color)+"," : ""
  109. halo_color_string= (Defined(halo_color)) ? "halo_color="+string(halo_color)+"," : ""
  110.  
  111. return scriptclip("subtitle(fftempstring,"+text_color_string+halo_color_string+"lsp = 1)", after_frame=true)
  112. }
Add Comment
Please, Sign In to add comment