Advertisement
junh1024

moo_mod

May 17th, 2013
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. #originally by nodame, modded hax-ily by junh1024 to read in tfm statsmetrics
  3. #5860, 6, 2
  4. import sys
  5.  
  6. # Number of frames in the clip.
  7. num_frames = int(sys.argv[1])
  8. # Number of frames in a cycle.
  9. cycle = 6
  10. # Position of first duplicate in cycle. Starts at 0. Deprecated now.
  11. dup_pos = int(sys.argv[2])
  12. input_file = sys.argv[3]
  13. output_file = sys.argv[4]
  14.  
  15. f = open(output_file, "w")
  16. mi = open(input_file, "r") #tfm metric input
  17.  
  18. f.write("# timecode format v2\n")
  19.  
  20. current_timecode = 0
  21. linecount=0
  22.  
  23. for line in mi:
  24.     if(linecount < 2): #skip tfm metrics headers
  25.         print("skipped");
  26.     else:
  27.         f.write(str(current_timecode) + "\n")
  28.         thestats=line.split()
  29.         #need a bit of tfm statsmetrics file hacking to reject fadein smallnumbers. 2560 is threshold, hardcoded
  30.         if(int(thestats[1])<2560): #the second number from the tfmstatsmetric file we r intrested in
  31.         #we set the decimated frame to play at same time
  32.             current_timecode += 0 #can you think of a way to set the previous frame to 20, and this frame to 20
  33.         else: #since it would make playback a bit smoother/less CPU?
  34.             current_timecode += 40 #might be a bit hard to do since would need to lookahead 1 line
  35.     linecount=linecount+1
  36.  
  37. f.close()
  38. mi.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement