Skip to content

Commit df4407d

Browse files
committed
fixes before release
1 parent 3aa0158 commit df4407d

File tree

1 file changed

+31
-30
lines changed

1 file changed

+31
-30
lines changed

av1an.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -928,38 +928,38 @@ def concatenate_video(self):
928928

929929
def encoding_loop(self, commands):
930930
"""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
956947
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')
958949

959-
clips = len([x for x in enc_path.iterdir() if x.suffix == ".mkv"])
960-
print(f'\rQueue: {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)
962958

959+
print(f'\rQueue: {clips} Workers: {w} Passes: {self.d.get("passes")}\n'
960+
f'Params: {self.d.get("video_params")}')
961+
962+
with Pool(w) as pool:
963963
manager = Manager()
964964
counter = manager.Counter(total, initial)
965965
commands = [(x, counter) for x in commands]
@@ -1036,9 +1036,10 @@ def main_thread(self):
10361036
for file in self.d.get('queue'):
10371037
tm = time.time()
10381038
self.d['input'] = file
1039+
print(f'Encoding: {file}')
10391040
self.d['output_file'] = None
10401041
self.video_encoding()
1041-
print(f'\rFinished: {round(time.time() - tm, 1)}s\n\n')
1042+
print(f'Finished: {round(time.time() - tm, 1)}s\n')
10421043
else:
10431044
self.video_encoding()
10441045
print(f'Finished: {round(time.time() - tm, 1)}s')

0 commit comments

Comments
 (0)