gstreamer-pipelines/ffmpeg-psnr-check.sh
2025-09-18 21:45:25 +03:00

24 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
if ! command -v ffmpeg &> /dev/null
then
echo "ffmpeg could not be found, please install it."
exit 1
fi
name=nvv4l2h264enc
specific=eleph-pr-baseline-preset1-cbr-hqp-10
#
#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 yuv420p -color_range tv -framerate 60 -i base-${name}-${specific}.yuv -i encoded-${name}-${specific}.mp4 -filter_complex "psnr" -f null /dev/null
# example working:
# ffmpeg -f rawvideo -video_size 1920x1080 -pixel_format yuv420p -color_range tv -framerate 60 -i base-${name}-${specific}.yuv -i encoded-${name}-${specific}.mp4 -filter_complex "psnr" -f null /dev/null
# ffmpeg -f rawvideo -video_size 1920x1080 -pixel_format nv12 -color_range tv -framerate 60 -i base-${name}-${specific}.yuv -i encoded-${name}-${specific}.mp4 -filter_complex "psnr" -f null /dev/null
# ffmpeg -f rawvideo -video_size 1920x1080 -pixel_format yuv420p -color_range pc -framerate 60 -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 yuv420p -color_range tv -framerate 60 -i base-${name}-${specific}.yuv -i encoded-${name}-${specific}.mp4 -filter_complex "[0:v]fps=60[v0];[1:v]fps=60[v1];[v0][v1]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