Create a gist now

Instantly share code, notes, and snippets.

@zrong /shrink.sh
Last active Feb 14, 2017

What would you like to do?
shrink.sh
#!/bin/bash
##############################
# shrink the mp3 files
# @author rzeng
# @date 2017-02-12
# @requirements lame
##############################
if ! [ "$(which lame)" ];then
echo "Install lame first!"
exit 127
fi
input_file=$1
output_dir=$2
if ! [ -f "$input_file" ];then
echo "No input file!"
exit 127
fi
if ! [ -d "$output_dir" ];then
echo "No output dir!"
exit 127
fi
new_file=$output_dir/$input_file
new_dir=$(dirname $new_file)
mkdir -p $new_dir
lame -m j -V 0 -q 0 -b 45 -B 80 $input_file $new_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment