Add ssim filter

This commit is contained in:
RealStickman 2022-10-24 12:48:20 +02:00
parent d3753ac831
commit e5b2043298

View File

@ -148,7 +148,7 @@ def encode_libaom(inputfile: str, outputfile: str, crf: int, preset: Union[str,
def score_vmaf(outputfile: str, inputfile: str) -> dict[str, float]:
"""
Calculate a file's VMAF score
Calculate a file's VMAF score. Higher is better
Parameters:
outputfile (str): Path to output file
@ -197,6 +197,29 @@ def score_psnr(outputfile: str, inputfile: str):
ff.run()
# Steps to get mse value
def score_ssim(outputfile: str, inputfile: str):
"""
Calculate a file's SSIM rating. TBD
Parameters:
outputfile (str): Path to output file
inputfile (str): Path to input file
Return:
TBD
"""
ff = ffmpy.FFmpeg(
inputs=OrderedDict([(outputfile, None), (inputfile, None)]),
outputs={"-": "-lavfi ssim=stats_file=ssim.log -f null"},
)
ff.run()
# Steps to get ssim value
if __name__ == "__main__":
if not os.path.isdir("encoded"):