Skip to main content

Topic: FLAC options in Perl Script (Read 1989 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • landrand
  • [*]
FLAC options in Perl Script
Over the last month or so, I've ripped a 180 cd's and plan to rip 500 more.  I used EAC to just rip the CD's into wav files since at the time I wasn't sure what encoder or format I should use.  Since I'm running out of harddrive space, I have to encode the songs and delete the wav files.  My music collection  has the following format on a linux host:

/musicdir/country/Clint Black/Greatest Hits/song.wav  etc...
/musicdir/country/Clint Black/Greatest Hits/date.txt
/musicdir/rock/Van Halen/5150/song.wav etc....
/musicdir/rock/Van Halen/5150/date.txt

I thought this structure would work fine with a perl script so I could use the directory information to tag the file using any encoder. Anyway, I recently decided that a lossless encoder (flac 1.1) would be the best way to save my music collection.  If I ever wanted to ogg the files, I could just write a script to decode the .flac and encode with oggenc.  Now I'm getting ready to write a script that will go through my musicdir and encode the .wav files into .flac files and also tag each song with the genre, artist, album, and title.  I also wanted a album date tag so I manually created a date.txt file in each album directory and the script will read the date.txt file  and create a  tag with the album year.  Here's the flac commandline that I'm going to use in the perl script to encode the wavs to flacs.

system (flac,"-T artist=$fields[5]","-T album=$fields[6]","-T title=$fields[7]","-T genre=$fields[4]","-T date=$date[0]", "-T comment=EAC.9b4:flac1.1-C6",  -6, --replay-gain, song_to_encode);

Anything I'm missing?  Although I don't fully understand the replay-gain feature I included it.  Not sure if replay gain will provide any value due to each  song will be encoded individually.  Is there any other information from a music CD (serial #'s or whatever) that I should include in the flac tags to make my music archive more flexible or "future proof".  I've been reading about cuesheets but it appears they're only usefull if you rip a CD into a single image.  Also, should I use the -verify option in flac.  Don't know if that will provide any benefit or not.  Any comments or suggestions would be appreciated.

Although I could have use EAC to rip and encode, I decided to go this route so I could interactively rip CD's faster and then encode all songs in a single swipe while I'm asleep.  Plus, I wanted to learn perl.

  • jcoalson
  • [*][*][*][*][*]
  • Developer
FLAC options in Perl Script
Reply #1
Encoding individual tracks will not get you the album replay gain but you can always add it later easily with metaflac.  In that case I would say to skip --replay-gain while encoding to save a little time, just add it later with "metaflac --add-replay-gain /musicdir/rock/artist/album/*.flac".  Make sure that you have some padding when encoding (by default flac 1.1.0 adds 4k padding which is plenty, you only need maybe 100 bytes or so for replay gain tags).

Josh