Add ffmpeg-batch-compress-videos.sh

This commit is contained in:
Matheus Albino
2024-08-17 03:19:57 -03:00
parent 736f9a1cb9
commit bb1d2b560c

View File

@@ -0,0 +1,18 @@
#!/bin/bash
# Create a new directory for processed files
[[ -d processed_videos ]] && rm -rf processed_videos
mkdir processed_videos
# Loop through each video file in the current directory
for file in *.mkv *.ts *.mov; do
# Check if the file is a video file
if [[ -f "$file" ]]; then
# Extract the filename without extension
# filename=$(basename -- "$file")
# filename_no_ext="${filename%.*}"
# Compress the video to 1080p MP4 using AMD h264_amf hardware acceleration
'/mnt/e/programs/ffmpeg-2024-08-15-git-1f801dfdb5-full_build/bin/ffmpeg.exe' -i "$file" -c:v hevc_amf -rc cqp -qp_i 32 -qp_p 32 "processed_videos/${file}"
fi
done