Files
custom_scripts/ffbitrate
2025-11-17 00:41:24 +01:00

20 lines
407 B
Bash
Executable File

#!/bin/bash
# Check if the user provided a file as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <video_file>"
exit 1
fi
# Get the video file path from the argument
VIDEO_FILE="$1"
# Use ffmpeg to extract the bitrate
BITRATE=$(ffmpeg -i "$VIDEO_FILE" 2>&1 | grep -oP 'bitrate:\s+\K[\d.]+')
if [ -n "$BITRATE" ]; then
echo "Bitrate: ${BITRATE} kb/s"
else
echo "Unable to retrieve bitrate."
fi