When you need to convert images between formats, it's as easy as
convert input.png output.jpg
Thanks to ImageMagick. Unfortunately, it is much more difficult to do the same with audio.
flac -c -d input.flac | lame -V 0 - output.mp3
Will do the same thing for audio (where png is now flac, and jpeg is now mp3). This will not take care of metadata (artist, title, album, et cetera), and uses different switches for each codec, which you would have to look up each time, or try to memorize. It's evident that this is not a usable solution.
Transcode is a simple cli application written in python designed to easily transcode between audio codecs. The above example becomes as simple as
transcode input.flac -V 0 output.mp3
That's it, you even keep your metadata!
transcode <input file> [options] <output file>
The output format is determined by its extension. Options
affect how the file
is encoded, for example, with mp3 you can add -V 0
to encode with the highest
VBR settings.
If output file is only an extension (ie. .mp3
) it will be given the same file
name as the input, with the new extension. For example, transcode something.wv -V 0 .mp3
will make a V2 mp3 named something.mp3
.
Installation is taken care of by distutils
, to install just run python setup.py install
, and everything will just work.
- Flac
- Lame (mp3)
- WavPack
- Vorbis Tools
- Speex
- flac
- mp3
- wavpack
- Ogg Vorbis
- Speex
- flac
- mp3
- wave (No metadata support)
- wavpack
- Ogg Vorbis
- Speex (No metadata support)
Unless otherwise noted, command line options are sent directly to the encoder, so any options for that encoder should work.
Here is a quick reference of commonly used options for each supported encoder.
-0 through -8
Compression level. -0
sets no compression, -8
sets highest compression.
-V (0 through 9)
Use VBR compression. -V 0
is the highest quality, -V 9
is the lowest.
-b n
Use CBR encoding. n
is the bitrate in kb/s to use, and can be 32, 40, 48,
56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320
-bn
Use lossy compression. n
is the bitrate to target. If this can be achieved
with lossless compression, it will encode losslessly.
-c
Create a correction file if lossy. The lossy .wv
file can be used on its own,
but will be lossless if accompanied by the .wvc
file this switch creates.
-q (-1 through 10)
Set the encoder quality. -1
is lowest, 10
is highest, 3
is default.
Fractional values can also be given.
-n, -w, -u
Narrowband (8kHz), wideband (16kHz) and ultra wideband (32kHz) respectively.
--quality (0 through 10)
Set the encoding quality. 0
is lowest, 10
is highest, 3
is default.