TransFLAC: Convert FLAC to lossy formats

FLAC: The Lossless Audio Compression Format

FLAC, or Free Lossless Audio Codec, is a lossless audio compression format that preserves all the original audio data. This means that FLAC files can be decoded to an identical copy of the original audio file, without any loss in quality. However, lossless compression typically results in larger file sizes than lossy compression, which is why a method to convert FLAC to lossy formats is desirable. This is where TransFLAC can help.

FLAC is a popular format for archiving digital audio files, as well as for storing music collections on home computers. It is also becoming increasingly common for music streaming services to offer FLAC as an option for high-quality audio.

For portable devices, where storage space is limited, lossy audio formats such as MP3, AAC, and OGG Vorbis are often used. These formats can achieve much smaller file sizes than lossless formats, while still providing good sound quality.

In general, FLAC is a good choice for applications where lossless audio quality is important, such as archiving, mastering, and critical listening. Lossy formats are a good choice for applications where file size is more important, such as storing music on portable devices or streaming music over the internet.

TransFLAC: Convert FLAC to lossy formats

TransFLAC is a command-line application that converts FLAC audio files to a lossy format at a specified quality level. It can keep both the FLAC and lossy libraries synchronized, either partially or fully. TransFLAC also synchronizes album art stored in the directory structure, such as cover, albumart, and folder files. You can run TransFLAC interactively in a terminal window, or you can schedule it to run automatically using applications such as cron or systemd.

The following four parameters must be specified:

  1. Input FLAC Directory: The directory to recursively search for FLAC audio files. The case of the directory name matters. TransFLAC will convert all FLAC audio files in the directory tree to the specified lossy codec format. The program will resolve any symlinks encountered and display the physical path.
  2. Output Lossy Directory: The directory to store the lossy audio files. The case of the directory name matters. The program will resolve any symlinks encountered and display the physical path.
  3. Lossy Codec: The codec used to convert the FLAC audio files. The case of the codec name does not matter. OPUS generally provides the best sound quality for a given file size or bitrate, and is the recommended codec.
    Valid values are: OPUS | OGG | AAC | MP3
  4. Codec Quality: The quality preset used to encode the lossy audio files. The case of the quality name does not matter. OPUS STANDARD quality provides full bandwidth, stereo music, good audio quality approaching transparency, and is the recommended setting.
    Valid values are: LOW | MEDIUM | STANDARD | HIGH | PREMIUM

TransFLAC allows for customization of certain items in the configuration.  The project wiki provides additional information.

Installation on Fedora Linux:

$ sudo dnf install transflac
TransFLAC Convert FLAC to lossy formats
FAQs and Guides


  1. If the animated SVG at the end doesn’t autoplay, try refreshing the page by pressing the F5 key. (Sorry, it’s the first time we’ve tried to use an animated SVG in an article.)

  2. Chris Moller

    sox does flac conversion out of the box.

    • AFAIK: SOX cannot convert FLAC files to OPUS or AAC formats. TransFLAC, on the other hand, can recursively scan a directory and convert all FLAC files found, using multiple threads to speed up the process.

  3. SigmaSquadron

    have you heard about the magical artefact that is ffmpeg?

  4. Darvond

    Aside from a pretty text interface, what might this offer over the tried, tested, code mature ffmpeg?

    Don’t get me wrong, the chrome on this is neat, but this is also just akin to showing someone who has a workflow based around ImageMagick/GraphicsMagick a bespoke gif converter.

    • I’m well aware of ffmpeg. In fact, TransFLAC uses it for the conversion to MP3 and AAC files. However, what you are missing is that ffmpeg only provides a small subset of the entire functionality. For more information, refer to the wiki mentioned in the article.

  5. Grandpa Leslie

    Congratulations on a very well done presentation.

    Not many people (very very few people) could do better

  6. Cornel Panceac

    In the .srpm:

    $ file gbcox-transflac-884f17e71b29.tar.bz2
    gbcox-transflac-884f17e71b29.tar.bz2: Zip archive data, at least v1.0 to extract, compression method=store

    If it’s .zip, maybe it should be called .zip 🙂
    (as opposed to .tar.bz2)

    • A “tar.bz2” file is a compressed archive file created using the tar command in Unix/Linux and the opensource patent free bzip2 compression algorithm.

      • The contents of the file are independent of the file name:

        tar with different compression algorithms

        • That is true, but the bz2 extension tells the user what compression was used. This might be useful if someone wishes to un-compress the tar file but not extract the contents of the tar file. I’ve had a need to do that in the past.

    • Gerald Cox

      Thanks for reporting. It was due to a difference in the way Bitbucket handles downloads. Odd it didn’t seem to cause any errors in the build process. In any event, it is fixed in v1.2.4, If you notice any further problems/concerns, please report in fedora bugzilla or in the bitbucket transflac repo under issues.

  7. Cornel Panceac

    The truth is TransFLAC is an amazing piece of software. It’s living proof things can still be simple in this very complex world.

  8. Patrick Perkins

    Not sure why, but i get ZERO output using this tool. ffmpeg -i works perfectly. Unfortunately, I have music library of over 2800 flac files and was hoping to use this tool to convert about 500 of them to be used in my watch for when I ride my bike..
    I suspect the tool is sensitive to spaces or other characters in my files

    ‘Disc 1 – 05 – All Along the Watchtower (live).flac’

    Ill keep searching for a tool that works for me.

    • Interesting, I tried with renaming a track to “Disc 1 – 05 – All Along the Watchtower (live).flac” and it encoded to mp3 with no problem. If you are still having an issue with this or the aac format, please open a bug report. Thanks!

  9. Patrick Perkins

    Some additional infofor my comment above.

    This works great when converting to MP3 format.

    I get no output when attempting to convert to an AAC format.

    I guess I am either missing an rpm or have an incorrect rpm installed.

  10. Vijay

    So this allows more lossy formats that just mp3? Do they occupy volume space or does it do it on the fly in a virtual filesystem like mp3fs?

  11. Patrick Perkins

    After reviewing the source code, I found that I don’t have the version of ffmpeg that allows the libfdk-aac codec which is used by transflac.

    But the built-in ffmpeg aac codec works fine for what I want.

    Was considering modifying transflac to use aac and then found a very sweet one line terminal command that converts all the files in a directory to the aac format that I am looking for.

    Still, transflac is a very kewl tool for converting flac files to other formats.

    • > After reviewing the source code, I found that I don’t have the version of ffmpeg that allows
      > the libfdk-aac codec which is used by transflac.

      Really? Where are you getting your version of ffmpeg. Fedora has ffmpeg-free which contains all the codecs needed by TransFLAC, as does most 3rd party repositories, e.g. freshrpms, negativo, etc. Since libfdk-aac is free now, I can’t imaging why anyone would exclude it from their ffmpeg build.

      • Patrick Perkins

        I have a couple of astronomical apps (Siril and Stellarium) that I believe pulled ffmpeg in as a dependency from rpm-fusion

        I’ll do some clean up and see if i can get the ffmpeg-free installed and working with my astro-imaging apps.

        I apologize for all the troubles I’ve caused you, Gerald.

        And I thank you for your kindness and support

      • Just my 2¢, but it might be worth checking at installation time anyway. e.g.: if ! ffmpeg -encoders |& grep -qi "\saac\s\+AAC (Advanced Audio Coding)$"; then echo "warning: aac encoding support not detected"; fi

        • Patrick Perkins

          This is actually VERY fast too. I converted 2583 (70.7 GB) flac files to AAC Standard in less than 5 minutes.

          Fedora 38, AMD Ryzen 5900X (4.25GHZ clock).

          Very very nice!

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions