Skip to content

Instantly share code, notes, and snippets.

@syuhendar729
Created March 15, 2023 13:34
Show Gist options
  • Save syuhendar729/ce85965cb42f2c8680df4c9cbc7b150d to your computer and use it in GitHub Desktop.
Save syuhendar729/ce85965cb42f2c8680df4c9cbc7b150d to your computer and use it in GitHub Desktop.
#!/bin/bash
# folder tempat file berada
folder_path="."
# loop melalui setiap file dalam folder
for input_file in "$folder_path"/*.MOV
do
# cek apakah file merupakan file video dengan ekstensi .MOV
if [[ -f "$input_file" ]] && [[ "${input_file##*.}" == "MOV" ]]; then
output_file="${input_file%.*}_compr.MOV"
# cek apakah folder sudah ada file tersebut
if [[ -f "compr/$output_file" ]]; then
echo "File sudah ada di dalam folder."
else
# menjalankan perintah ffmpeg untuk mengonversi file
ffmpeg -i "$input_file" -vcodec libx265 -crf 28 "compr/$output_file"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment