Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Created July 9, 2011 02:08
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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"
@MaxGabriel
Copy link

Thanks just used this

@winiehappy
Copy link

I use iDealshare VideoGo to convert CAF to AIFF, MP3, Apple Lossless, AAC on Mac.

It has both Mac and Windows version.

Step by Step Guide to Convert CAF to MP3, AIFF at http://www.idealshare.net/caf-to-mp3-converter.html

@comeonjanuary
Copy link

You may also refer to this detailed guide to convert caf to mp3, wav, aiff, aac, apple lossless m4a and etc at http://www.allavsoft.com/how-to/convert-caf-to-mp3-wav-m4a-aiff-aac.html

@MonicaKK
Copy link

MonicaKK commented Nov 9, 2016

@fradycon
Copy link

Or just try a third-party software to convert CAF to WAV, MP3, AIFF, ALAC and more. In this case, you may prefer to this guide: http://www.faasoft.com/articles/caf-to-wav-converter.html

@tonyarabish
Copy link

Avdshare Audio Converter is highly recommended to convert caf files to any other audio format like mp3, aac, m4a, wav, wma, flac, aiff etc
Here is the step by step guide: https://www.avdshare.com/caf-to-mp3-converter

@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