Schlagwort-Archiv: ffmpeg

How to: Convert aac/mp3 to mp4/m4a audio format on Linux

Now that I recorded a bunch of .aac files I have to make them compatible to the audio codecs installed on my car radio – which is mp3/wma and aac, whereas the latter does somehow not mean files which are called ‚.aac‘ but ‚.m4a’! I have no choice – I didn’t invent it 😛

Anyway, a first halfway working approach to do this is to convert the input files to ‚.wav‘ files, store them in the RAM for fast enough performance, and convert them to the target format using NeroAacEnc (also available in the AUR) – it’s said by community members that this is the best codec available..for free!
Oh, ffmpeg is required as well, not to forget to mention this one :)

#!/bin/sh
# Specify input format - can be everything that ffmpeg supports!
fmt="mp3"
tmp="/tmp/tempWav.wav"
rm ${tmp}

for a in *$fmt; do
# decode to .wav and encode to .m4a
   ffmpeg -i "$a" ${tmp} && neroAacEnc -q 0.5 -if "${tmp}" -of "`basename \"$a\" .${fmt}`.m4a"
# remove temp file
   rm ${tmp}
# remove original file
   rm "$a"
done

Perhaps this should be done on multiple cores the next time. Gotta see how it’s done.