Setting ID3 title tag to be equal to MP3 file name

460

Solution 1

EasyTAG is indeed a great tool for this problem. I found my answer here. In terms of how to use it, the best reference turns out to be EasyTAG’s own documentation.

Open EasyTag, navigate to a folder with music files in it, select all the files in the folder, or all the files you want to tag, click on the "Scan Files" button (you'll have to hover over them to figure out which one it is).

Then, make sure the scanner dropdown is set to "Fill Tag," then in the Fill Tag field, make the appropriate edits until the example below the field looks like what you're looking for. If you need further help as to what to put in the Fill Tag field, click on the "?" button for the legend (listing of what the different possible codes are to translate with) and hit the mask button to list some starting points.

When you're happy with the results, click the "Scan Files" button (in the Scan Files dialog box, not the one you originally clicked to get where you are...the icons look the same) and your changes will be applied. If you are not getting Artist or Album name, simply select all that you want to change, enter the data and click the little button next to that field and all files that are selected will the filled in or changed to that artist or album. This works in most fields.

When you're done, click the save button and you're done.

PS: The CDDB scanner often works pretty well, if you have full albums that you're trying to tag, or at least commercially available song files.

PPS: I am apparently half awake still. According to what you wrote in your original post, try this in the Fill Tag field:

%n. %a - %t

Here's the section that is relevant to this question:


1.2.2. Automatically with “Fill Tag” scanner:

Some conditions to use this mode:

  • files sorted by albums
  • filenames or parent directory contain tag information (artist, album, title, …)
  • empty or not correct tags

The “Fill Tag” scanner uses a pattern to associate words in the filename and directories with the tag entries. By this way, the tag fields can be completed automatically by pressing the “green” button in the scanner window or the toolbar. If the tag is partially completed, use the option “Overwrite fields when scanning tag” in the “Scanner” tab of the “Preferences” window, to replace all fields by the new values.

Each code correspond to a field, following theses rules :

Strings associated with code    Will fill the field
%a
  Artist
%b
  Album
%c
  Comment
%p
  Composer
%r
  Copyright
%e
  Encoded by
%g
  Genre
%i
  None! (used to ignore a string)
%l
  Number of tracks
%o
  Original artist
%n
  Track
%t
  Title
%u
  URL
%y
  Year

Note : to avoid mistakes, it is recommended to use a code only one time in the pattern. Of course, like when tagging manually, only the selected files are processed by the scanner. You can use the defined patterns in the list, or write yours own patterns to correspond to the format of yours file names and directories. To avoid mistakes when selecting the right pattern, or writing it, a preview shows immediately the results before to apply the pattern. If you need some help with the different codes, press the “Help” button (the lifebuoy) to display the legend of each code. Also, if you want to save yours own patterns, edit or sort then, by pressing the “Mask” button an little editor will be shown on the scanner window.

Below an example of use of patterns :

a) the following filename :

“/mnt/MP3/EVANESCENCE – Fallen (2003) – Rock/01. Going Under.mp3”

b) with the pattern :

“%a - %b (%y) - %g/%n. %t”

c) you will fill the tag with theses strings :

    Artist (%a) => EVANESCENCE
    Album (%b) => Fallen
    Year (%y) => 2003
    Genre (%g) => Rock
    Track (%n) => 01
    Title (%t) => Going Under

Solution 2

I have found a variety of command line tools to be useful:

id3v2

id3v2 is a command line id3v2 tag editor. You can add/modifiy/delete id3v2 tags and convert id3v1 tags to id3v2 tags. It's uses id3lib. I'm looking for a co-maintainer. Please email myers_carpenter if you are interested.

eyeD3

eyeD3 is a Python module and program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3 v1.0/v1.1 and v2.3/v2.4.

these are ideal when scripting something to scan directories.

Solution 3

EasyTAG does all sorts of common batch tag/filename operations on audio (and some video) files.

Solution 4

This doesn't always get it exactly perfect, but I have used it to get the names of mp3 files using only common unix tools (including the busybox versions) Perhaps someone with more than just 6 Tom Petty mp3s can give it some further testing.

for x in *.mp3; do
  TITLE=$(strings "$x" |grep TAG |grep -v TAGL |sed "s/^.*TAG//g ; /^L$/d ; /^@$/d ; /^$/d ; /^Ac$/d")
  #mv "$x" "$TITLE.mp3"
  echo $x" "$TITLE.mp3" #just echo for now, until further tested
done

Edit: I misread the question, but knowing this above we can use sed to replace $TITLE with the name of the file "$x" by using sed to replace the string in place

sed -i "s/$TITLE/$x/" "$x"

I am almost 100% sure this does not meet all of the ID3 spec, but it may suffice for basic personal use as long as you make a backup first

Solution 5

For Ubuntu 18.04 LTS (I assume all Debian flavors will run this just fine):

  • Install eyeD3 with sudo apt install eyeD3

  • Create a file for bash script (I used "touch"; you can use whatever text editor you like)

  • Copy this and paste it into file:

    Copies file name and writes it to the Title tag

    for x in *; do
        eyeD3 --title="${x%.*}" "$x"
        echo $a
    done
    

    If you don't care to view the progress, omit the line echo $a above the word "done".

  • Make the file executable:

    chmod +x filename
    
  • Copy the script to the directory you want it to run in – the one containing your media files; for example:

    cp filename /music/directory
    
  • Navigate to the directory you just copied the script to:

    cd /music/directory
    
  • Run the script:

    ./filename
    

    DONE

It worked for me on Ubuntu 18.04 LTS – my wife wrote this for me in about 3 minutes, so I can't answer any questions if it doesn't work for you; I am not programmer savvy, I am setup this web, dns, ssh,sftp,ftp,AD/Domain, file,firewall,router/server kinda guy:-) I HATE doing scripting, programming and anything like it. I LOVE taking advantage of scripting, programming and anything like it:-)

Share:
460

Related videos on Youtube

Yvan
Author by

Yvan

Updated on September 18, 2022

Comments

  • Yvan
    Yvan almost 2 years

    I imagine to create a route for a "dev" component and lock this route in production mode but I don't have any idea to do this.

    Someone can show me in the main lines how can I do that?

    Thx

    • iglvzx
      iglvzx over 12 years
      You may answer your own question. List the steps you found on ubuntuforums.org and cite your source. :) This will help future visitors to Superuser, in the case that the ubuntuforums.org link becomes unavailable.
    • slhck
      slhck over 12 years
      Here are a few tips: 1) Don't clutter your question with "edit 1", "edit 2", etc. Resolve problems using comments. 2) If you find a solution, post it as an answer, as if you were trying to answer someone else's question. Don't put the answer into the question. That's not where people look for it :) Also, use blockquotes for anything you quote from somewhere else (see the formatting help).
    • Günter Zöchbauer
      Günter Zöchbauer over 7 years
    • Yvan
      Yvan over 7 years
      Thx @GünterZöchbauer I will take a look of this topic!
    • Zach Saucier
      Zach Saucier over 4 years
      I made a script to correctly tag MP3 files in the format "Artist - Track.mp3" and then rename the file to "Track.mp3": gist.github.com/ZachSaucier/f51e608ac75e8ed6e96cd54a9ec103b0 using eyed3
  • Aspartame_Xu
    Aspartame_Xu over 12 years
    Thanks. I found a way to accomplish my goal using EasyTAG, but your reply actually answers my original question best. strings is a good utility to know about. (I haven't used it before.) Could you post a complete solution based on your edit so I can be sure I understand the suggested change?