Bash script: convert FLAC to MP3


  • lame (sudo apt-get install lame)
  • flac (sudo apt-get install flac)
  • directory with flac files


flac -d *.flac
find -name "* *.wav" -type f | rename 's/ /_/g'
for i in $( ls -b *.wav ); do
  lame -hV0 $i
  rm $i
find -name "*.mp3" -type f | rename 's/_/ /g'

This script will decompress the flac files to wav files, remove any spaces in the file name, it will then convert the wavs to mp3 using lame's highest variable bitrate setting, then finally replace the underscores back to spaces.  If you don't want spaces in your file names, you can remove the last line.

To use the script, create a new file on your system, copy the contents of the script inside, give it executable properties (sudo chmod +x scriptname), then run it in the directory containing the flac files, (./scriptname) where scriptname is the name of your script.


Prevent removed videos from disappearing on Youtube playlists

Playlists are a great feature in Youtube.  Unfortunately, if the video owner removes their video from Youtube, although you get a warning message from YouTube

You are left with an empty space in your playlist that gives you no clue as to what had been in that slot.

The work around is to use the Add / Edit notes feature of the playlist.

Click [Add / edit notes], and in the dialog that pops up, highlight and copy the name of the video, then paste that text into the text description.

Now click Save.  Now, if the owner of the video deletes the video, even though the title of that removed slot in your playlist will still say "[Deleted Video]", now your custom text will still be there, telling you the name of the video that was removed.  In most cases, you can find another copy of the same video and re-attach it to your playlist.  Problem solved!