Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Converting .FLAC files to high quiality .MP3 files with only one command

Featured Replies

I found this on the web and it works great in unRAID.  When you telnet into unRAID and navigate to a folder that has .FLAC files you can type encode into the terminal and the files will be converted automatically to high quality .MP3s.

 

Here is a link to the original article. http://mellowd.co.uk/blog/

 

Here are the packages necessary --

FLAC -- http://packages.slackware.it/package.php?q=current/flac-1.2.1-i486-2

LAME -- http://www.linuxpackages.net/pkg_details.php?id=11579

libao -- http://packages.slackware.it/package.php?q=current/libao-0.8.8-i486-1

libogg -- http://packages.slackware.it/package.php?q=current/libogg-1.1.3-i486-2

libvorbis -- http://packages.slackware.it/package.php?q=current/libvorbis-1.2.0-i486-1

 

Download these and put them in

/boot/custom/usr/share/packages/encode/

(or wherever you want to load them from)

 

Step 1 -- put this script on your flash drive (or wherever you want to run the script from.  I put mine at the root of the flash drive and called it encode)

# Encode
# v0.2 18.08.08 - Second draft, changed the default to lame 3.97 as this is what's in the Ubuntu repositories
# v0.1 17.08.08 - First created
# Darren O'Connor <[email protected]>

# This script, when run in a folder full of FLAC files, will create high quality VBR mp3's for use in mp3 players.
# This version uses lame 3.98 and 3.97. Please edit out the appropriate line below (Don't leave them both in!)

#!/bin/bash
mkdir wav/
flac -d *.flac
mv *.wav wav/
cd wav/
for f in *.wav; do mv "$f" "${f%.wav}";done
mkdir ../mp3/

# If you use lame 3.98 then comment IN the next line and comment out the following line
# find -maxdepth 1 -type f -name '*' -exec lame -V0 -q0 '{}' -o '../mp3/{}' \;

# If you use lame 3.97 then comment IN the next line and comment OUT the previous line
find -maxdepth 1 -type f -name '*' -exec lame --vbr-new -V0 -q0 '{}' -o '../mp3/{}' \;

cd ../mp3/
for FILE in *; do mv "$FILE" "$FILE.mp3"; done
cd ../
rm -r wav/

 

Step 2 -- You'll need to make this file executable if it is not already

chmod +x encode

 

Step 3 -- Put this script on your flash drive.  I put mine at root (same as the encode from earlier).  Call it install_encode.  You may have to make this file executable also.

#!/bin/bash
installpkg /boot/custom/usr/share/packages/encode/libao-0.8.8-i486-1.tgz
installpkg /boot/custom/usr/share/packages/encode/libogg-1.1.3-i486-2.tgz
installpkg /boot/custom/usr/share/packages/encode/libvorbis-1.2.0-i486-1.tgz
installpkg /boot/custom/usr/share/packages/encode/flac-1.2.1-i486-2.tgz
installpkg /boot/custom/usr/share/packages/encode/lame-3.97-i486-1kjz.tgz
cp /boot/encode /bin/encode

 

Step 4 -- Put this line in your GO script

echo "alias inst_encode='/boot/install_encode' " >> /etc/profile

This will setup an alias to make it easier to install the packages necessary for encode only when you need them, not at every boot.

 

That's it.  If I haven't forgotten anything, you should be able open a terminal and type the command

inst_encode

and unRAID will install the packages necessary.  You only have to do this one time until you reboot unRAID.  Now navigate to a folder with .FLAC files and type

encode

.  When the process is done you will have a new folder in the directory called MP3. 

 

Enjoy.

 

Wouldn't  this cause problems for the program you use for your music. I would think it will see both versions of the song, the mp3 version and the flac version. I use J.River Media Center. When I sync with my portable device (I-pod) I have it set to automatically convert unsupported file types to a supported type (you choose the type and the bitrate). With this method I only have one version of my music on my server.

 

Gary T.

  • Author

I don't use it in this way.  I have a folder for Media Player which is flac based.  I have another for iTunes which is MP3 based.  And I have a folder used to store downloaded or ripped music.  It is that storage folder that uses encode.  When I rip one of my cds to flac for my home media player, then I can run encode to put it in a the iTunes directory ready for my iPod as an MP3. I point my home media player to the flac folder and iTunes to the MP3 forlder.  Like you, I used to convert flac to mp3s on the fly (using MediaMonkey) but I hated waiting hours to convert the flacs into high bitrate MP3s that my iPod could consume.  Flac sounds so much better at home and in my car than even the best MP3s (in my opinion, and on my systems).  Sorry this wasn't helpful to you, but this has saved me a lot of effort and doesn't tie up a workstation during the encoding process (as with J.River).  I think your process works well if you don't require high bit rate MP3s.  I like to listen to the highest bitrate MP3s for the best sound quality.  This takes too long to encode on the fly.  Because of the nature of unRAID as a highly expandable storage appliance I don't really mind having the added overhead of duplicate music structures that are used for different purposes.  By the way -- my music collection is just under 40k songs for each structure.  It all fits neatly on a single 1TB drive with plenty of room for expansion.  Thanks again for trying to help and offering me your suggested process for managing music files.

@bluto, how to you populate the TAGS in the MP3 files?

I use a program called "foobar2000" that does an excellent job of format conversion while maintaining tags.  It is also an audio player, but I don't use it for that.

 

A couple years ago I ripped all of my audio CDs into a format called "wavpack" (lossless audio format similar to FLAC).  I then tagged all my files and converted them to .MP3s using "foobar2000".  All of the tags carried over.  It supports .FLAC and most other formats as well.  It is also user extensible.

 

Highly recommended product.  Works in Windows, not sure if there is a Linux version or not.  It is a GUI tool, but you can queue up a ton of files and it will convert them in a batch-like mode.

 

I've been considering moving my wavpack (.WV) files to .FLAC (even though I think wavpack produces smaller files, it seems to be less well supported than .FLAC).  With foobar, I could do this pretty painlessly.

  • Author

@WeeboTech,

 

You are right -- this process does not account for moving the tags over as well. 

 

Here is the script you are looking for -- http://lglinux.blogspot.com/2007/09/convert-flac-to-mp3.html.

 

It will essentially do the same exact thing as the previous encode solution except that it will also copy over any tag information from the FLAC to the new MP3.

 

You need a couple of more packages to get the tags to come over:

  • id3v2-0.1.11-i486-1ng.tgz
  • cxxlibs-6.0.9-i486-1.tgz
  • zlib-1.2.3-i486-2.tgz
  • gcc-4.2.4-i486-1.tgz
  • id3lib-3.8.3-i486-2sl.tgz
  • gcc-g++-4.2.4-i486-1.tgz

 

I've tested this and it works -- fast, easy, and the tags come through also.

 

Enjoy.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.