Created
October 19, 2016 10:08
-
-
Save jay16/b13d54192c5322c9b981dcd997d8bd0d to your computer and use it in GitHub Desktop.
convert wav to mp3 file with ffmep on mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## | |
############################################################################## | |
## | |
## Script convert wav to mp3 for UN*X | |
## | |
## Dependence: | |
## - [ffmpeg](https://ffmpeg.org/) | |
## | |
## Script File: | |
## wav2mp3.sh | |
## | |
## Usage: | |
## $ uname -v | |
## Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 | |
## $ mv ~/download/*.WAV ./ | |
## $ chmod +x .wav2mp3.sh | |
## $ ./wav2mp3.sh | |
## $ du -sh * | |
## 33M 2016-10-14-10-10-05.WAV | |
## 11M 2016-10-14-10-10-05.mp3 | |
## 4.0K wav2mp3.sh | |
## | |
############################################################################## | |
for wav in $(find . -name '*.WAV' | sort -r) | |
do | |
mp3=${wav%.*}.mp3 | |
if [[ -f "${mp3}" ]]; | |
then | |
echo "already converted: ${mp3}" | |
else | |
echo "converting: ${wav}" | |
ffmpeg -i "${wav}" "${mp3}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment