Mac Handbrake批量压缩MP4
date
Apr 5, 2022
slug
tip-mp4-batch-compression
status
Published
summary
小技巧
tags
tip
type
Post
URL
Problem & Summary把需要压缩的文件夹从sync_camera挪到_handbrake_2process_remove下运行HandBrakeCLI-Folder-RemoveOrigin.shScreenshots
Problem & Summary
把需要压缩的文件夹从sync_camera挪到_handbrake_2process_remove下
运行
brew install Caskroom/cask/handbrakecli
cp /Volumes/HandBrakeCLI-1.4.1/HandBrakeCLI ~/bin/
# build HandBrakeCLI-Folder-RemoveOrigin.sh
HandBrakeCLI-Folder-RemoveOrigin.sh /Volumes/Akitio24TRaid0/__Cloud/_QDrive/_qhdrive_tmp_screenshot/_handbrake/_handbrake_2process_remove
HandBrakeCLI-Folder-RemoveOrigin.sh
#!/bin/bash
DEST_EXT=mp4
HANDBRAKE_CLI=HandBrakeCLI
# replace space
find $1 -depth -name '* *' | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done
for FILE in `ls -1 $1`
do
echo "newline"
echo "FILE:"$FILE
filename=$(basename $FILE)
#echo "fullfilename:"$filename
extension=${filename##*.}
#echo "extention:"$extension
filename=${filename%.*}
#echo "filename:"$filename
$HANDBRAKE_CLI --preset "Very Fast 480p30" -i $1/$FILE -o $1/$filename.output.$DEST_EXT && rm $1/$FILE
# $HANDBRAKE_CLI --preset "Very Fast 720p30" -i $1/$FILE -o $1/$filename.output.$DEST_EXT && rm $1/$FILE
# HandBrakeCLI --preset "Very Fast 720p30" -i input.mp4 -o output.mp4
done