@@ -928,38 +928,38 @@ def concatenate_video(self):
928
928
929
929
def encoding_loop (self , commands ):
930
930
"""Creating process pool for encoders, creating progress bar."""
931
- # Reduce if more workers than clips
932
- w = min (self .d .get ('workers' ), len (commands ))
933
- with Pool (w ) as pool :
934
- enc_path = self .d .get ('temp' ) / 'split'
935
- done_path = self .d .get ('temp' ) / 'done.txt'
936
-
937
- if self .d .get ('resume' ) and done_path .exists ():
938
-
939
- self .log ('Resuming...\n ' )
940
- with open (done_path , 'r' ) as f :
941
- lines = [line for line in f ]
942
- if len (lines ) > 1 :
943
- data = literal_eval (lines [- 1 ])
944
- total = int (lines [0 ])
945
- done = len ([x [1 ] for x in data ])
946
- initial = sum ([int (x [0 ]) for x in data ])
947
- else :
948
- done = 0
949
- initial = 0
950
- total = self .frame_probe (self .d .get ('input' ))
951
- self .log (f'Resumed with { done } encoded clips done\n \n ' )
952
-
953
- else :
954
- initial = 0
955
- with open (Path (self .d .get ('temp' ) / 'done.txt' ), 'w' ) as f :
931
+ enc_path = self .d .get ('temp' ) / 'split'
932
+ done_path = self .d .get ('temp' ) / 'done.txt'
933
+
934
+ if self .d .get ('resume' ) and done_path .exists ():
935
+
936
+ self .log ('Resuming...\n ' )
937
+ with open (done_path , 'r' ) as f :
938
+ lines = [line for line in f ]
939
+ if len (lines ) > 1 :
940
+ data = literal_eval (lines [- 1 ])
941
+ total = int (lines [0 ])
942
+ done = len ([x [1 ] for x in data ])
943
+ initial = sum ([int (x [0 ]) for x in data ])
944
+ else :
945
+ done = 0
946
+ initial = 0
956
947
total = self .frame_probe (self .d .get ('input' ))
957
- f . write (f'{ total } \n ' )
948
+ self . log (f'Resumed with { done } encoded clips done \n \n ' )
958
949
959
- clips = len ([x for x in enc_path .iterdir () if x .suffix == ".mkv" ])
960
- print (f'\r Queue: { clips } Workers: { w } Passes: { self .d .get ("passes" )} \n '
961
- f'Params: { self .d .get ("video_params" )} ' )
950
+ else :
951
+ initial = 0
952
+ with open (Path (self .d .get ('temp' ) / 'done.txt' ), 'w' ) as f :
953
+ total = self .frame_probe (self .d .get ('input' ))
954
+ f .write (f'{ total } \n ' )
955
+
956
+ clips = len ([x for x in enc_path .iterdir () if x .suffix == ".mkv" ])
957
+ w = min (self .d .get ('workers' ), clips )
962
958
959
+ print (f'\r Queue: { clips } Workers: { w } Passes: { self .d .get ("passes" )} \n '
960
+ f'Params: { self .d .get ("video_params" )} ' )
961
+
962
+ with Pool (w ) as pool :
963
963
manager = Manager ()
964
964
counter = manager .Counter (total , initial )
965
965
commands = [(x , counter ) for x in commands ]
@@ -1036,9 +1036,10 @@ def main_thread(self):
1036
1036
for file in self .d .get ('queue' ):
1037
1037
tm = time .time ()
1038
1038
self .d ['input' ] = file
1039
+ print (f'Encoding: { file } ' )
1039
1040
self .d ['output_file' ] = None
1040
1041
self .video_encoding ()
1041
- print (f'\r Finished : { round (time .time () - tm , 1 )} s\n \n ' )
1042
+ print (f'Finished : { round (time .time () - tm , 1 )} s\n ' )
1042
1043
else :
1043
1044
self .video_encoding ()
1044
1045
print (f'Finished: { round (time .time () - tm , 1 )} s' )
0 commit comments