Saturday, August 31, 2013

One-liner to convert any music file to mp3

On Debian 7 ffmpeg is not installed any more as it comes with its successor avconv.
Therefore it is enough to write a small bash for loop which takes any *.wma file of the folder and starts the conversion. The output file will then have the file extension replaced to mp3. Done!
The result looks like this:
for f in *.wma; do avconv -i "$f" -ab 192k "${f%.wma}.mp3"; done
However, you can replace the two occurrences of *.wma with any other music file format you want to convert from (eg: *.flac, *.aac, *.wav,...). Keep in mind that you need to have the right gstreamer plugin installed to encode and decode the desired formats.


  1. This sample plug-in allows you to play back a game player's MP3 files at runtime. You can use this source plug-in if you want to give the game player the option to replace the game music with their own MP3 files. When using this plug-in, a game player's MP3 files can be sent through the Wwise pipeline at runtime and processed by the sound engine. This means you can take full advantage of all the features and effect processing in iomoio.

  2. free music to download Thanks for your post. I've been thinking about writing a very comparable post over the last couple of weeks, I'*probably keep it short and sweet and link to this instead if thats cool. Thanks.

  3. I have read your excellent post. This is a great job. I have enjoyed reading your post first time. I want to say thanks for this post. Thank you...
    youtube to mp3

  4. Any music file? even I need this... but no its not working with .bnk

  5. Thank you for such a well written article. It’s full of insightful information and entertaining descriptions. Your point of view is the best among many.
    try this youtube to mp3 converter