Home > Software engineering >  Finding MP3 files that only have ID3v1 tags and no ID3v2?
Finding MP3 files that only have ID3v1 tags and no ID3v2?

Time:09-01

I have some 'vintage' MP3 players that only work with ID3v1 tags. Many of my MP3 files only have ID3v2 tags and the ID3v1 area is blank.

I've found a good way to batch copy what's in the ID3v2 to the ID3v1 area (see * below) but before I do this to tens of thousands of MP3 files it occurs to me I might have some that only have ID3v1 information, in which case copying the (blank) ID3v2 will probably wipe the tag

(I have run a test by creating an MP3 with only v1 tags and no v2 and it looks like my solution doesn't overwrite the v1 with blanks but I am still a bit concerned.)

Can you think of a simple way to batch search for MP3 files that only have ID3v1 tags and no ID3v2 data present?

Linux shell preferred (via a kid3 command maybe?) but Windows is do-able.


The way I'm copying the ID3 data from ID3v2 to ID3v1 is with the Python app eyed3:

eyeD3 --to-v1.1 *.mp3
or
eyeD3 --to-v1.1 PATH 

As mentioned, I've also installed kid3 which is useful for GUI use but the command line is flipping complicated...!

CodePudding user response:

A homemade script would do nicely:

#!/bin/bash

find . -type f -name "*\.mp3" -print0 | while IFS= read -r -d '' file
do
    if ! eyeD3 -1 "$file" 2>&1 | grep -q "No ID3 v1.x tag"
    then
        echo "$file"
    fi
done
  • eyeD3 -1 "$file" prints "No ID3 v1.x tag found!" when not present.
  • So use that output. If it is present, you have a v1 tag.
  • The echo "$file" will only execute for files that do have a v1 tag.
  • Thus producing your list of files that have a v1 tag.

CodePudding user response:

A minor addition to Nic's solution to only output if there is an IDv1 tag but no IDv2 tag present - thanks

#!/bin/bash

find . -type f -name "*\.mp3" -print0 | while IFS= read -r -d '' file
do
    if ! eyeD3 -1 "$file" 2>&1 | grep -q "No ID3 v1.x tag" && eyeD3 -2 "$file" 2>&1 | grep -q "No ID3 v2.x tag"
            then            
            echo "$file"
    fi
done
  • Related