Skip to content

Instantly share code, notes, and snippets.

@keiya
Created January 31, 2015 19:29
Show Gist options
  • Select an option

  • Save keiya/d2598c25d1dc7bec425b to your computer and use it in GitHub Desktop.

Select an option

Save keiya/d2598c25d1dc7bec425b to your computer and use it in GitHub Desktop.
multiple wav/aiff audio file to ogg/flac/he-aac v2 converter.
#!/bin/bash
# usage:
# bash audio_convert.bash ORIGINAL_FILEs_PATH DESTINATION_PATH
find $1 -type f -iname '*.wav' -print0 | while IFS= read -r -d '' fullfile; do
#printf '%s\n' "$fullfile"
file=$(basename "${fullfile}")
## OGG, lossy, recommended for most uses
oggenc -q4 "${fullfile}" -o "${2}${file}.ogg"
## FLAC, lossless
# flac -8 "${fullfile}" -o "${2}${file}.flac"
## HE-AAC v2 (AAC LC+SBR+PS / MP4) 32kbps, recommend for voice
# afconvert -v -f m4af -d aacp -b 32000 "${fullfile}" -o "${2}${file}.m4a"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment