You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

720p.py 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ###############################################
  2. # Convert to DVD adm tinypy script
  3. # Mean 2011
  4. ###############################################
  5. import ADM_imageInfo
  6. import ADM_image
  7. adm=Avidemux()
  8. finalSizeWidth=1280
  9. finalSizeHeight=[ 720,720]
  10. #
  11. source=ADM_image.image()
  12. dest=ADM_image.image()
  13. desc=""
  14. true_fmt=ADM_imageInfo.get_video_format(desc)
  15. if(true_fmt is None):
  16. raise
  17. fmt=true_fmt
  18. source.width=adm.getWidth()
  19. source.height=adm.getHeight()
  20. source.fmt=fmt
  21. dest.fmt=fmt
  22. dest.width=16
  23. dest.height=16
  24. #
  25. MP2=80
  26. AC3=0x2000
  27. DTS=0x2001
  28. supported=[MP2,AC3,DTS]
  29. #
  30. print("Format : "+str(fmt))
  31. ############################
  32. # Interlaced/ AR
  33. ############################
  34. mnuDeint = DFMenu("Deint Method:");
  35. mnuDeint.addItem("None")
  36. mnuDeint.addItem("Yadiff")
  37. mnuDeint.addItem("Vdpau")
  38. mnuSourceRatio = DFMenu("Source Aspect Ratio:");
  39. mnuSourceRatio.addItem("1:1")
  40. mnuSourceRatio.addItem("4:3")
  41. mnuSourceRatio.addItem("16:9")
  42. dlgWizard = DialogFactory("auto 720p ("+desc+")");
  43. dlgWizard.addControl(mnuSourceRatio);
  44. dlgWizard.addControl(mnuDeint);
  45. res=dlgWizard.show()
  46. if res!=1:
  47. exit()
  48. source.ar=mnuSourceRatio.index
  49. dest.ar=ADM_image.AR_1_1
  50. deint=mnuDeint.index
  51. #
  52. if(deint==1):
  53. adm.addVideoFilter("yadif","mode=0","order=1")
  54. print("Yadiff")
  55. if(deint==2):
  56. adm.addVideoFilter("vdpauDeint","resizeToggle=False","deintMode=0","targetWidth=512","targetHeight=384")
  57. print("Vdpau")
  58. # Resize
  59. resizer=source.compute_resize(source,dest,1280,[720,720,720],ADM_imageInfo.aspectRatio)
  60. if(resizer is None):
  61. exit()
  62. print("Resize to "+str(resizer.width)+"x"+str(resizer.height))
  63. # No need to add black border
  64. resizer.leftright=0
  65. resizer.topbottom=0
  66. source.apply_resize(resizer)
  67. ############################
  68. # Handle audio....
  69. ############################
  70. encoding=adm.audioEncoding
  71. fq=adm.audioEncoding
  72. channels=adm.audioChannels
  73. reencode=False
  74. ##################################
  75. # Video
  76. ##################################
  77. #
  78. #
  79. adm.videoCodec("x264","params=AQ=20","MaxRefFrames=2","MinIdr=10","MaxIdr=150","threads=99","_8x8=True","_8x8P=True","_8x8B=True","_4x4=True","_8x8I=True","_4x4I=True","MaxBFrame=2","profile=30","CABAC=True","Trellis=True")
  80. ###################################
  81. # Container = Mpeg PS/DVD
  82. ###################################
  83. adm.setContainer("MKV","forceDisplayWidth=False","displayWidth=1280")