gstreamer-pipelines/ffmpeg-psnr-check.sh
Artur Mukhamadiev 1211611cac more-examples
2025-09-11 16:21:50 +03:00

23 lines
1.1 KiB
Bash

#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <input_video> <reference_video>"
exit 1
fi
if ! command -v ffmpeg &> /dev/null
then
echo "ffmpeg could not be found, please install it."
exit 1
fi
#this script checks the PSNR between two video streams using ffmpeg
# one video stream is the reference and the other is the test stream both are recorded files
ffmpeg -f rawvideo -video_size 1920x1080 -pixel_format yuv444p -color_range pc -framerate 30 -i "$1" -i "$2" -filter_complex "psnr" -f null /dev/null
# example working:
# ffmpeg -f rawvideo -video_size 1920x1080 -pixel_format yuv444p -color_range pc -framerate 30 -i base.yuv -i test.mp4 -filter_complex "psnr" -f null /dev/null
#this script checks the SSIM between two video streams using ffmpeg
ffmpeg -f rawvideo -video_size 1920x1080 -pixel_format yuv444p -color_range pc -framerate 30 -i "$1" -i "$2" -filter_complex "[0:v][1:v]ssim=stats_file=ssim_results.txt" -f null /dev/null
# ffmpeg -f rawvideo -video_size 1920x1080 -pixel_format yuv422p -color_range pc -framerate 30 -i base.yuv -i test.mp4 -filter_complex "[0:v][1:v]ssim=stats_file=ssim_results.txt" -f null /dev/null