#!/bin/bash # Directory containing the original movies input_directory="/home/arul/Movies" # Directory to save the converted movies output_directory="/home/arul/Movie-Rendered-output" # Create the output directory if it doesn't exist mkdir -p "$output_directory" # Loop through all movie files in the input directory for input_file in "$input_directory"/*; do # Get the resolution of the input file resolution=$(ffmpeg -i "$input_file" 2>&1 | grep -oP 'Stream.*Video.* \K[0-9]+x[0-9]+') # Check if the resolution is greater than 720p (1280x720) width=$(echo $resolution | cut -d'x' -f1) height=$(echo $resolution | cut -d'x' -f2) if [[ "$width" -gt 1280 || "$height" -gt 720 ]]; then # Construct the output file path output_file="$output_directory/$(basename "$input_file")" # Convert the movie to 720p with aesthetic filters using a faster preset echo "Processing file: $(basename "$input_file")" time ffmpeg -i "$input_file" -vf "scale=1280:720,eq=contrast=1.1:brightness=0.05:saturation=1.2" \ -c:v libx264 -preset fast -crf 28 -b:v 1500k -c:a aac -b:a 96k "$output_file" fi done