Converting Audio to MP3 with GStreamer

My last post was about converting audio files in Linux with GStreamer. In that post I showed how to convert FLAC files to Ogg Vorbis files and retain the audio tags. You may however, have an audio player that does not support playing Ogg Vorbis audio files and you want to convert your files to MP3 instead.

The following commands will work as long as you have the appropriate GStreamer plugins installed along with the LAME package.

This command will encode to MP3 using LAME’s defaults.

[term]gst-launch filesrc location=file.flac ! flacdec ! audioconvert ! lamemp3enc ! id3v2mux ! filesink location=file.mp3[/term]

If you want to encode your files with VBR at a higher quality level, you can do something like this.

[term]gst-launch filesrc location=file.flac ! flacdec ! audioconvert ! lamemp3enc target=quality quality=2 ! id3v2mux ! filesink location=file.mp3[/term]

One thought on “Converting Audio to MP3 with GStreamer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.