Advertisement
EvilAsh25

EvilAsh25_sample_avisynth_advanced

Sep 8th, 2016
426
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ######################
  2. # Updated 5/17/2017
  3. # This is meant to be a starter script for using MPC-HC to capture with a PEXHDCAP
  4. # I currently use PEXHDCAP driver 1.1.0.140.7 with these settings: http://i.imgur.com/DG4RlHH.jpg
  5. # The Video Proc Amp tab: http://i.imgur.com/L6xdn9a.jpg
  6. ######################
  7. # Google Search for these plugins
  8. LoadPlugin("C:\avisynth\ColorMatrix.dll")
  9. LoadPlugin("C:\avisynth\ChromaShift.dll")
  10. #
  11. ######################
  12. # This function is used to fix the capturing from specifically the PEXHDCAP
  13. # You can tweak the levels a bit if you want to change the look.
  14. ######################
  15. function colorcorrection(clip c)
  16. {
  17. c
  18. # Fix the Chroma Shift that is caused by the PEXHDCAP
  19. ChromaShift(U=-2)
  20. ConvertToYV24()
  21. #Fix the Luma, it is off by 1 pixel
  22. MergeLuma(Crop(1,0,width-1,height).AddBorders(0,0,1,0))
  23. # Convert back so we are working in the correct colorspace
  24. ConvertToYUY2(matrix="Rec.709")
  25. # Adjust Gamma to more closely match a CRT TV and clamp the color levels to what the PEXHDCAP captures (16-235)
  26. Levels(0, 0.82, 255, 16, 235, coring=false)
  27. # Convert to the SD colorspace, the PEXHDCAP captures in the HD colorspace
  28. ColorMatrix(mode="Rec.709->Rec.601")
  29. }
  30. #
  31. ######################
  32. # This is the basic capture function for 240p material, it crops, resizes, and does a couple of minor adjustments.
  33. # cx = cropping px from the left side
  34. # cy = cropping px from the top
  35. # cw = width of game, used for cropping right side
  36. # w = final width to size to
  37. # s = amount to sharpen horizontally
  38. ######################
  39. function capture(clip c, float cx, float cy, int cw, int w, float s)
  40. {
  41. c
  42. h=2
  43. # Crop and Resize to the correct height (224*2)
  44. PointResize(cw, h*224 , cx, cy*h/2, cw, 224)
  45. #
  46. # Adjust the saturation (optional)
  47. Tweak(sat=1.05)
  48. # Resize to the final Width
  49. BicubicResize(w, Height)
  50. #Sharpen after the resize
  51. Sharpen(s, 0.0)
  52. #
  53. }
  54. ######################
  55. # Created this function after reading Acmlm's capture guide here: http://acmlm.org/etc/vidfilters/snes.htm
  56. # I found that this can create a sharper picture, but it also requires a lot more tweaking.
  57. # cx = cropping px from the left side
  58. # cy = cropping px from the top
  59. # cw = width of game, used for cropping right side
  60. # w = final width to size to
  61. # s = amount to sharpen the width
  62. ######################
  63. function NEWcapture(clip c, float cx, float cy, float cw, int w, float s)
  64. {
  65. c
  66. # Convert to the YV24 Colorspace to minimize colorbleed
  67. ConvertToYV24()
  68. # Crop and resize the width to the native game capture size (256*224)
  69. # These are done in subpixel increments and can vary between game systems
  70. BicubicResize(260, 224,  -0.6, -0.1, cx, cy, cw, 224)
  71. # Sharpen the image from the resize
  72. Sharpen(s, 0)
  73. # 2 pixels are left on the right and left sides (on purpose) crop them off here
  74. crop(2, 0, Width-4, Height)
  75. # Set the size to 512x448
  76. PointResize(Width*2, Height*2)
  77. # Convert back to the correct colorspace
  78. ConvertToYUY2()
  79. # Resize to the final Width
  80. BicubicResize(w, Height)
  81. }
  82. ######################
  83. # This function is for capturing 240p video (usually NES, SNES, Genesis) from a S-Video source (GV-USB2 etc..)
  84. # cx = cropping px from the left side
  85. # cy = cropping px from the top
  86. # cw = width of game, used for cropping right side
  87. # w = final width to size to
  88. # s = amount to sharpen horizontally
  89. ######################
  90. function captureSVID240(clip c, float cx, float cy, int cw, int w, float s)
  91. {
  92. c
  93. # Separate Fields, this creates 60fps video with half height
  94. ComplementParity.SeparateFields()
  95. # Double the Height to get back to original
  96. PointResize(Width, Height*2)
  97. # Crop and resize
  98. PointResize(cw, 448 , cx, cy, cw, 448)
  99. # Set the width
  100. BicubicResize(w, Height)
  101. # These can be adjusted to your liking, look them up on the Avisynth Wiki
  102. Tweak(sat=1.05)
  103. Sharpen(s, 0.0)
  104. }
  105. #
  106. ######################
  107. # This is the main area where you adjust things.
  108. # Generally I copy/paste a new function then adjust cropping for that new game.
  109. # These functions assume the final game height is 448px.
  110. #####################
  111. #
  112. # Only use this with a PEXHDCAP
  113. colorcorrection()
  114. #
  115. # These functions are for a PEXHDCAP
  116. capture(33, 8, 644, 586, 0.3) #SNES
  117. #capture(60, 7, 622, 586, 0.3) #DW
  118. #capture(30, 8, 660, 586, 0.3) #SM64
  119. #capture(40, 12, 640, 586, 0.3) #LoZ
  120. #capture(40, 8, 640, 586, 0.3) #Z2
  121. #
  122. # Use this function if you have a GV-USB2 or Dazzle
  123. #captureSVID240(42, 16, 640, 586, 0.3) #SNES (ALTTP)
  124. #
  125. #This is the advanced capture function, it will take a bunch of tweaking to get the subpixel cropping correct (240p suite recommended)
  126. #resized to 512x448 with these settings, adjust the width after you get the subpixel cropping perfect
  127. #NEWcapture(28.55, 8, 654.3, 512, 0.3) #SNES
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement