How to tag all your audio files in the fastest possible way

Audio editors, music players, video players, burning software, etc.
Message
Author
User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

How to tag all your audio files in the fastest possible way

#1 Post by Flash »

From this article:
By Marco Fioretti
February 23, 2012, 9:00 AM PST

Takeaway: Marco Fioretti shows you his method for tagging MP3 files with as much automation as possible so that you can impose a little order on music or other audio collections.
....And now one shell way to tag MP3 files

The easiest way to prepare non-song MP3 files for proper tagging is to give them consistent and meaningful names. Once that precondition is verified, you can automatically use those names to write tags with a script like this:

Code: Select all

 1 #! /bin/bash

   2

   3 for SONG in `find $1 -type f -name "*mp3"`

   4     do

   5        TITLE=`basename $SONG | cut -d_ -f1 | tr "-" " "`

   6        LEAD=`basename  $SONG | cut -d_ -f2 | tr "-" " "`

   7        YEAR=`basename  $SONG | cut -d_ -f3 | cut -c1-4`

   8        id3tag   --song="\"$TITLE\"" $SONG

   9        id3tag  --album="\"$TITLE\"" $SONG

  10        id3tag --artist="\"$LEAD\"" $SONG

  11        id3tag       -y$YEAR $SONG

  12     done

  13     exit
Here I assume that each file has a name in the format TITLE_LEAD_DATE.mp3, with the first four characters of the DATE being the YEAR of recording. Of course, once you get the trick, you can easily hack the script to work with any other (constant!) naming format. Lines 5 to 7 extract title, lead and year from the file name, replacing hyphens with spaces: a file named The-Wall_Pink-Floyd-19791130.mp3 will return “The Wall

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#2 Post by zigbert »

Why not use the Puppy builtin tool?
This tool is meant exactly for your case.
Tag either tracks in Playlist or Music-Sources. See menu.

The information also shows example code for audio-books. Here follows all the info text:

Code: Select all

Advanced tagging

For advanced tagging you can use commands instead of
static text in the fields. This is very useful to track-titles
which almost never will be equal to another one. Some examples:

Filename is 'artist - title.mp3'. Command to grab title will be:
exe:echo 'FILENAME' | awk -F ' - ' '{print \$2}'

Album might be the name of the directory:
exe:echo 'DIRNAME'

Track-title in an e-book could be named like this:
exe:echo 'Mybook - Track COUNT'

And then the rules:
- Line must start with exe:
- Builtin variables are FILENAME, DIRNAME and COUNT
- Never use "
- Place a \ in front of $

Image

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#3 Post by Flash »

Thanks, Zigbert, I'll try it. :) I think I did tinker around with it a while back. I don't remember what the results were.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#4 Post by zigbert »

Flash wrote:I think I did tinker around with it a while back. I don't remember what the results were.
Pmusic has evolved quickly the last year, and that often leads to bugs. Things has started to settle, and focus is switched to stabilizing.... Please report any issues.


Thank you
Sigmund

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#5 Post by Flash »

Okay, here are the early results. Yesterday I installed the latest Pmusic 2.4.4.1 and tried it but the results were the same so I didn't save it when I shut down. I'll just report here on the version that came with Racy Puppy 5.2.1.90 (Pmusic 2.2.1).

First, I find it difficult to understand what everything means. That is due to my own ignorance of what the terms mean, such as Playlist, Music sources, etc.. Perhaps you could include a list of terms and their definitions?

Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX. The first one should be 01 - 64, the second one 02 - 64, and so on to 64 - 64. Clicking the column headings didn't change anything. For a second after they begin to load into the playlist window, they are properly numbered and in order, but after a few seconds they change to what you see in the first attachment.

Thinking that tagging them might reorder them properly, I clicked "Tag all tracks in list" then filled in what I thought were the fields I cared about. The result is as you see in the second attachment.

So the first problem is, it appears that Pmusic can't properly display more than 20 or 40 tracks in a directory, or am I doing something wrong? Be advised that some audiobooks have well over a thousand tracks.

I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.

I didn't think to try selecting all the files in the ROX directory and dragging them into Pmusic's playlist window. Would that work in Pmusic 2.4.4.1?
Attachments
Pmusic tag-all-tracks-in-directory.jpg
(92.99 KiB) Downloaded 913 times
Pmusic tag-all-tracks result.jpg
(164.93 KiB) Downloaded 895 times

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#6 Post by zigbert »

Flash
Reading the Pmusic changelog, version 2.2.1 should be fine
First, I find it difficult to understand what everything means. That is due to my own ignorance of what the terms mean, such as Playlist, Music sources, etc.. Perhaps you could include a list of terms and their definitions?
I do not advertise my english skills, so any improvement are welcome. Regarding 'playlist' and 'music-sources', these terms are taken from other audio-players, because I am not the man to find any better.
Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX
Will look into this.
So the first problem is, it appears that Pmusic can't properly display more than 20 or 40 tracks in a directory, or am I doing something wrong? Be advised that some audiobooks have well over a thousand tracks.
The Pmusic 'Playlist' struggles when displaying many tracks. How many depends on the system you are running. For me that is 300-400. On the other hand, the 'Music-Source' list are able to show my 24000 tracks in a blink of an eye. You can tag all tracks in this list as well (see Music-Source menu).
I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.
The list is the id3-genre-standard, and has most focus on music. But, it would be logical to accept manual entries. I have added it to the todo list.
I didn't think to try selecting all the files in the ROX directory and dragging them into Pmusic's playlist window. Would that work in Pmusic 2.4.4.1?
You're correct - It would not.


Thank you for the feedback.
I will make an update, and hopefully be able to tag your books in some near future.
Sigmund

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#7 Post by Flash »

zigbert wrote:I do not advertise my english skills, so any improvement are welcome. Regarding 'playlist' and 'music-sources', these terms are taken from other audio-players, because I am not the man to find any better.
I'll work on suggested definitions as I grow to understand them myself.
Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX
Will look into this.
... the 'Music-Source' list are able to show my 24000 tracks in a blink of an eye. You can tag all tracks in this list as well (see Music-Source menu).
Ah, I didn't realize this. Thanks, I'll try it.
Thank you for the feedback.
I will make an update, and hopefully be able to tag your books in some near future.
Sigmund
Thank you. :) By the way, would you rather we continue this discussion in the Pmusic thread?

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#8 Post by zigbert »

Flash
I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.
I am NOT able to tag a not-supported genre-tag with id3tag. - Which is the tagging command used in Pmusic. You might skip this, or use some tag close enough (101 - speech) ??? It is possible to add a comment-tag, but I have skipped this for Pmusic (so far).

From your screenshots, I understands that the term 'Track' is completely insane, as it easily is seen as the name of the track (Title is meant for this). Now called 'Track Nr' as it represent the number of the track in the album list. So the correct command for auto-tagging 'Track Nr' should be

Code: Select all

exe:echo 'COUNT'
or

Code: Select all

exe:echo 'COUNT - 64'
Anyway, I finally got the 64 tracks of the audio book into the Playlist window, but as you can see, they didn't list in the same order as they do in ROX
Ok, Pmusic will add the tracks to 'Playlist' in the same order as shown in 'Music-Source' list. If sort order is not correct in search-result or in browser (I check here, and browsing seems to work ok.), you can sort by filename or tags from the 'Music-Source' menu to override this. This is of course very helpful when masstagging track numbers. Correct sort order is the only way to get correct track-number-tag.



I don't really care in what thread we meet :D
Sigmund

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#9 Post by Flash »

Since Racy Puppy has id3tag, I thought I'd play around with it a bit. I didn't get far because I couldn't find a way to see what I'd done. How does one "read" the id3tag of a mp3 file?

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#10 Post by SFR »

Flash wrote:Since Racy Puppy has id3tag, I thought I'd play around with it a bit. I didn't get far because I couldn't find a way to see what I'd done. How does one "read" the id3tag of a mp3 file?
Don't know about Racy, but Lupu has id3info:

Code: Select all

id3info "song name.mp3"

I might also point out that there is nothing like "Audiobook" in the selection of genres. I entered it manually but I don't think it took.
The list is the id3-genre-standard, and has most focus on music. But, it would be logical to accept manual entries. I have added it to the todo list.


Until then, DeadBeef supports custom genres. And Pmusic displays them correctly.

HTH
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#11 Post by zigbert »

If someone could help out, it seems rather easy to skip the id3-lib and edit the tags on-the-fly. Look at this:

1.) This is the tag info of my Stage Dolls track using id3info
# id3info ./Stage\ dolls\ -\ Wings\ of\ steel.mp3
*** Tag information for ./Stage dolls - Wings of steel.mp3
=== TIT2 (Title/songname/content description): Wings of Steel
=== TPE1 (Lead performer(s)/Soloist(s)): Stage Dolls
=== TALB (Album/Movie/Show title): Stage Dolls
=== TYER (Year): 198
=== TRCK (Track number/Position in set): 4



2.) Now let's look at the file directly using cat.
# cat -A ./Stage\ dolls\ -\ Wings\ of\ steel.mp3 | grep ID3
ID3^D^@^@^@^@^@{TPE1^@^@^@^M^@^@^CStage Dolls^@TALB^@^@^@^M^@^@^CStage Dolls^@TIT2^@^@^@^P^@^@^CWings of Steel^@TRCK^@^@^@^C^@^@^C4^@TDRL^@^@^@^F^@^@^C1988^@TSSE^@^@^@^L^@^@^CLavf53.4.0^@M-^?M-{0^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Xing^@^@^@^G^@^@^^M-m^@KM-=.^@^C^E^H$
^VT^B`T'IjM-S^Y*,jM-vM-TM-s^\M-^BQM-lV#UM-d^VM-MM-aM-^J^LXSM-CM-RM-=uM-[M-^ZM-PM-:M-YM-|DM-^U)M-`fM-{UY^[M-=M-+M-^LM-6M-!bM-^J#0M-^PM-,E|^N^ZM-^ID3M-%YNM-GM-bG(5M--M-C'^\M-^BM-HM-T^UM-4M-i^H^PM-*M-OrsWM-%M-H^XM-TM-D^RM-iM-KM-_M-^MK!M-wM-|M-^_M-_M-vM-!pnM-LM-^RM-&vg5^VM-^WM-FN<H^D5bM-WM-n^RM-#M-~rOM-^IO!M-&^TM-^?M-{M-2dM-n^HM-^UM-.jYS^OKpM-^DLM-;!=M-^FnUM-IM-+`LM-=-M-AM-^QM-0mTM-tM-^UM-8M-^BM-JM-^WM-3M-6M-.'^\M-~M-^OM-;M-^IM-!M-^M]"iNM-^_QM-^U^QM-Y]M-4M-Z\M-^EM-4M-^Y^Y^Y-M-Iwm^UM-*/4M-"M-5TvM->M-m^?M-5UM-UM-^NM-|M-~M-^?M-^MM-wM-|UwM-5M-(M-uM-;M-^UM-QM-ZgiM-^PM-7i^SM-Jk.M-JM-^HM-wJu:M- MM-M-^QNM-^ZM-3ZM-eM-wvM-hM-H->M-^EM-)TM-ZM-XM-O#|yM-^ZM-wM-P[XM-OE^DM-^P$



3.) What if we change the first 'Stage' to 'Puppy'
# sed -i "s/Stage/Puppy/" ./Stage\ dolls\ -\ Wings\ of\ steel.mp3


4.) And the result is just what we want....
# cat -A ./Stage\ dolls\ -\ Wings\ of\ steel.mp3 | grep ID3
ID3^D^@^@^@^@^@{TPE1^@^@^@^M^@^@^C
Puppy Dolls^@TALB^@^@^@^M^@^@^CStage Dolls^@TIT2^@^@^@^P^@^@^CWings of Steel^@TRCK^@^@^@^C^@^@^C4^@TDRL^@^@^@^F^@^@^C1988^@TSSE^@^@^@^L^@^@^CLavf53.4.0^@M-^?M-{0^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Xing^@^@^@^G^@^@^^M-m^@KM-=.^@^C^E^H$
^VT^B`T'IjM-S^Y*,jM-vM-TM-s^\M-^BQM-lV#UM-d^VM-MM-aM-^J^LXSM-CM-RM-=uM-[M-^ZM-PM-:M-YM-|DM-^U)M-`fM-{UY^[M-=M-+M-^LM-6M-!bM-^J#0M-^PM-,E|^N^ZM-^ID3M-%YNM-GM-bG(5M--M-C'^\M-^BM-HM-T^UM-4M-i^H^PM-*M-OrsWM-%M-H^XM-TM-D^RM-iM-KM-_M-^MK!M-wM-|M-^_M-_M-vM-!pnM-LM-^RM-&vg5^VM-^WM-FN<H^D5bM-WM-n^RM-#M-~rOM-^IO!M-&^TM-^?M-{M-2dM-n^HM-^UM-.jYS^OKpM-^DLM-;!=M-^FnUM-IM-+`LM-=-M-AM-^QM-0mTM-tM-^UM-8M-^BM-JM-^WM-3M-6M-.'^\M-~M-^OM-;M-^IM-!M-^M]"iNM-^_QM-^U^QM-Y]M-4M-Z\M-^EM-4M-^Y^Y^Y-M-Iwm^UM-*/4M-"M-5TvM->M-m^?M-5UM-UM-^NM-|M-~M-^?M-^MM-wM-|UwM-5M-(M-uM-;M-^UM-QM-ZgiM-^PM-7i^SM-Jk.M-JM-^HM-wJu:M- MM-M-^QNM-^ZM-3ZM-eM-wvM-hM-H->M-^EM-)TM-ZM-XM-O#|yM-^ZM-wM-P[XM-OE^DM-^P$



# id3info ./Stage\ dolls\ -\ Wings\ of\ steel.mp3
*** Tag information for ./Stage dolls - Wings of steel.mp3
=== TIT2 (Title/songname/content description): Wings of Steel
=== TPE1 (Lead performer(s)/Soloist(s)):
Puppy Dolls
=== TALB (Album/Movie/Show title): Stage Dolls
=== TYER (Year): 198
=== TRCK (Track number/Position in set): 4




But it is not THAT straightforward. The ID3 information (using cat) also someway shows how many bytes used for the specific tag. If I change 'Stage' to 'Pup' the tag gets corrupted. If someone can tell how the calculation works, we could probably get our own tagger. - With the features we require. Also libid3(tag) is 780kb uncompressed in the latest Slacko.


Sigmund

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#12 Post by Flash »

I've discovered that neither id3tag nor id3info will work if there are spaces in the filename. :evil:

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#13 Post by RSH »

Flash wrote:I've discovered that neither id3tag nor id3info will work if there are spaces in the filename. :evil:
Do use escapes '\' id3info ./Stage\ dolls\ -\ Wings\ of\ steel.mp3.
jpeps did show me this one.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#14 Post by zigbert »

This might be a better solution

Code: Select all

ffmpeg -i ./Stage\ dolls\ -\ Wings\ of\ steel.mp3 -acodec copy -metadata genre=audiobook -y /tmp.mp3
mv -f /tmp.mp3 ./Stage\ dolls\ -\ Wings\ of\ steel.mp3
I have not compared the speed with libid3
At the moment, it supports only m4a, mp3, wma and rm.


Sigmund

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#15 Post by Flash »

RSH wrote:
Flash wrote:I've discovered that neither id3tag nor id3info will work if there are spaces in the filename. :evil:
Do use escapes '\'
Thanks. I didn't realize what the backslashes were for. :oops:

Zigbert, I'll try your solution soon. Tomorrow I hope. :)
(How do you make any sense out of ffmpeg --help? It's a thousand options all jumbled together in no apparent order. I couldn't find the -i option.)

User avatar
trapster
Posts: 2117
Joined: Mon 28 Nov 2005, 23:14
Location: Maine, USA
Contact:

#16 Post by trapster »

My post Here is how I tagged my 6000+ .ogg files. I just needed Artist-Title.ogg.

I haven't tried to tag my mp3s.
trapster
Maine, USA

Asus eeepc 1005HA PU1X-BK
Frugal install: Slacko
Currently using full install: DebianDog

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#17 Post by Flash »

Thanks. I convert to mp3 files because every mp3 player will play them but most won't play ogg files.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#18 Post by Flash »

Okay, the latest version of Pmusic (2.5.0) displays the filenames correctly. I tried tagging the files but I'm not sure it worked.

First, I installed Pmusic 2.5. Then I opened Pmusic from Menu -> Multimedia (may I suggest that the version - 2.5.0 in this case - be added to Pmusic's name in the title bar of the GUI?) Pmusic took several seconds to open. That's surprising, since it is such a small program and my multisession Puppy runs entirely in RAM. The first time I tried to open Pmusic, the delay made me think it wasn't going to open.

In the left pane of Pmusic, I navigated to the directory where the files were (in this case, /tmp/Carlson, Ron/The Signal, where there were 79 mp3 files), by clicking the double-dot thing at the top of the list, then clicking the appropriate directories. Everything looked good to Tag all tracks in list, so I clicked on that option in the drop-down Music sources menu. You can see in the screenshot how I filled out the blanks.

Pmusic took a while to tag all 79 files. When that was finished, I clicked the + Add all option in Pmusic's Music-sources drop-down menu, to add the tracks to the playlist. As you can see from the second screenshot, the first file is actually named 2 - 79. There is no 1 - 79. Is this because of the double-dot thing at the top of the left list? I confirmed that the track that was tagged 2 - 79 is actually the file named 01 - 79 by playing it.

Gxine used to show the id3 info for the track, but neither Mplayer nor ogle do, so I looked at the second file (02 - 79) with id3info:

Code: Select all

# id3info 02\ -\ 79.mp3

*** Tag information for 02 - 79.mp3
*** mp3 info
MPEG2/layer III
Bitrate: 8KBps
Frequency: 22KHz
# 
It doesn't look like Pmusic tagged the file. :?
Attachments
Pmusic Tag all tracks entries.png
(28.14 KiB) Downloaded 527 times
Pmusic playlist after tagging all files.png
(53.96 KiB) Downloaded 480 times

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#19 Post by zigbert »

Flash
Great report - we are very close now :D

I see the problem with starting count by 2.
That should be fixed in the func_id3tagger attached. Replace it with the one in /usr/local/pmusic/.
It doesn't look like Pmusic tagged the file.
It sure did. That is what we see in the playlist in your screenshot. To verify, you can see that tags by the command

Code: Select all

ffmpeg -i "file"
Look for the section - metadata.

I don't know what version ffmpeg prefers of the id3-standard (which isn't any standard at all). It could be the extended version 1, which is probably not supported by id3info. Please post the ffmpeg output, and it could maybe give some answers....


Sigmund
Attachments
func_id3tagger.gz
(1.75 KiB) Downloaded 366 times

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#20 Post by zigbert »

Code: Select all

# id3info 02\ -\ 79.mp3

*** Tag information for 02 - 79.mp3
*** mp3 info
MPEG2/layer III
Bitrate: 8KBps
Frequency: 22KHz
# 
It seems that id3info detects wrong bitrate for your file. I don't think you are listening to 8kb/sec. 'ffmpeg -i' will show bitrate as well.


Sigmund

Post Reply