Advertisement
hungdaita

Overlay

Jul 22nd, 2017
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.01 KB | None | 0 0
  1. # let's say, we decided to fix 3 lines on the all sides: left, top, right, bottom, then:
  2.  
  3. FFVideoSource("E:\300 MUX\300MUX.MKV").Crop(0,140,0,-140)
  4.  
  5. safe = Crop(4,4,-4,-6) # safe area where we won't change the colorspace
  6.  
  7. ConvertToYV24() # now we go to YV24 to fix our lines because we can't fix odd lines with YV12
  8.  
  9. base1 = Crop(4,0,-4,0) # here we choose the area where we'll fix lines on the left/right
  10.  
  11. l1 = Crop(0, 0, 1 - Width(), 0).Tweak(cont=1.10) # 1st line on the left
  12. l2 = Crop(1, 0, 2 - Width(), 0).Tweak(cont=1.06) # 2nd line on the left
  13. l3 = Crop(2, 0, 3 - Width(), 0).Tweak(cont=1.02) # 3d line on the left
  14. l4 = Crop(3, 0, 4 - Width(), 0) # 4th line, we won't fix this line, so don't need changes here
  15.  
  16. r4 = Crop(Width() - 4, 0, -3, 0) # 4th line, we won't fix this line, so don't need changes here too
  17. r3 = Crop(Width() - 3, 0, -2, 0).Tweak(cont=1.00) # 3d line on the right
  18. r2 = Crop(Width() - 2, 0, -1, 0).Tweak(cont=1.00) # 2nd line on the right
  19. r1 = Crop(Width() - 1, 0, 0, 0).Tweak(cont=1.00) # 1st line on the right
  20.  
  21. StackHorizontal(l1, l2, l3, l4, base1, r4, r3, r2, r1) # after fixing we stack those fixed lines with the 1st area (base1)
  22.  
  23. base2 = Crop(0,4,0,-6) # now we take the area where we'll fix lines on the top/bottom
  24.  
  25. t1 = Crop(0, 0, 0, 1 - Height()).Tweak(cont=1.00) # 1st line on the top
  26. t2 = Crop(0, 1, 0, 2 - Height()).Tweak(cont=0.99) # 2nd line on the top
  27. t3 = Crop(0, 2, 0, 3 - Height()).Tweak(cont=1.00) # 3d line on the top
  28. t4 = Crop(0, 3, 0, 4 - Height()) # 4th line, for example we don't need to fix this line, so don't need changes here
  29.  
  30. b6 = Crop(0, Height() - 6, 0, -5)
  31. b5 = Crop(0, Height() - 5, 0, -4).Tweak(cont=0.99)
  32. b4 = Crop(0, Height() - 4, 0, -3).Tweak(cont=0.98)
  33. b3 = Crop(0, Height() - 3, 0, -2).Tweak(cont=0.98) # 3d line on the bottom
  34. b2 = Crop(0, Height() - 2, 0, -1).Tweak(cont=0.99) # 2nd line on the bottom
  35. b1 = Crop(0, Height() - 1, 0, 0).Tweak(cont=0.99) # 1st line on the bottom
  36.  
  37. StackVertical(t1, t2, t3, t4, base2, b6, b5, b4, b3, b2, b1) # after fixing on the top/bottom we stack those fixed lines with the 2nd area (base2)
  38.  
  39. ConvertToYV12(matrix="Rec709") # back to normal YV12 colorspace
  40.  
  41. # here we use balancebordersgt over all fixed lines to prevent color changes from scene to scene
  42. # so we don't need to do an overlay for each scene of our video (BB options may vary in different cases)
  43.  
  44. BalanceBordersGT(3,3,3,3)
  45. BalanceBordersGT(3,3,3,3,thresh=4,blur=10)
  46.  
  47. Overlay(last, safe, x=4, y=4) # now we get the final pic "inserting" our safe area into fixed area via overlay function
  48.  
  49. Spline36Resize(1280,534)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement