Compare commits

...

2 Commits

Author SHA1 Message Date
e94536baa4 Bump version 0.0.3a2
Some checks failed
ci/woodpecker/push/linting Pipeline failed
ci/woodpecker/tag/linting Pipeline failed
2022-11-11 09:33:18 +01:00
0fd8b5210c Wrap ffmpeg calls in "try/except" blocks. Log errors 2022-11-11 09:32:50 +01:00

View File

@ -52,7 +52,7 @@ encoding: dict[str, Any] = {
# program version
# make tests reproducible by tag
version = "v0.0.3"
version = "v0.0.3a2"
# always round timestamp to integer
def now():
@ -367,17 +367,48 @@ def main(inputfile: str, outputpath: str = "encodes", keepencodes: bool = False)
# execute previously defined encoding settings
starttime = now()
try:
ff.run()
except ffmpy.FFRuntimeError:
with open("error.log", "a") as file:
file.write(
"FFMPEG error. Failed encoding",
inputfile,
"to",
outputfile,
)
endtime = now()
difftime = int(endtime - starttime)
outputfilesize = os.path.getsize(outputfile) / 1024 / 1024
try:
vmaf = score_vmaf(outputfile=outputfile, inputfile=inputfile)
except ffmpy.FFRuntimeError:
with open("error.log", "a") as file:
file.write(
"FFMPEG error. To calculate VMAF score of",
outputfile,
)
try:
ssim = score_ssim(outputfile=outputfile, inputfile=inputfile)
except ffmpy.FFRuntimeError:
with open("error.log", "a") as file:
file.write(
"FFMPEG error. To calculate SSIM score of",
outputfile,
)
try:
mse = score_psnr(outputfile=outputfile, inputfile=inputfile)
except ffmpy.FFRuntimeError:
with open("error.log", "a") as file:
file.write(
"FFMPEG error. To calculate MSE score of",
outputfile,
)
write_line(
datafile=datafile,