From 9f204a4b97fa76c129ce093d3472ce1cb72b1aac Mon Sep 17 00:00:00 2001 From: JaeYoo-Im Date: Sat, 28 May 2022 21:25:04 +0900 Subject: [PATCH] Script : encoding script automation --- .doom.d/config.el | 2 ++ scripts/encoding_500kbps.sh | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.doom.d/config.el b/.doom.d/config.el index 40dd4f7..12f8acb 100644 --- a/.doom.d/config.el +++ b/.doom.d/config.el @@ -419,6 +419,8 @@ capture was not aborted." "foc" '(lambda () (interactive) (find-file (expand-file-name "~/.doom.d/config.el"))) :desc "doom package.el" "fop" '(lambda () (interactive) (find-file (expand-file-name "~/.doom.d/packages.el"))) + :desc "doom init.el" + "foi" '(lambda () (interactive) (find-file (expand-file-name "~/.doom.d/init.el"))) ;; Eshell :desc "eshell" "e" '(:ignore t) diff --git a/scripts/encoding_500kbps.sh b/scripts/encoding_500kbps.sh index f22ba88..16e6a01 100755 --- a/scripts/encoding_500kbps.sh +++ b/scripts/encoding_500kbps.sh @@ -1,12 +1,10 @@ #!/bin/bash #Input Directory -input_dir=/mnt/wsl/PHYSICALDRIVE1/input/WAAA +input_dir=$1 #~/mnt/EAST/Aimi\ Rei output_dir=~/Downloads/input # get bitrate -mediainfo --Output="General;File Name: %FileName%\r\n -Video;BitRate: %BitRate/String%\r\nDimensions : %Width%x%Height%\r\n\n" *.mp4 walk_dir () { @@ -17,9 +15,17 @@ walk_dir () { walk_dir "$pathname" else #printf '%s\n' "$pathname" - base_name=$(basename ${pathname}) # only filename + base_name=$(basename "${pathname}") # only filename + if [[ "$base_name" == *mp4 ]]; then + brate=$(mediainfo --Output="Video;%BitRate%" "$pathname") + brate_int=$((brate)) + printf "$base_name 's bit rate is $brate_int\n" + if [ $brate_int -gt 550000 ]; then + HandBrakeCLI -i "$pathname" -o $output_dir/$base_name -Z "General/Very Fast 480p30" --no-two-pass -b 500 + fi + fi #printf '%s, %s\n' "$base_name" "$output_dir/$base_name" - HandBrakeCLI -i $pathname -o $output_dir/$base_name -Z "General/Very Fast 480p30" --no-two-pass -b 500 + #HandBrakeCLI -i $pathname -o $output_dir/$base_name -Z "General/Very Fast 480p30" --no-two-pass -b 500 fi done }