Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # Report x264 video encoding progress and estimated time of completion
- # Programmed by Jeffry Johnston, 2012. Released to the public domain.
- import sys, time
- if len(sys.argv) != 4: print "Usage: eta VIDEO_LENGTH_IN_SECONDS VIDEO_FPS X264_LOG_FILENAME\nExample: eta 5781.835 24000/1001 video.xlog"; sys.exit(1)
- fps_s = sys.argv[2]
- i = fps_s.find("/")
- if i == -1: i = fps_s.find(":")
- if i != -1: video_fps = float(fps_s[:i]) / float(fps_s[i + 1:])
- else: video_fps = float(fps_s)
- video_frames = int(round(float(sys.argv[1]) * video_fps))
- while 1:
- f = open(sys.argv[3], "r"); l = f.read().split("\r")[-2].split(); f.close()
- frames_done = int(l[0])
- average_fps = float(l[2])
- print "Progress: " + str(int(10000 * (float(frames_done) / video_frames)) / 100.0) + "% (" + str(frames_done) + "/" + str(video_frames) + " frames),",
- print "ETA: " + time.strftime("%a %b %d, %I:%M:%S %p", time.localtime(time.time() + ((video_frames - frames_done) / average_fps))) + " (" + str(average_fps) + " fps)."
- try: time.sleep(15 * 60) # wait 15 minutes before reporting again
- except KeyboardInterrupt: print; sys.exit(0)
Advertisement
Add Comment
Please, Sign In to add comment