Is there a way to read the mp3 tags of a file from the shell? Something like:
mp3tags MyFile.mp3 author
should output the author-tag of an mp3-file.
Is there a way to read the mp3 tags of a file from the shell? Something like:
mp3tags MyFile.mp3 author
should output the author-tag of an mp3-file.
You can also use
ffprobe
which is part offfmpeg
.If you don't want other information, like track length and so on, you can combine the output with grep:
Or in order to get only the author:
You can select other tags by separating them with a comma, such as
format_tags=title,album
.I wanted to search for a keyword in all mp3 files in a folder. The folder had 486 files, so it became interesting to know which of the solutions mentioned here is the fastest. Here is the loop I used:
Notes:
lltag
andmp3info
don't find a title, because the files I was using had ID3v2 tags, see the comment by @s-prasanth: How to read mp3 tags in shell?eyeD3
is problematic to use programmatically, because it uses color codes (boldness).eyeD3
and alsoid3v2
(but only for ID3 v1 tags) return the title and the artist on the same line, which further complicates things; thereforegetTitleEyed
and sometimesgetTitleId3
return both the title and the artist, so please don't copy-paste those functions.getTitleId3 will only work for ID3 v2 tags, because
id3v2
has different formats for ID3v1- and ID3v2-tags, i.e.vs. ID3v2:
As the only program of these 5
eyeD3
prints a red warning for two of the files:It seems like those two files have ID3v1 tags, because those two files are the only ones where
lltag
andmp3info
can get a title. I'm wondering if this is a bug ineyeD3
as no other program mentioned here has a problem with these files ...Results (real time):
Time-wise the winner here is
id3tool
(mp3info is faster, but doesn't work with ID3 v2).id3v2
is also quite fast, but thegetTitleId3
function would need adjustment to also work with ID3v1-tags, which may at worst slow it down by factor 2.Ok, I found a program by myself. It is called mp3info and installed by
To get single mp3 tags from a file, one has to call
which gives the artist of the file. The %a means that one want to get the artist and there are some other keys for the other tags.
You can use eyed3. First, from a terminal, install:
Then, run:
Combine that with
grep
to get specific tags in one line.(to strip all mp3 tags, see HERE)
I prefer to use id3v2, just type
id3v2 -l somefile.mp3
. You can also see the id3v2 man page for more specific use.You can try exiftool(Read and write meta information in files).
Here is an example of the command:
Check out
lltag
if you are looking for a solution which supports more than just mp3/ID3.Install it with:
to view all tags with it: (
-S
is for show)to view certain tags with it:
Beets
You can start with this screencast and the Getting started guide
Install either:
Also:
exiftool -v3 *.mp3
mid3v2
from (python-mutagen
package) (instead ofid3v2
, last update was on 2013!)id3
- Editor for ID3 tags (not the same as this id3)id3tool
- Command line editor for id3 tagsid3ren
- id3 tagger and renamerI've just recovered dozens of deleted mp3 files from a memory card using PhotoRec. PhotoRec is not able to recover the original file name, so assigns names to the files in order of recovery - eg.
f1234567.mp3
.I wanted a quick way of reading and listing the ID3 tags so that I could see what the recovered recordings were without having to open, listen to and rename each mp3 file in turn. I'm using Linux Mint 20 ('Ulyana') Cinnamon and have previously installed the free open source app EasyTAG for editing ID3 tags via a GUI.
If you open EasyTAG and navigate to the folder containing the mp3 files, its default behaviour is to list the file name (eg.
f1234567.mp3
assigned by PhotoRec) alongside the Song Title (eg. La Vie En Rose) extracted from theTitle
field of the ID3 tag for all files in that folder. I appreciate that this does not use the shell as stated in the original question, but is an alternative which is incredibly simple to use. Hope this helps.I have the same problem and need some app but I have python on my ubuntu, then I decide to use python. you can use the python package
tinytag
if you have python on your ubuntufirst, install tinytag using pip
now