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.

4 comments:

  1. 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.

    ReplyDelete
  2. 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

    ReplyDelete
  3. Any music file? even wikiext.com/bnk? I need this... but no its not working with .bnk

    ReplyDelete
  4. 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

    ReplyDelete