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

Friday, April 7, 2023

PostgreSQL Upgrade - Fedora 38

Fedora 38 will upgrade your PostgreSQL database from 14.7-~ to 15.1-2.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:

  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_14.7/
  4. As root, initialize your 15.1 database:  sudo postgresql-setup --initdb --unit postgresql
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_14.7/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-14/bin/ -B /usr/bin/ -d data_14.7/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.  In steps 4, 9 and 10 you must issue the commands as root.  If you don't have sudoers setup for the postgres user, it will fail.  In this case just issue the "su" command to enter root without "sudo".  Remember to issue "exit" to return to the user "postgres".