Converting your m4a music files to mp3
Have you found yourself in posession of music or audio files that were in m4a format and wanted them as mp3’s?
Well good thing it quite easy to convert them.
Here is a quick script I have made to do just that:
#!/bin/sh
# converting multiple m4a files to mp3 and removing the created wav’s.
for i in *.m4a; do faad “$i”; done
for i in *.wav; do lame “$i” “$i.mp3″ && rm “$i”; done
rename .wav.mp3 .mp3 *.mp3
I like doing it in a few different steps, so I can check the .wav’s for quality, compression and corruption before converting them to mp3’s, that is why the processes are split up.
Here is what each line is doing:
for i in *.m4a; do faad “$i”; done
Is taking each m4a file, running faad on it, which is outputting it to a wav file (the file name will actually be .m4a.wav) which is fine since we’ll be doing another round of conversions anyway. This one is keeping the original m4a files ( I do that just in case the conversion to mp3’s have lots of quality loss, or corruption). If you want to remove them while it converts them you can use this line instead:
for i in *.m4a; do faad “$i” && rm “$i”; done
On to the next command:
for i in *.wav; do lame “$i” “$i.mp3″ && rm “$i”; done
Now we are grabbing each .wav file converting them from .wav to .mp3 using lame and removing the original .wav files (I don’t care about these, since I can easily recreate again using the first command). You will notice these are named with .wav.mp3 (this was just the simplest way to keep the script clean for people to understand), so we can fix that easily with the rename command.
Lastly we just want to clean up the naming of these files, so we run:
rename .wav.mp3 .mp3 *.mp3
Which is renaming all mp3’s that have the portion .wav.mp3 to only .mp3.
I hope at least one person finds this helpful.
6 Comments to Converting your m4a music files to mp3
That person being me? ![]()
This es really helpful stuff, thanks!
June 30, 2008
Well thats 2 persons! So you just doubled the outcome of your expectation. Not bad
Thanks!
DJ
June 30, 2008
Thanks.
[...] good thing it quite easy to convert them.Here is a quick script I have made to do just that:http://www.benkevan.com/blog/converting-your-m4a-music-files-to-mp3/free convert m4a to mp3Convert m4a to mp3 software . convert audio cd to mp3 . Burn mp3 to CD. To [...]
May be helpful. But people like me will feel complicated. Why not use a software to convert m4a to mp3. It’s more simple.
October 15, 2008
faad and lame are pieces of software that I am utilizing to do the conversion.
The script is only used to do a full directory and changing the names etc.
Pretty simple IMO, and it ships with most linux distributions.
Leave a comment
Search
Powered by
Tags
10.3 11.0 11.1 apache bash beta bootchart codeweavers compiz drivers emerald emulation esx fat ass tomato man filesystems flash fonts gnome grub ibm kde kde4 kernel knoppix linux lotus notes lvm Microsoft nomad nvidia openoffice opensuse performance repositories review scripting security tech tutorial ubuntu user management VMWare windows wine workstationArchives
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- February 2008
- January 2008
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
Ben Kevan's Blog
- Connecting to Linux via RDP using NOMAD on openSUSE 11.1
- Red Hat (RHT) Profits Soar, is Novell (NOVL) Next?
- Dropping KDE 3.5 for openSUSE 11.2 isn’t really a bad thing
- 5 Days on openSUSE 11.1 was an early X-Mas present
- Unexpected Downtime
- Amarok 2.0 Final Released - Shipping with openSUSE 11.1
- PCLinuxOS 2009 Beta 2 - Review, Thoughts and Screenshots
- Opera 10.0 Alpha 1 on openSUSE 11.1 - Review
- Ding Dong the Emeralds Back Compiz
- 11.1 Build Service Repositories being Built
June 30, 2008