High Bitrate ISO Music to FLAC

Here is the process I used to convert some DVD-audio ISO files into proper FLAC files for inclusion in my main collection.  No compromise in channels nor in audio quality required.

These instructions are for Ubuntu but will likely work on most Linux distributions (since ffmpeg and flac are so common).  Mac?  Maybe.  Win10 with bash?  Probably.

The basics are as follows:

  • mount the ISO
  • use ffmpeg to extract audio data into wav files
  • stitch multiple wav files together using Audacity
  • split that full-album wav into individual songs
  • convert those wav songs into FLAC files
  • tag and move into the main collection

Often mounting an ISO is a matter of right-clicking and choosing Mount; regardless I leave it up to you to make that happen in whatever manner you choose.  All that matters is that we can access the files through a specific file path.

You will need to fun ffmpeg against each audio file from the mounted ISO in order to get a complete collection of wav files to conjoin.  My most recent ISO had two and this command is for the second extraction:

ffmpeg -i ~/Desktop/ISO/AUDIO_TS/ATS_01_2.AOB ~/Desktop/RW/02_end.wav 
# run this line for each file containing audio and with a unique file name (in order) 

Now open all your files in Audacity (or whatever you’d like) and past each track against the end of the previous track until you have one project containing the entire audio content.  Export that as a single wav file.

Audacity will default to exporting as a two-channel 16×44 wav file.   You can change the bitrate in the lower-left of the project window.  For multi-channel exports, you’ll need to navigate to Edit –> Preferences –> Import/Export –> When exporting tracks to an audio file –> Use custom mix (radio button).  Now you are set to wave the full wave file.

Next you get to struggle with dividing the full file into individual songs.  This can be made all the more challenging if your album is progressive rock.  Who needs gaps between so-called songs?  Anyway, I can not offer much advice though there is this handy page from Audacity that could help.

You can do it!

Converting into FLAC is really easy.  It’s probably the easiest step in the whole process.  (Splitting into individual songs is probably the least easy if you’re keeping track.)

# cd into the folder where your newly created wav files are located and run flac itself 
flac --best --channel-map=none -V *.wav 
# you only need --channel-map=none if your full-length file has more than two tracks  

Once that has finished, you can tag your music.  I use EasyTag because it’s easy.


Password Chaos

Creating a memorable password runs against most of the rules implemented for creating a strong password.  Much fine work has been done parodying this interesting fact.  That being said, the folks who implement the rules and subsequently announce those rules to the users have lost their minds.  Take a look at this description of the required rules I happened upon recently.

Required Overlap
Required Overlap

Let’s pair some of these.


Between 8 and 64 characters

Increase the length from 12-20 characters


Use both uppercase and lowercase letters.

A lowercase or uppercase letter


Not repeat any character more than 3 times in a row.

Not be a sequence of 4 characters in a row.

In each of the above pairs, the first line is all that is required to articulate the apparent rule.  The second line can be dropped as superfluous (and confusing).

In the length pair, the “increase” line is essentially unparsable.  This is to say I can formulate no meaning for that line which aligns that line with the other lines in a logically consistent fashion.  If the minimum is 8 then there would never be a reason to increase by 12.  If you are 20 away from 64 (the maximum) there is no reason to increase the length.

In the case pair, the and and the or cannot be conjoined.  If you must use both (and) then you cannot use one or the other (or).

In the repetition pair, if you cannot have three in a row you necessarily can’t have four in a row.  Further, if the minimum is 8 it must be longer than 4 regardless.

Then there is the order of the list.  Makes me wonder if that order could have been arrayed in a way that would be more confusing.  Could it?

Never mind that five lines are sentences (ending in periods) and the other three lines are not (unpunctuated).

It’s like they took a poll of the IT staff and just listed out selections from their various responses.

Just… think it through a bit.  UI/UX isn’t something that requires a specialized developer.  Think.


Renaming in Python

I needed to rename several files.  I thought perhaps using a script would make it a little faster.  Well, the renaming went faster.  Writing the script of course took much longer.  But I suppose I learned something.

The image files were individual pages from a book of about 64 pages.  They were named one number off from their actual page numbers.  You can imagine how annoying that can be.  You can’t?  Well, try harder.  It’s pretty annoying when 3 isn’t three but 4.  Three isn’t four!

That doesn’t irritate you?  Well, I wrote a script to fix it nonetheless.

You can find the script over at my GitHub.

It’s modifiable enough so perhaps it can suit your needs.  Feedback is always welcome.


Useful bash Line for Debugging

I’ve started using this little code snippet to help debug problems within a bash script. It just shouts out the line where it appears when called. This is useful when you are trying to determine where a problem is located within the various twists and turns of the function calls within a script.

# Here is a print statement useful in debugging:  
printf '%s\n' "" "${LINENO}" "" 
# Pepper a script with those to see where your having trouble line-by-line! 

Have fun with that!


A Couple Recent Conversions for Audio and Video

I’ve had to make a couple of unusual conversion of late and wanted to make note of the solutions for my future self.  Hey, future self, git with it!

First, converting dsf (and I think also dff) files into flac files I just used ffmpeg as follows:

# first cd into the directory containing the dsf files in question, then… 
ffmpeg -i 15-Penny\ Lane.dsf 15-Penny\ Lane.flac 

Then I also needed to convert an ISO into some constituent mkv files. For this I used makemkv.

# first you'll need to install it from the Snap repositories.  
snap install makemkv 
# then open the graphical application and point it at your ISO.

Both pretty handy, easy, and fool-proof. I’m the fool. I’m the proof. Good hunting.


Take Multi-Line User Input and Add that to a Variable in Bash

We are using a construct using xargs and ctrl-d for breaking.  I’m not perfectly satisfied with it, but it certainly does the job of taking multi-line user input and stuffing that into a variable (formatting intact).

(The first and third assignments add quotes around the contents of the xargs input.  You may or may not require that.  In our case the variable is the body of a message sent by mail.  It must be quoted.)

printf '%s\n' "What would you like the body of the message to contain?  " 
printf "\\033[1mWhen finished hit ctrl-d on a new line to proceed.\\033[0m  \\n\\n" 
# this will load the user's input into a variable instead of a file 
reminderBody+=$( xargs -0 ) 

This basic construct could be used for a variety of needs.

(The \033[0m‘s are used to change font colors. Again, optional.)


Go, Speed R-AI-cer!

I’d like to see a competition between autonomous driving vehicles on some sort of track.  Something like an AI-500.  Let’s see what they can do in this kind of situation.  Let’s see what that does for their autonomy.

Probably be best if a variety of manufacturers are participating in the competition.

Must have something like the flag system for signaling to the vehicles concerning course conditions.  Perhaps a course boundary that shows the various signals all around the track (a yellow boundary for a yellow flag which I believe is traditionally an accident on the course).

Cars that incorporate IR (see my previous article) may have some advantages in anticipating what the other vehicles are doing on the course.


NTP and the Delay

We were setting up a check to ensure our time servers were pointed correctly from the firewall, but the standard time query was taking six seconds for each check.  With four time servers that’s nearly thirty seconds to make a simple “are you there” sort of check.  We didn’t want to do a simple ping test since this would not ensure the machine queried was in fact an actual time server.

After some digging and testing we found that if we limited the packets to a single packet the test was instantaneous.  So we added the -p argument and called it good.  (In our case we were not concerned with checking the time status but rather only the status of the server as an available time server.)

This is the basics of the command:

time ntpdate -qp ip.or.host.name

And that’s about it.  Very much faster with the p in the mix.


Get git on a Server of Your Own

The trouble with searching the Web for instructions relating to git and using your own git server is that mostly you will find articles for working with someone else’s repository server (like GitHub or so many others).  You can find quite good instructions for interacting with a remote server from your local development machine, but there are so many such instructions out there that locating useful information about using your own server to host git gets buried pretty deep.

Let’s go over some of the most basic pieces, and if you know how to use git with someone else’s repository server then you will be in good enough shape to sort out your specific situation.

First we need to differentiate between the served repository and any local copy of the files you might like to keep.  You don’t necessarily need to keep a local copy of the files on the server since the repo contains enough information to rebuild the files at any point, but I’m going to show you how because I wanted mine to include server-held local copies of the files.

On your server you’ll want to create a bucket for holding any and all of your git repositories (I broke mine into projects plus an archive folder).  So your paths may look like this:


In the above example, the folder I’ve called git is just the bucket which holds the local copies of the repository files, and should not be used itself as a repository.  (If you are only planning a single repository I would still recommend using this structure as a way of being ready for the future.)  The folder I’ve called .repos is the bucket which contains the git repositories; these sub-folders do not contain any of the actual files but rather just diffs which allow git to rebuild the files at various stages.  You will see that I have a one-to-one correspondence between the .repos sub-foldders and the local copy folders above.

Move into each directory under .repos in turn and perform these actions.  Here we will just pick project1 and go through the steps.

cd /media/storage/git/.repos/project1
git init --bare

This will create an empty repository which you can clone, add files, and make commits.  This is how to make your first copy (of the empty repo) and add files.

cd /media/storage/git
git clone yourusername@localhost://media/storage/.repos/project1
# now move into the newly cloned directory... 
cd project1
# here you will want to add any existing files to this folder or create a new file then...
git add .
git commit -m "initial commit of new repo"

Now you have a good master to begin.

From your laptop or workstation or any other computer you can perform these cloning steps above but substitute the name of your server machine for localhost in the clone command above.  (This uses ssh for reading and writing to git.  You can find instructions out there for http if you’d rather use that.  I prefer ssh.)

You won’t need to use git add until there is at least one file you want git to know about.  Commits just let git understand that anything git knows you have changed is to be regarded as canon.

Add some files and make some changes. Then move into the project directory to add, commit, and push.

# move into some folder, probably called git, where you want to store your git repos
git clone yourusername@yourserver://media/storage/.repos/project1
# now move into the newly cloned directory... 
cd project1
git add .
git commit -m "useful commit message so you remember what the fuck you did"
git push

If you set up a local copy on your server like I did above, you will want to regularly git pull into that copy so the files stored there are as up to date as possible (when you run your backups for example).

As near as I can tell this is the best way to manage that for oneself.  If there are better practices than those I’m using here, I’d like to see the detailed explanations for making them work and why they are a best practice.  Let me know.

Otherwise, have a great time with your newly minted git server.