FLAC to OPUS – Convert a folder of FLAC Lossless music to OPUS compressed versions and keep them in sync.

I have a large collection of FLAC losslessly encoded music (CD and Hi-Res) on my home server, this is great when listening at home, but I want to listen on my phone offline and when traveling, I use Foobar2000 for this purpose.

I have a 256GB MicroSD card in my phone, so I looked at ways to convert the FLAC files to OPUS.  Foobar2000 has a built-in convert method, but if changes are made to the FLAC’s then work is involved to get them back in sync.

FLACtoOPUS

FLACtoOPUS

FLACtoOPUS converts a “FLAC” lossless files folder to an “OPUS” lossy files folder by converting and syncing the files even though they have a different extension.  To save space the artwork can be removed from the OPUS files and, if available, the folder.jpg is copied and converted to a max of 400×400.  The top image is one folder from my collection, the bottom is what it looks like after conversion and syncing.

FLAC Folder
FLAC Folder (C:\FLACtoOPUS\FLAC\Robot Koch\Sphere)
OPUS Folder
OPUS Synced Folder (C:\FLACtoOPUS\OPUS\Robot Koch\Sphere)

Setup

You will need to download:

FLACtoOPUS.zip (includes OpusEnc.exe) (0.97.2 BETA)

0.97.2

  • Added feature to sync using FLAC and OPUS modified dates, if the FLAC is changed then the OPUS file will be re-encoded (WARNING: be careful if you are already syncing a large collection, all OPUS files will be re-encoded on the first sync with this option on).

0.97.1

  • Changed Codec dropdown (was fixed to .opus) to File Extension, can now select .opus or .ogg (useful for old versions of Android)

0.97

  • Added ability to type bitrate or select common values from the dropdown list.
  • Added a Advanced Encoding Settings textbox (EXPERTS ONLY)

0.96

  • Add 416, 448, 480 and 512 to max out the bitrate for OPUS
  • Fixed bug when a long-running OPUS encode or Cleanup would still show encodes on other cores as in progress (ie not reset to CPUX – Idle) while waiting to finish.

0.95

  • Added checkbox to create a \OPUS_{Bitrate} subfolder, useful if you want to test different bitrates.

0.94

  • File Count is Quicker
  • Cleanup happens during sync rather than before
  • UI Responsiveness improvements
  • Settings are now saved correctly and updated on version change.

0.93

  • Added count of files after cleanup
  • New ko-fi.com donate button.

0.92

  • Added 244, 288 and 352 in bitrates.

0.91

  • Released as beta.

** If any issues are found, please report in the comments **

Inside the zip there are 2 files, the FLACtoOPUS.exe and opusenc.exe this is version 1.3 from opustools.

  1. Run the FLACtoOPUS.exe program.
  2. Select the source folder of FLAC files.
  3. Select the destination folder of where you want to put the Opus file, make sure the folder is empty, and not with the source folder.
  4. Select the bitrate required, transparency is achieved at 144 for most people so 160 is a good choice. If you have good quality folder.jpg artwork tick remove images (this stops the program embedding the artwork in the Opus files, which uses a lot more space on a large collection).
  5. Check the ‘Create Subfolder for bitrate’ if you want to maintain multiple folders with different bitrates.
  6. Select how many processor cores you want to use for conversion, if you are not working on the machine this can be set to the maximum available.
  7. Press the convert button.

Notes:

  1. Files that are not to be synced in the destination folder will be deleted, it is best to select an empty folder.
  2. Hidden folders and folders beginning with (.) ie .nomedia or .sync will not be deleted from the destination during cleanup.
  3. Folders created with the Create Subfolder for bitrate option, starting with OPUS_, are not deleted from the destination during cleanup.
  4. If you press stop, files currently being processed will be completed.
  5. If the modified date of the source FLAC file is greater than the modified date of the OPUS file then the file is deleted and re-synced.
  6. There is no warning if the destination path will be greater than the Windows 260 limit, after you do your first sync in Powershell run the following command, this will list all files > 260, I will add a check in the future to flag up this issue.

In Powershell

cmd /c dir /s /b |? {$_.length -gt 260}

Playback

Foobar2000 is a good choice for Opus playback, both on desktop and mobile, I am using Android to play the Opus files.

foobar2000
Foobar2000 on Android 9 (Pie)

Getting the OPUS files on your phone

SDCard

You could insert your SDCard into your computer and sync direct to it, this is probably the quickest way.

Resilio Sync

Resilio Sync can be used to sync the converted files folder to your phone, I am currently drafting a guide on how to set this up, this is the method I use as Resilio Sync runs in the background so it runs until finished and does not stop when phone sleeps.

The guide is delayed until a bug with the Android version is fixed, this stops any folders or file with a % (percent symbol) from being synced.  In my collection, this affects 2 albums (out of 2723) because the % is in the folder, and 2 tracks in an album as it is only in the filename.

\Ginger Wildheart\100%
\Will Young\85% Proof

\Cashier No9\To The Death Of Fun\10 – Cashier No9 – 6%.flac
\The Beautiful South\Gaze\09 – The Beautiful South – 101% Man.flac

7 thoughts on “FLAC to OPUS – Convert a folder of FLAC Lossless music to OPUS compressed versions and keep them in sync.

  1. Pingback: Happy Christmas
  2. Hi there,

    I just found you FLACtoOPUS tool and would like to say thank you for this! Exactly the tool I needed.

    PS. If I could make a tiny suggestion, it would be nice to be able to put custom command line options as an option, so I could set more specific settings like bitrates inbetween, encoding complexity and framesize etcetera. That would make it the absolute perfect tool!

    Thanks!

  3. Hello !
    It’s a wonderful piece of code you wrote here, thank you.
    I would love the possibility to change the output extensions from .opus to .ogg, that’s because Android will not import .opus files into the library for all media player depending on MediaScanner, but if you rename it to .ogg it just works.

    For now I have to rename all my files with another software aha.
    Thank you!

  4. @NavaVal Thanks for the feedback and I am glad you like the software.

    I have updated to 0.97.1, you can now select .opus or .ogg in the File Extension dropdown box, I added quickly because if you forget to change the extensions back before syncing later the software would see the .ogg files as extra files and delete them and you would have to start again. Hope this change helps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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