This is a utility script for transcoding flac files into mp3 files keeping covers, tags, and directory structure. It is multithreaded and creates as much thread as the number of cores on the host.
The flac tags will be added to the mp3 files ut8 encoded, and if a cover.jpg file is found in the flac files directory it will be added to the mp3.
lame --silent -V2 --vbr-new -q0 --lowpass 19.7 --resample 44100
Because I didn't find one that included the cover and that did not break my accents on itunes. Cf http://www.barreverte.fr/ou-sont-mes-accents-dans-itunes (sorry, in french).
Second because I wanted it to be robust (for example with comments on multiple lines, shell caracters in tags like !*$
) and unit tested.
It has been tested with linux (with python version >= 3.6)
Depends on lame
(>=3.99 if you want your accents) and flac
for
the runtime.
Depends on eyeD3
for unit testing and developing.
Is a well known tool for encoding mp3 files. You can dowload and compile the code from the lame site : http://lame.sourceforge.net/
Binaries bundles can be found for mac and windows : http://rarewares.org/mp3-lame-bundle.php
Is a free and open lossless audio codec. There are links to dowload pages in the official site : http://flac.sourceforge.net/download.html
flac2mp3 [origin directories] mp3/repository/destination
- If one argument is given it is the destination : it will transcode flac files found under the current directory and put mp3 files in the destination directory with the same directory structure.
- If more than one argument is given, it will transcode flac files from the given directories to the destination.
for example, if you have :
/path/to/flac/artist1/album1/song1.flac | |song2.flac | |song3.flac | |cover.jpg | /artist2/album1/song1.flac |song2.flac |cover.jpg
- if you do in flac directory :
$ flac2mp3.py ../mp3
you'll have :
/path/to/flac/artist1/album1/song1.flac | | |song2.flac | | |song3.flac | | |cover.jpg | | | /artist2/album1/song1.flac | |song2.flac | |cover.jpg | /mp3/artist1/album1/song1.mp3 | |song2.mp3 | |song3.mp3 | /artist2/album1/song1.mp3 |song2.mp3
- if you do in flac directory :
$ flac2mp3.py artist2 ../mp3
you'll have :
/path/to/flac/artist1/album1/song1.flac | | |song2.flac | | |song3.flac | | | /artist2/album1/song1.flac | |song2.flac | /mp3/artist2/album1/song1.mp3 |song2.mp3
This is a work in progress.
To develop and test, use your favorite IDE (mine is pycharm).
With bash, to run the tests you can do :
$ virtualenv venv $ source venv/bin/activate $ python setup.py develop $ pip install -e ".[dev]" $ nosetests
To release :
$ python setup.py sdist bdist_egg upload
- [windows] weird errors when deleting temp cover images embedded in flac files on windows : "WindowsError: [Error 32] The process cannot access the file because it is being used by another process". But the transcoding is ok anyway.
- [all] the skip file function is not working after windows encoding stuffs
- [windows] the log for each track start encoding is not displayed