WIP Add psnr function
This commit is contained in:
parent
bd241c3b6f
commit
d3753ac831
@ -179,6 +179,25 @@ 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()
|
||||||
|
|
||||||
|
|
||||||
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