Upload files to "/"
mov_compress.sh -> does max video compression and reduces size of video to greater extent while using 100% of cpu. mov_size.sh -> does moderate video compression and reduces size of video to medium and satisfactory extent , cpu usage is less.
This commit is contained in:
commit
73cacf0f1a
31
mov_compress.sh
Normal file
31
mov_compress.sh
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/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
|
||||
|
29
mov_size.sh
Normal file
29
mov_size.sh
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/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
|
||||
ffmpeg -i "$input_file" -vf "scale=1280:720,eq=contrast=1.1:brightness=0.05:saturation=1.2" -c:v libx264 -preset slow -crf 22 -c:a aac -b:a 128k "$output_file"
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user