estimate eta on concat protocol

Tue, 28 Nov 2017 22:49:41 +0100

author
mdd
date
Tue, 28 Nov 2017 22:49:41 +0100
changeset 19
3a9fd72717df
parent 18
91cf8d348c74
child 20
5b433bdd2023

estimate eta on concat protocol

ts2mkv.py file | annotate | diff | comparison | revisions
--- a/ts2mkv.py	Tue Nov 28 22:35:35 2017 +0100
+++ b/ts2mkv.py	Tue Nov 28 22:49:41 2017 +0100
@@ -353,15 +353,17 @@
         if len(inputs) > 1:
             # use ffmpeg input concat function
             # attention, ffmpeg concat protocol doesnt like escape sequences
-            fn["in"] = "\"concat:" + \
-                "|".join(inputs)\
-                .replace(r"\ ", " ")\
-                .replace(r"\'", "'")\
-                + "\""
+            for tmp in range(len(inputs)):
+                inputs[tmp] = inputs[tmp].replace(r"\ ", " ").replace(r"\'", "'")\
+
+            fn["in"] = "\"concat:" + "|".join(inputs) + "\""
             # no ETA calculation possible since we have only the length of first file
-            # TODO: we COULD estimate by multiplying with factor generated by input file sizes
-            print "No ETA info possible yet on split input"
-            self.info["frames_total"] = 0
+            # we could estimate by multiplying with factor generated by input file sizes
+            totalbytes = 0.0
+            for tmp in inputs:
+                totalbytes += os.path.getsize(tmp)
+            print "estimating total frames for ETA based on file sizes (we have multiple inputs here)"
+            self.info["frames_total"] *= totalbytes / os.path.getsize(inputs[0])
 
         idx = 0
         for tmp in inputs:

mercurial