Friday, August 11, 2023

TransFLAC - Convert FLAC audio files 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.

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 Format

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.

Four parameters are required to 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: sudo dnf install transflac

 

[gbcox@charon ~]$ [gbcox@charon ~]$ t [gbcox@charon ~]$ tr [gbcox@charon ~]$ tra [gbcox@charon ~]$ tran [gbcox@charon ~]$ trans [gbcox@charon ~]$ transf [gbcox@charon ~]$ transfl [gbcox@charon ~]$ transfla [gbcox@charon ~]$ transflac [gbcox@charon ~]$ transflac _____ _____ _ _ ____ |_ _| __ __ _ _ __ ___| ___| | / \ / ___| | || '__/ _` | '_ \/ __| |_ | | / _ \| | | || | | (_| | | | \__ \ _| | |___ / ___ \ |___ |_||_| \__,_|_| |_|___/_| |_____/_/ \_\____| Please enter input FLAC directory and press[ENTER]: [ENTER]: m [ENTER]: mu [ENTER]: mus [ENTER]: musi [ENTER]: music [ENTER]: music _____ _____ _ _ ____ |_ _| __ __ _ _ __ ___| ___| | / \ / ___| INPUT Directory /home/gbcox/music accepted | || '__/ _` | '_ \/ __| |_ | | / _ \| | Please enter output directory and press[ENTER]: o [ENTER]: op [ENTER]: opu [ENTER]: opus [ENTER]: opusm [ENTER]: opusmu [ENTER]: opusmus [ENTER]: opusmusi [ENTER]: opusmusic [ENTER]: opusmusic OUTPUT Directory /home/gbcox/opusmusic acceptedPlease enter desired output CODECSupported: OPUS | OGG | AAC | MP3[ENTER]: [ENTER]: o [ENTER]: op [ENTER]: opu [ENTER]: opus [ENTER]: opus Transcoding: FLAC to OPUS Please enter desired CODEC QUALITYSupported: LOW | MEDIUM | STANDARD | HIGH | PREMIUM [ENTER]: [ENTER]: s [ENTER]: st [ENTER]: sta [ENTER]: stan [ENTER]: stand [ENTER]: standa [ENTER]: standar [ENTER]: standard [ENTER]: standard Quality Setting: STANDARD INPUT Directory /home/gbcox/music OUTPUT Directory /home/gbcox/opusmusic *** 18 FLAC files are being processed *** ../tina_turner/simply_the_best 17: 01_the_best 16: 02_better_be_good_to_me 15: 07_what_you_get_is_what_you_see 14: 09_river_deep_-_mountain_high 5: 03_i_can't_stand_the_rain 4: 04_what's_love_got_to_do_with_it 4: 04_what's_love_got_to_do_with_it 3: 05_i_don't_wanna_lose_you 2: 06_nutbush_city_limits_(the_90's_version) 1: 08_let's_stay_together 1: 08_let's_stay_together Completing remaining 4 processes...[--------------------------------------------------] 0%[#########################-------------------------] 50%[#####################################-------------] 75%[##################################################] 100%Syncing all album art files...Processing complete[gbcox@charon ~]$ e [gbcox@charon ~]$ ex [gbcox@charon ~]$ exi [gbcox@charon ~]$ exit [gbcox@charon ~]$ exitexit