Advertisement
Zastin

VS screenshot script

Nov 7th, 2017
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.22 KB | None | 0 0
  1. # paste this all into a Vapoursynth Editor window
  2. # replace the variables w/h, frames, paths
  3. # optionally define separate start frames or subtitle files
  4. # protip: set "showsubs = frames" to display subs on every frame
  5.  
  6. # hit F7 and wait for the Benchmark mini-window to pop up
  7. # hit Enter and let the script run
  8. # the screenshots will be in the folder of the first path in paths
  9.  
  10.  
  11. w, h = 1920, 1080
  12.  
  13. frames = [24, 192, 9465, 32245]
  14. showsubs = [192, 32245]
  15.  
  16. paths = [r'C:\[Group1] Show - 00 [CRC32].mkv']
  17. start = [0] # start on frame number n
  18. subs = [None] # .ass file path
  19.  
  20. paths+= [r'C:\[Group2] Show - 00 [CRC32].mkv']
  21. start+= [0]
  22. subs += [None]
  23.  
  24. paths+= [r'C:\[Group3] Show - 00 [CRC32].mkv']
  25. start+= [0]
  26. subs += [None]
  27.  
  28. paths+= [r'C:\[Group4] Show - 00 [CRC32].mkv']
  29. start+= [0]
  30. subs += [None]
  31.  
  32. paths+= [r'C:\[Group5] Show - 00 [CRC32].mkv']
  33. start+= [0]
  34. subs += [None]
  35.  
  36. #####################
  37.  
  38. from vapoursynth import core, RGBS, YUV444PS
  39.  
  40. outpath = paths[0].split('\\')
  41. outpath = [i+'/' for i in outpath[:len(outpath)-1]]
  42. outpath = ''.join(outpath)
  43. #outpath = r'C:\Show Title\Screenshots\'
  44.  
  45. def getmatrix(clip):
  46.     if clip.width <= 1024 and clip.height <= 576:
  47.         return 6
  48.     if clip.width <= 2048 and clip.height <= 1536:
  49.         return 1
  50.     return 9
  51.  
  52. shots, clip_subs = [core.std.BlankClip(None, w, h, RGBS, 1)] * 2
  53. for i in range(len(paths)):
  54.    
  55.     if paths[i].endswith('.m2ts'):
  56.         clip_o = core.lsmas.LWLibavSource(paths[i])
  57.     else:
  58.         clip_o = core.ffms2.Source(paths[i])
  59.    
  60.     clip = core.resize.Spline36(clip_o, w, h, format=YUV444PS)
  61.    
  62.     if subs[i] is not None:
  63.         clip_subs = core.sub.TextFile(clip, subs[i])[start[i]:]
  64.         clip_subs = core.resize.Point(clip_subs, format=RGBS,prefer_props=1,matrix_in=getmatrix(clip_o))
  65.    
  66.     clip = core.resize.Point(clip, format=RGBS,prefer_props=1,matrix_in=getmatrix(clip_o))[start[i]:]
  67.    
  68.     title = paths[i].split('\\')[-1]
  69.    
  70.     for n in frames:
  71.         clipn = clip_subs if n in showsubs and subs[i] is not None else clip
  72.         shots = shots + clipn[n].text.Text(title,7).text.Text(str(n+start[i]),9).imwri.Write('PNG', outpath+'{}__'.format(n)+title+'%d.png', 0, 0)
  73.  
  74. shots[1:].set_output()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement