Main /
M4aToMp3
Using FFMPEG to convert M4a to Mp3 from a gist at https://gist.github.com/christofluethi/646ae60d797a46a706a5
given a directory of directories of m4a files, convert and pack to mp3
buggy, leaves the output file as ".mp3" in the subdirectory, not as a properly named thing in the root.
for DIR in */; do cd "$DIR" for SRC in *.m4a; do BASE=${SRC%'.m4a'} DEST=$( printf "%s.mp3" "$BASE") ffmpeg -y -i "$SRC" -codec:a libmp3lame -q:a 0 "$DEST" >/tmp/ffmpeg.log done printf "file '%s'\n" *.mp3 > mylist.txt ffmpeg -f concat -safe 0 -i mylist.txt -c copy "../$DIR.mp3" cd .. done
brew update brew link yasm brew link x264 brew link lame brew link xvid brew install ffmpeg ffmpeg wiki: https://trac.ffmpeg.org/wiki/Encode/MP3 lame option Average kbit/s Bitrate range kbit/s ffmpeg option -b 320 320 320 CBR (non VBR) example -b:a 320k (NB this is 32KB/s, or its max) -V 0 245 220-260 -q:a 0 (NB this is VBR from 22 to 26 KB/s) -V 1 225 190-250 -q:a 1 -V 2 190 170-210 -q:a 2 -V 3 175 150-195 -q:a 3 -V 4 165 140-185 -q:a 4 -V 5 130 120-150 -q:a 5 -V 6 115 100-130 -q:a 6 -V 7 100 80-120 -q:a 7 -V 8 85 70-105 -q:a 8 -V 9 65 45-85 -q:a 9 ffmpeg -i in.m4a -codec:a libmp3lame -qscale:a 1 out.mp3