How to edit your music data tags using the command-line

Published: Thursday, August 6, 2020

The command-line tool Audiotag is an easy to use Perl-script for editing the data tags in your music files. It supports the formats MP3, OGG Vorbis, MP4, M4A and FLAC.

Example usage

To print information about a track you use the flag -l, --list-info:

$ audiotag -l 01_Claustrophobic_Amnesia.ogg

*** `01_Claustrophobic_Amnesia.ogg'
=== ALBUMARTIST: Ter Ziele
=== ARTIST: Ter Ziele
=== COMMENT: Visit
=== DATE: 2018
=== TITLE: Claustrophobic Amnesia

I noticed that the track is missing a genre, let’s set the genre for all the tracks of that album:

$ audiotag -g "Depressive suicidal black metal" *.ogg

It’s simple as that. To list all available features just use the flag -h, --help. I also highly recommend using the flag -p, --pretend to dry run the command if you’re not 100% sure about what you’re about to do.


The easiest option is probably to clone the Git-repository on GitHub and copy the script to your $PATH. Just make sure that you have installed Perl (version 5.6 or newer) and:

If you’re using Gentoo, these are packages you might be looking for:

If you don’t have support for a format it might annoyingly remind you about it every time you use the tool:

$ audiotag -h                                                                                           -- INSERT --
WARNING: `AtomicParsley' not found in path, required for mp4 support!
WARNING: `AtomicParsley' not found in path, required for m4a support!

As you can see I don’t have support for MP4 or M4A and I don’t care. I fixed this issue by commenting out two parts of the script between the lines 473-491:

# MCM - handle mp4 and m4a using AtomicParsley
elsif ($file =~ /\.mp4$/i or $file =~ /\.m4a$/i) {
	push @cmd, "AtomicParsley";
	push @cmd, $file;
	foreach (sort { $a cmp $b } keys %$info) {
		# don't need extra track num field
		/TRACKNUMBER/ && next;
		$plus_tags{$_} ||= "===";
		push @result, "$plus_tags{$_} $_: $info->{$_}";
	if ($genre   ) { push @cmd, ("--genre", uc $genre);		}
	if ($artist  ) { push @cmd, ("--artist", $artist);		}
	if ($album   ) { push @cmd, ("--album", $album);		}
	if ($title   ) { push @cmd, ("--title", $title);		}
	if ($track   ) { push @cmd, ("--track", $track);		}
	if ($year    ) { push @cmd, ("--year", $year);			}
	if ($comments) { push @cmd, ("--comment", $comments);	}
	push @cmd, ("--overWrite", "--gapless", "true");

And the lines 663-664:

check_for_prog(\@filetypes, \@missing, "mp4", "AtomicParsley"     );
check_for_prog(\@filetypes, \@missing, "m4a", "AtomicParsley"     );

It then stopped complaining about it.



If you want to leave feedback you can do so by either sending me a message via e-mail or by commenting on my post for this article on the fediverse.