Tuesday 26 December 2017

Linux script to cleanse unwanted MP3 tags

After making a copy of my CD collection converted from FLAC to MP3, I found it failed to play in a 5-year-old car stereo on a USB stick... My Ford Focus SYNC car stereo said "Indexing USB" for about an hour, then eventually said "Bad USB Media".  (Sync is "powered by microsoft" which probably explains its general crapiness).

From web searches, apparently some MP3 taggers include cover art and other crazy tags, which can confuse the Ford car stereos. Maybe my FLAC-to-MP3 script pulled in some such tags (as it seemed to go to internet to pull tag data).

So here's a quick and dirty Ubuntu script to iterate over my entire MP3 collection and rip out any dicey looking tags.

strip_unwanted_id3_tags.sh

for TAG in TCOP APIC PRIV TXXX TCOP MCDI POPM TCON TDAT TENC TLEN TPUB TSSE WXXX
do
   echo Stripping tag $TAG from all MP3 files below current folder...
   find . -name *.mp3 -exec id3v2 -r $TAG  '{}' \; >/dev/null
done

The list of tags to remove came by using 'id3v2' to examine the entire collection, removing the more rarely used tags plus the album art ones.   

This seems to make my Ford Focus accept the 128GB FAT32 USB stick. In early testing however it has failed to play tracks in correct order - grrr....

By contrast a VW car stereo of a similar age (their RNS 315 unit) accepted the original unaltered MP3 files on a 128GB FAT32 SD card and just worked!  Much more impressive...

Linux script to convert FLAC to MP3

Found this somewhere on the net but have lost the source - apologies if you are the author!

Nice clean script to convert FLAC to MP3. Nice thing is that it leaves it alone if you've already done it... So you can run it again if you've added a few FLACs.  Also, for those albums that I have as MP3 rather than FLAC anyway (e.g. Amazon autorip CDs) the script copies the MP3 across to the copy directory tree, which is just what I want.

Works very nicely on Ubuntu 17.10. Idea is to convert my CD collection (stored as FLAC) into MP3 format for playing in the car on a USB stick.