Compare commits
2 Commits
bd241c3b6f
...
e5b2043298
Author | SHA1 | Date | |
---|---|---|---|
e5b2043298 | |||
d3753ac831 |
@ -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]:
|
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:
|
Parameters:
|
||||||
outputfile (str): Path to output file
|
outputfile (str): Path to output file
|
||||||
@ -179,6 +179,48 @@ def score_vmaf(outputfile: str, inputfile: str) -> dict[str, float]:
|
|||||||
return vmaf
|
return vmaf
|
||||||
|
|
||||||
|
|
||||||
|
def score_psnr(outputfile: str, inputfile: str):
|
||||||
|
"""
|
||||||
|
Calculate a file's MSE (mean-square error) using PSNR. A lower value is better
|
||||||
|
|
||||||
|
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 psnr=stats_file=psnr.log -f null"},
|
||||||
|
)
|
||||||
|
|
||||||
|
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 __name__ == "__main__":
|
||||||
if not os.path.isdir("encoded"):
|
if not os.path.isdir("encoded"):
|
||||||
os.mkdir("encoded")
|
os.mkdir("encoded")
|
||||||
|
Loading…
Reference in New Issue
Block a user