MediaConversionTools/tscheck.sh

35 lines
944 B
Bash

#!/bin/bash
# Check if ffprobe is installed
if ! command -v ffprobe >/dev/null 2>&1; then
echo "ffprobe is not installed. Please install it to run this script."
exit 1
fi
# Check if a filename is provided as an argument
if [ $# -ne 1 ]; then
echo "Usage: $0 <filename>"
exit 1
fi
filename=$1
# Use ffprobe to get the video stream information
video_info=$(ffprobe -v quiet -show_streams -select_streams v "$filename")
# Check if the video_info variable is empty
if [ -z "$video_info" ]; then
echo "No video stream found in the input file."
exit 1
fi
# Search for the video resolution in the video stream information
resolution=$(echo "$video_info" | grep -oP "(?<=^width=)\d+" | head -1)
# Check if the resolution is greater than or equal to 1280x720
if [ "$resolution" -ge 1280 ] && [ "$resolution" -ge 720 ]; then
echo "The file contains HD content."
else
echo "The file does not contain HD content."
fi