HOWTO Convert audio files
A huge variety of file formats have been and are used to store and distribute digital audio files. Sometimes you need to convert between these. In most cases you shouldn't. Here's how you can do it if you need to.
First, a word of warning (or opinion)[edit | edit source]
The audio file formats WAV and FLAC has lossless which means they are an identical copy of the original audio source. A FLAC version of a CD will be identical to the orignal CD. Most other audio formats such as MP3, M4A and WMV are lossy formats which means parts of the original file are thrown out. Converting a MP3 audio file to Opus will further degrade audio quality. Avoid converting one lossy format to another unless you need to because you would like to play music in WMV format on a device which only supports MP3 files. Converting lossless audio files like FLAC to Opus in order to save space so you can store more audio on a portable device like a phone is fine.
Converting audio using a graphical program like VLC[edit | edit source]
Media in VLCs menu then
Convert / Save. Click
+ Add to add the audio file or files you'd like to convert.
Next, click the
Convert / Save button at the bottom of the dialog. There you will be asked to select a
Profile for your output file(s). The default audio profiles to choose from are just Vorbis, MP3, Flac and CD. The trick to using other more modern audio formats in this dialog is to press the "Create a new profile" on the right side of the Profile-selector. This brings up "Profile edition".
You could choose "Ogg/Ogm" under "Encapsulation" and click "Audio codec" and choose "Opus" and a Bitrate of 192kb/s to use the currently best lossy audio format. Name the profile something sensible such as
Audio - Opus. Click
Create to save it. You can now use that profile in the
Convert dialog. Next, choose a
Destination file to save to if you only selected one input file.
All that's left is to click
Start to get a new converted file.
VLC supports converting multiple files. Simply click
Add in the
Open Media dialog and select as many files as you would like. You will not be able to choose output filenames or destination when doing this; the files you convert will be saved in the same folder as the original using a different extension.
Converting audio files using the command-line using ffmpeg[edit | edit source]
The go-to tool for converting anything, audio, or video, using CLI in a terminal on Linux is ffmpeg. The most basic use-case of converting a file from one format to another is as simple as:
ffmpeg -i inputfile.wav -vn outputfile.m4a
Do note the
-vn switch. It tells ffmpeg to not invoke any video-related code. You will in some cases get a video track showing a cover image added to the output file without the
The audio format is chosen intelligently based on the container indicated by the file extension. You can use the option
-codec:a to specify audio coder. You can use
-c: as as short-hand for
-codec:. You can use
-b:a to specify a bitrate. To convert file to Opus you could use this example:
ffmpeg -i inputfile.flac -vn -c:a libopus -b 192k outputfile.ogg
Run the command
ffmpeg -encoders to see all the formats ffmpeg can convert to. The amount of audio formats you can conver to using ffmpeg is staggering.
Batch converting a folder full of audio files[edit | edit source]
The simplest solution is to just create a little script file like one of the following examples.
Questions?[edit | edit source]