More exception catches and fix for boost

This commit is contained in:
Zen 2020-05-07 19:14:03 +03:00
parent c9df86c9f0
commit 3d3f092b1a

View file

@ -550,19 +550,24 @@ class Av1an:
def boost(self, command: str, br_geom, new_cq=0):
"""Based on average brightness of video decrease(boost) Quantize value for encoding."""
cq = self.man_cq(command, -1)
if not new_cq:
if br_geom < 128:
new_cq = cq - round((128 - br_geom) / 128 * self.d.get('br'))
try:
cq = self.man_cq(command, -1)
if not new_cq:
if br_geom < 128:
new_cq = cq - round((128 - br_geom) / 128 * self.d.get('boost_range'))
# Cap on boosting
if new_cq < self.d.get('bl'):
new_cq = self.d.get('bl')
else:
new_cq = cq
cmd = self.man_cq(command, new_cq)
# Cap on boosting
if new_cq < self.d.get('boost_limit'):
new_cq = self.d.get('boost_limit')
else:
new_cq = cq
cmd = self.man_cq(command, new_cq)
return cmd, new_cq
return cmd, new_cq
except Exception as e:
_, _, exc_tb = sys.exc_info()
print(f'Error in encoding loop {e}\nAt line {exc_tb.tb_lineno}')
def plot_vmaf(self):
with open(self.d.get('temp') / 'vmaf.txt', 'r') as f: