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.

check24fps.py 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ###############################################
  2. # Check if a video is rather NTSC or film
  3. ###############################################
  4. adm=Avidemux()
  5. editor=Editor()
  6. gui=Gui()
  7. #
  8. duration=editor.getVideoDuration()
  9. frame=0
  10. lastDts=-1
  11. count=0
  12. dts=-1
  13. #
  14. ntsc=0
  15. film=0
  16. pal=0
  17. other=0
  18. maxfailure=40 # if we have more than failure to get DTS, stop
  19. while True:
  20. dts=editor.getDts(frame)
  21. frame=frame+1
  22. count=count+1
  23. if(dts!=-1):
  24. if(lastDts==-1):
  25. lastDts=dts
  26. count=0
  27. continue
  28. deltaTime=dts-lastDts
  29. deltaTime/=count
  30. lastDts=dts
  31. count=0
  32. if(deltaTime>41000 and deltaTime<42000):
  33. film=film+1
  34. elif(deltaTime>33000 and deltaTime<34000):
  35. ntsc=ntsc+1
  36. elif(deltaTime>39000 and deltaTime<41000):
  37. pal=pal+1
  38. else:
  39. other=other+1
  40. else: # Dts=-1, if we are more than at 90% of the movie it is probably the end...
  41. if(count>(maxfailure)):
  42. break
  43. # end while
  44. total=ntsc+film+other+pal
  45. if(total==0):
  46. gui.displayInfo("Not enough info to check...")
  47. exit(0)
  48. pal=round(0.4+(100*pal)/total)
  49. ntsc=round(0.4+(100*ntsc)/total)
  50. film=round((100*film)/total)
  51. other=round(0.4+(100*other)/total)
  52. gui.displayInfo("Framerate check","Pal ="+str(pal)+"%\nFilm="+str(film)+"%\n Ntsc="+str(ntsc)+"%\nOther="+str(other)+"%")
  53. #