Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Created July 9, 2011 02:08
Show Gist options
  • Save adilsoncarvalho/1073217 to your computer and use it in GitHub Desktop.
Save adilsoncarvalho/1073217 to your computer and use it in GitHub Desktop.
Script to convert CAF files to MP3
#!/bin/sh
#
# a script to convert every CAF sound file in the current
# directory to a corresponding AIF sound file.
#
# author: alvin alexander, devdaily.com
#
# This work is licensed under the Creative Commons Attribution-Share Alike 3.0
# United States License: http://creativecommons.org/licenses/by-sa/3.0/us/
#
# I've modified this script originally written in:
# http://www.devdaily.com/mac-os-x/convert-caf-sound-file-aif-aiff-mp3-format
IFS=$'\n'
# list all CAF files in the current directory.
# (the -1 character in this line is a "one", not an "el")
for INFILE in $(ls -1 *.caf)
do
# get the base filename by stripping off the ".caf" part
baseFilename=`basename "${INFILE}" .caf`
# determine the preliminary output filename
outfile="${baseFilename}.mp3"
# convert all spaces to hyphens
outfile=`echo $outfile | tr -s " " "-"`
echo "Converting \"$INFILE\" to \"$outfile\" ..."
# now convert the CAF file to an AIF file
afconvert -f mp4f -d aac "$INFILE" "$outfile"
done
#!/bin/sh
# now convert the CAF file to an MP3 file
afconvert -f mp4f -d aac "$0" "$1"
@idealitystarts
Copy link

iDealshare VideoGo also works great to convert caf to aiff, mp3, wav, wma, aac, m4a etc with this step by step guide: https://www.idealshare.net/caf-to-mp3-converter.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment