2

How to extract details like the location of the song,artist,album,bitrate,year,genre.. etc using linux command? I have tried mp3info, but it didn't give much information. Please Help. Thank you!

1
  • @karel Sure, it's a duplicate. But it has better answers.
    – A.B.
    Aug 5, 2015 at 16:23

4 Answers 4

8

Did you read man mp3info? It says, in part:

     -p "FORMAT_STRING"

          Print MP3 attributes according to FORMAT_STRING.  FORMAT_STRING is similar to a printf(3) format string in that it is printed verbatim except  for  the
          following conversions and escape sequences. Any conversion specifier may optionally include the various alignment, precision, and field width modifiers
          accepted by printf(3).  See the EXAMPLES section below for examples of how format strings are used in mp3info.

          Conversion Specifiers

             %f     Filename without the path [string]
             %F     Filename with the path [string]
             %k     File size in KB [integer]
             %a     Artist [string]
             %c     Comment [string]
             %g     Musical genre [string]
             %G     Musical genre number [integer]
             %l     Album name [string]
             %n     Track [integer]
             %t     Track Title [string]
             %y     Year [string]
             %C     Copyright flag [string]
             %e     Emphasis [string]
             %E     CRC Error protection [string]
             %L     MPEG Layer [string]
             %O     Original material flag [string]
             %o     Stereo/mono mode [string]
             %p     Padding [string]
             %v     MPEG Version [float]
             %u     Number of good audio frames [integer]
             %b     Number of corrupt audio frames [integer]
             %Q     Sampling frequency in Hz [integer]
             %q     Sampling frequency in kHz [integer]
             %r     Bit Rate in kbps (type and meaning affected by -r option)
             %m     Playing time: minutes only [integer]
             %s     Playing time: seconds only [integer] (usually used in conjunction with %m)
             %S     Total playing time in seconds [integer]
             %%     A single percent sign
1
  • 4
    New users should read the man page, which I showed how to do. The man page (man mp3info) has more examples than most man pages.
    – waltinator
    Aug 5, 2015 at 15:41
3

Also from man mp3info

Display the Title, Artist, Album, and Year of all MP3 files in the cur‐ rent directory. We include the labels File, etc. and insert newlines (\n) to make things more readable for humans:

mp3info -p "File: %f\nTitle: %t\nArtist: %a\nAlbum: %l\nYear: %y\n\n" *.mp3

More options

-p "FORMAT_STRING"

    Print MP3 attributes according to FORMAT_STRING.  FORMAT_STRING
    is similar to a printf(3) format string in that it is printed
    verbatim except for  the following conversions and escape sequences.
    Any conversion specifier may optionally include the various
    alignment, precision, and field width modifiers accepted by
    printf(3). 
    See the EXAMPLES section below for examples of how format 
    strings are used in mp3info.

Conversion Specifiers

     %f     Filename without the path [string]
     %F     Filename with the path [string]
     %k     File size in KB [integer]
     %a     Artist [string]
     %c     Comment [string]
     %g     Musical genre [string]
     %G     Musical genre number [integer]
     %l     Album name [string]
     %n     Track [integer]
     %t     Track Title [string]
     %y     Year [string]
     %C     Copyright flag [string]
     %e     Emphasis [string]
     %E     CRC Error protection [string]
     %L     MPEG Layer [string]
     %O     Original material flag [string]
     %o     Stereo/mono mode [string]
     %p     Padding [string]
     %v     MPEG Version [float]
     %u     Number of good audio frames [integer]
     %b     Number of corrupt audio frames [integer]
     %Q     Sampling frequency in Hz [integer]
     %q     Sampling frequency in kHz [integer]
     %r     Bit Rate in kbps (type and meaning affected by -r option)
     %m     Playing time: minutes only [integer]
     %s     Playing time: seconds only [integer] (usually used in conjunction with %m)
     %S     Total playing time in seconds [integer]
     %%     A single percent sign

Escape Sequences

     \n Newline 
     \t Horizontal tab 
     \v Vertical tab 
     \b Backspace 
     \r Carriage Return 
     \f Form Feed 
     \a Audible Alert (terminal bell) 
     \xhh Any arbitrary character specified by the hexidecimal number hh 
     \ooo Any arbitrary character specified by the octal number ooo 
     \\ A single backslash character
1

You can use mediainfo:

sudo apt-get update && sudo apt-get install mediainfo

You can extract all sorts of informations using the --inform='<category>;%<parameter1>%[%<parameter2>%, ...]' option; <category> is a string representing a category of parameters and <parameterN> is a string representing a parameter in that category; both categories and parameters available can be listed by running mediainfo --Info-Parameters; for example, to extract the album and the title of a track in an Album - Title format:

mediainfo --Inform='General;%Album% - %Title%' track01.mp3
0
ffprobe <themp3file.mp3>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .