Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- #originally by nodame, modded hax-ily by junh1024 to read in tfm statsmetrics
- #5860, 6, 2
- import sys
- # Number of frames in the clip.
- num_frames = int(sys.argv[1])
- # Number of frames in a cycle.
- cycle = 6
- # Position of first duplicate in cycle. Starts at 0. Deprecated now.
- dup_pos = int(sys.argv[2])
- input_file = sys.argv[3]
- output_file = sys.argv[4]
- f = open(output_file, "w")
- mi = open(input_file, "r") #tfm metric input
- f.write("# timecode format v2\n")
- current_timecode = 0
- linecount=0
- for line in mi:
- if(linecount < 2): #skip tfm metrics headers
- print("skipped");
- else:
- f.write(str(current_timecode) + "\n")
- thestats=line.split()
- #need a bit of tfm statsmetrics file hacking to reject fadein smallnumbers. 2560 is threshold, hardcoded
- if(int(thestats[1])<2560): #the second number from the tfmstatsmetric file we r intrested in
- #we set the decimated frame to play at same time
- current_timecode += 0 #can you think of a way to set the previous frame to 20, and this frame to 20
- else: #since it would make playback a bit smoother/less CPU?
- current_timecode += 40 #might be a bit hard to do since would need to lookahead 1 line
- linecount=linecount+1
- f.close()
- mi.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement