[savvyadmin] 0:home1:processes2:recipes3:explain4:archive linux & server reference since 2007
david@web-1:~$ less recipes/strip-all-unwanted-mp3-id3-tags.md
STRIP-ALL-UNWANTED-MP3-ID3-TAGS recipes

Strip All Unwanted MP3 ID3 Tags

published 2014-06-20 · refreshed 2026-10-20 · tested on Ubuntu 26.04 · eyeD3 0.9.7 · tags: eyed3, id3, mp3, multimedia, music

Music bought from online stores still arrives with frames you never asked for: purchase dates, transaction IDs in TXXX user-text frames, store comments, a POPM popularimeter, the TDTG tagging timestamp that tag editors add on every save. The 2014 script below (kept under As published) did the cleanup with eyeD3 0.7. eyeD3 0.9 changed its command line: --set-text-frame= and --no-tagging-time-frame are gone, and --remove-frame, --remove-all-comments, --remove-all-unknown and --preserve-file-times do the job more directly. This is the same idea, rewritten for it.

Install

sudo apt install eyed3

See what a file carries

eyeD3 -v track.mp3

The verbose listing ends with the frame inventory, one line per frame. A store-bought file typically shows something like:

12 ID3 Frames:
COMM (32 bytes)
POPM (27 bytes)
TALB (16 bytes)
TCON (15 bytes)
TDEN (21 bytes)
TDTG (21 bytes)
TIT2 (16 bytes)
TPE1 (17 bytes)
TPUB (15 bytes)
TRCK (13 bytes)
TSSE (23 bytes)
TXXX (24 bytes)

Of those, only TALB, TCON, TIT2, TPE1 and TRCK are the album, genre, title, artist and track number. Everything else is clutter.

One-off cleanup

eyeD3 --preserve-file-times --remove-all-comments --remove-all-unknown --remove-frame TXXX --remove-frame POPM --remove-frame TDTG --remove-frame TDEN --remove-frame TPUB --remove-v1 track.mp3

--remove-frame FID drops every frame with that ID, --remove-all-comments clears the COMM frames, --remove-all-unknown drops frames eyeD3 cannot parse, --remove-v1 deletes the ID3v1 tag (if there is none you get a harmless Removing ID3 v1.x tag: FAIL), and --preserve-file-times keeps the file’s modification time so your backup tool does not re-copy the whole collection. Add --to-v2.3 if your player wants ID3v2.3 rather than v2.4.

strip-tags.sh, 2026 edition

Save as strip-tags.sh (or download strip-tags-v2.sh), make it executable, edit oktags to taste, and run it from the top of your music tree. It inventories every frame in every MP3 below the current directory, prints the set it is about to delete, waits for Enter, and then strips them in one pass.

#!/bin/bash
# strip-tags.sh - keep only the ID3v2 frames listed in $oktags, drop everything else.
# Needs eyeD3 >= 0.9 (sudo apt install eyed3). Run it from the top of your music tree.
set -euo pipefail
oktags="TALB APIC TCON TPE1 TPE2 TPE3 TIT2 TRCK TYER TDRC TCOM TPOS"
present=$(find . -iname '*.mp3' -exec eyeD3 --no-color -v {} + 2>/dev/null | grep -oE '^[A-Z0-9]{4} \(' | cut -c1-4 | sort -u | tr '\n' ' ')
strip=""
for f in $present; do case " $oktags " in *" $f "*) ;; *) strip="$strip --remove-frame $f";; esac; done
echo "Frames present: $present"
echo "Frames to strip: ${strip:-none}"
read -rp "Press Enter to strip them, Ctrl-C to abort " _
find . -iname '*.mp3' -exec eyeD3 --quiet --preserve-file-times --to-v2.3 --remove-v1 --remove-all-comments --remove-all-unknown $strip {} +
echo "Done."
cd ~/Music && strip-tags.sh
Frames present: COMM POPM TALB TDTG TIT2 TPE1 TPUB TRCK TSSE TXXX
Frames to strip:  --remove-frame COMM --remove-frame POPM --remove-frame TDTG --remove-frame TPUB --remove-frame TSSE --remove-frame TXXX
Press Enter to strip them, Ctrl-C to abort

Two things differ from 2014 on purpose. The frame inventory now comes from the FID (n bytes) lines of eyeD3 -v, which is stable output, instead of parsing the old angle-bracket format. And find -exec ... {} + hands many files to one eyeD3 process, which is much faster on a large collection than one process per file.

The keep list

TALB  Album
APIC  Attached picture (cover art)
TCON  Genre
TPE1  Lead performer
TPE2  Band / album artist
TPE3  Conductor
TIT2  Title
TRCK  Track number
TYER  Year (ID3v2.3)
TDRC  Recording date (ID3v2.4, converted to TYER by --to-v2.3)
TCOM  Composer
TPOS  Disc number

If your player shows lyrics or you keep ReplayGain, add USLT and the TXXX frame to the list, or drop --remove-all-unknown, before running it over the collection. Make a backup first; this is a one-way operation.

AS PUBLISHED, 2014

ORIGINALThe text below is the 2014 version, unchanged, so that links from that era still point at the document they cited.

A while back, I wanted to find a tool that would go through my entire collection of MP3’s and remove all the extra ID3 tags I didn’t want. For example, when I purchase music from Amazon, Rhapsody, and other online music stores, there are a number of tags in the files that track things like the purchase date and sales transaction ID’s. I also like to get rid of annoying comments and other hidden tags that most editors won’t even show you.

In my search for a tool, I came across this very useful post outlining a similar project. In the authors quest to do the same thing, he came up with a shell script that searches for all MP3 files, and removes tags that are not in his list of “good” tags. I usually don’t like to rehash the work someone else has done, but since I use his script so often, I thought it would be useful to repost it with only minor modifications.

Prerequisite: Install eyeD3

The script requires the eyeD3 tag editor to parse and manipulate the tag data. So be sure to install eyeD3, which should be available in your favorite Linux repository.

sudo apt-get install eyed3

Save and Modify Script

Save the following script as [strip-tags.sh](http://savvyadmin.com:80/downloads/strip-tags.sh) somewhere in your executable path.

#!/bin/bash
# Script name: strip-tags.sh
# Original Author: Ian of DarkStarShout Blog
# Site: http://darkstarshout.blogspot.com/
# Options slightly modified to liking of SavvyAdmin.com
 
oktags="TALB APIC TCON TPE1 TPE2 TPE3 TIT2 TRCK TYER TCOM TPOS"
 
indexfile=`mktemp`
 
#Determine tags present:
find . -iname "*.mp3" -exec eyeD3 --no-color -v {} ; > $indexfile
tagspresent=`sort -u $indexfile | awk -F): '/^<.*$/ {print $1}' 
| uniq | awk -F)> '{print $1}' | awk -F( '{print $(NF)}' 
| awk 'BEGIN {ORS=" "} {print $0}'`
 
rm $indexfile
 
#Determine tags to strip:
tostrip=`echo -n $tagspresent $oktags $oktags 
| awk 'BEGIN {RS=" "; ORS="n"} {print $0}' | sort | uniq -u 
| awk 'BEGIN {ORS=" "} {print $0}'`
 
#Confirm action:
echo
echo The following tags have been found in the mp3s:
echo $tagspresent
echo These tags are to be stripped:
echo $tostrip
echo
echo -n Press enter to confirm, or Ctrl+C to cancel...
read dummy
 
#Strip 'em
stripstring=`echo $tostrip 
| awk 'BEGIN {FS="n"; RS=" "} {print "--set-text-frame=" $1 ": "}'`
 
# First pass copies any v1.x tags to v2.3 and strips unwanted tag data.
# Second pass removes v1.x tags, since I don't like to use them.
# Without --no-tagging-time-frame, a new unwanted tag is added.  :-)
 
find . -iname "*.mp3" 
-exec eyeD3 --to-v2.3 --no-tagging-time-frame $stripstring {} ; 
-exec eyeD3 --remove-v1 --no-tagging-time-frame {} ; 
 
echo "Script complete!"

To run the script, just execute it from the top level parent directory.

cd ~/Music/

strip-tags.sh

I really didn’t change a whole lot from the original, only making slight tweaks to eyeD3 options. For example, I removed colors from the eyeD3 output when creating the first list of tags, and added a line to remove v1.x ID3 tags since I don’t like to keep them around.

Be sure to edit the list of good tags identified by the “okaytags” variable. My preferred list includes the following:

oktags="TALB APIC TCON TPE1 TPE2 TPE3 TIT2 TRCK TYER TCOM TPOS"
TALB - Album/Movie/Show title

APIC - Attached picture (Album Art)

TCON - Content type (Genre)

TPE1 - Lead performer(s)/Soloist(s)

TPE2 - Band/orchestra/accompaniment

TPE3 - Conductor/performer refinement

TIT2 - Title/songname/content description

TRCK - Track number/Position in set

TYER - Year

TCOM - Composer

TPOS - Part of a set

Enjoy!

savvyadmin.com 2026-10-20 STRIP-ALL-UNWANTED-MP3-ID3-TAGS
recipes/strip-all-unwanted-mp3-id3-tags.md (END)