Advertisement
AzraelNewtype

Kyuren 39 vpy

Dec 2nd, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.07 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import vapoursynth as vs
  4. import sys, os
  5. sys.path.append(os.getenv('APPDATA') + r"\VapourSynth\scripts")
  6. import audiocutter
  7. import havsfunc as has
  8. import resamplehq as rhq
  9.  
  10.  
  11. def blank_strip(c, clip, height, offset):
  12.     t = c.std.CropRel(clip, 0, 0, 0, height+offset)
  13.     t = c.std.AddBorders(t, 0, 0, 0, height)
  14.     b = c.std.CropRel(clip, 0, 0, clip.height-offset, 0)
  15.     return c.std.StackVertical([t,b])
  16.  
  17. core = vs.get_core()
  18.  
  19. ts_file = "Uchuu_Sentai_Kyuuranger_039.d2v"
  20. ts_in = core.d2v.Source(ts_file)
  21. ac = audiocutter.AudioCutter()
  22.  
  23. #Pre-Cold: ~450
  24. #SuperSentaiSeries: 60
  25. #OP:  2216
  26. #O-Christmas: ~300
  27. #ED: 1976
  28. #TAMA Gap: ~120
  29. #PV: 750
  30. # (926, 14110), (15911, 24240), (26939, 33709), (35959, 50079)
  31. # ts_in = core.text.FrameNum(ts_in, 5)
  32.  
  33.  
  34. # dec = ts_in
  35. vid = ac.split(ts_in, [(1367,6192, 'Cold  Open'), (6193,8408, 'Opening'), (8711,14103, 'Part A'), (15905,24232, 'Part B'), (26932,33703, 'Part C'), (35953,47219, 'Part D'), (47220,49197, 'Ending'), (49318,50067, 'Preview')])#, doublecheck=True)
  36. # dec = vid
  37.  
  38. fm = core.vivtc.VFM(vid, order=1, mode=2)
  39. deint = core.tdm.TDeintMod(fm, order=1, edeint=core.znedi3.nnedi3(clip=fm, field=1))
  40. pp = core.std.FrameEval(fm, lambda n, f: deint if f.props._Combed else fm, fm)
  41. pp2 = blank_strip(core, pp, 184, 46)
  42. dec = core.vivtc.VDecimate(pp2, clip2=pp)
  43.  
  44. ac.ready_qp_and_chapters(dec)
  45.  
  46. # dec = core.resize.Bicubic(dec, height=810, format=vs.YUV420P16, filter_param_a=-.5,filter_param_b=.25)
  47. dec = rhq.resample_hq(dec, height=810, kernel='cubic', filter_param_a=-.5, filter_param_b=.25)
  48. dec = core.std.Crop(dec, 2,2,0,0)
  49. dec = has.SMDegrain(dec, contrasharp=True, prefilter=4, Str=1.1, thSAD=250)
  50. dec = core.resize.Bicubic(dec, format=vs.YUV420P10, dither_type="ordered")
  51. # dec = core.resize.Bicubic(dec, format=vs.RGB48, matrix_in_s="709")
  52.  
  53. dec.set_output()
  54.  
  55. if __name__ == "__main__":
  56.     prefix = os.path.splitext(__file__)[0]
  57.     ac.cut_audio(prefix + '_aud_ac.mka', video_source=ts_file)
  58.     ac.write_qpfile(prefix + "-vsac.qpfile")
  59.     ac.write_chapters(prefix + "-vsac-ch.txt")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement