mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-25 02:29:40 +00:00
+ improvements from #27
This commit is contained in:
parent
c38550ae72
commit
d6f0a9ba55
1 changed files with 10 additions and 7 deletions
17
av1an.py
17
av1an.py
|
@ -139,7 +139,6 @@ class Av1an:
|
||||||
cpu = os.cpu_count()
|
cpu = os.cpu_count()
|
||||||
ram = round(virtual_memory().total / 2 ** 30)
|
ram = round(virtual_memory().total / 2 ** 30)
|
||||||
|
|
||||||
if self.args.workers != 0:
|
|
||||||
self.workers = self.args.workers
|
self.workers = self.args.workers
|
||||||
|
|
||||||
elif self.encoder == 'aom' or 'rav1e':
|
elif self.encoder == 'aom' or 'rav1e':
|
||||||
|
@ -438,15 +437,19 @@ class Av1an:
|
||||||
print('Wrong encoding settings')
|
print('Wrong encoding settings')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# Determine resources
|
# Determine resources if workers don't set
|
||||||
self.determine_resources()
|
if self.args.workers != 0:
|
||||||
|
self.workers = self.args.workers
|
||||||
|
else:
|
||||||
|
self.determine_resources()
|
||||||
|
|
||||||
# Creating threading pool to encode bunch of files at the same time
|
# Creating threading pool to encode bunch of files at the same time and show progress bar
|
||||||
print(f'\rWorkers: {self.workers} Params: {self.encoding_params}')
|
|
||||||
|
|
||||||
# Progress bar
|
|
||||||
with Pool(self.workers) as pool:
|
with Pool(self.workers) as pool:
|
||||||
|
|
||||||
self.workers = min(len(commands), self.workers)
|
self.workers = min(len(commands), self.workers)
|
||||||
|
|
||||||
|
print(f'\rWorkers: {self.workers} Params: {self.encoding_params}')
|
||||||
|
|
||||||
for i, _ in enumerate(tqdm(pool.imap_unordered(self.encode, commands), total=len(files), leave=True), 1):
|
for i, _ in enumerate(tqdm(pool.imap_unordered(self.encode, commands), total=len(files), leave=True), 1):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue