From bb1d2b560c2d8fd76a80dafc6b7c270360ea7fab Mon Sep 17 00:00:00 2001 From: Matheus Albino Date: Sat, 17 Aug 2024 03:19:57 -0300 Subject: [PATCH] Add ffmpeg-batch-compress-videos.sh --- scripts/shell/ffmpeg-batch-compress-videos.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 scripts/shell/ffmpeg-batch-compress-videos.sh diff --git a/scripts/shell/ffmpeg-batch-compress-videos.sh b/scripts/shell/ffmpeg-batch-compress-videos.sh new file mode 100755 index 0000000..5cbd457 --- /dev/null +++ b/scripts/shell/ffmpeg-batch-compress-videos.sh @@ -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