How Can I Batch Change the Metadata of MP3 Files?

7,960

I do something like this, although I'm not adding in the same information (all I'm adding is album art.)

You need the package eyeD3.

For my particular use, I use the following command line (I incorporate it into a bash script, you could certainly use python):

eyeD3 --genre= --to-v2.3 --no-tagging-time-frame --remove-comments --add-image=$BASEPATH/$RELPATH/folder.jpg:OTHER:folder.jpg $SONG.mp3"

Here I'm removing any existing genre setting, making sure the format is ID3v2.3, removing comments, and adding album art. I've previously ensured that the source directory of every album contains a file called folder.jpg which contains the album art. eyeD3 supports all the metadata you want at the command line, you can customize it all you like.

for i in *.mp3; do
  SONG=`basename "$i" .mp3`
  ARTIST=`echo "$SONG" | awk -F " - " '{print $1}'`
  TITLE=`echo "$SONG" | awk -F " - " '{print $2}'`
  eyeD3 --artist "$ARTIST" --title "$TITLE" "$SONG.mp3"
done
Share:
7,960

Related videos on Youtube

That Brazilian Guy
Author by

That Brazilian Guy

Living in the Buenos Aires jungle, surrounded by monkeys, wearing a sombrero, dancing the samba. I make a lot of really unfunny jokes and complain about the price of gadgets in my country. Fluent in Brazilian Spanish.

Updated on September 18, 2022

Comments

  • That Brazilian Guy
    That Brazilian Guy over 1 year

    I have a fews of songs in a folder which I would like to add the metadata items of artist, title, genre and album to. I would like to take the metadata info for the title and artist from the file name itself.

    For Example: I have a song file named Melvv - Glide.mp3. I would like to take the name of the artist Melvv and the title of the song Glide from the file name and add it as MetaData. For the Album and Genre, I'll add this in myself.

    1. Is there a way I can do this in the Linux environment via bash or python?
    2. Is there a way this can be done in the Windows environment?
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 9 years
      Also see: Auto-tagging MP3s, this is probably the best dupe overall.
    • Franck Dernoncourt
      Franck Dernoncourt over 9 years
      @JakeGould The question you pointed to is Linux only.
    • Franck Dernoncourt
      Franck Dernoncourt over 9 years
      @Ƭᴇcʜιᴇ007 The first question you pointed to is CLI only, the second is much broader (tags are not taken from filenames necessarily)
    • Giacomo1968
      Giacomo1968 over 9 years
      @FranckDernoncourt The original poster clearly asks, “Is there a way I can do this in the Linux environment via bash or python?” So the question I am linking to clearly satisfies that question.
    • Franck Dernoncourt
      Franck Dernoncourt over 9 years
      My point is only part of his question is a duplicate.
    • Ƭᴇcʜιᴇ007
      Ƭᴇcʜιᴇ007 over 9 years
      @FranckDernoncourt The broader one is the better one, since it's not tied to a specific OS. As for "tags are not taken from filenames necessarily", that still includes taking names from the file names; which most of the utilities listed can do. It's strange to me that you find it's not a good match, since the #2 answer suggests the same software you did in this one.