6

Is it possible, via command line (shell command), to check for properties of a file (like when I right click on a file via Nautilus).

Specifically, given an mp3 audio file, I would like to know how I can extract the info related to title and artist from the audio section of its properties.

1
  • for your information those(Artist Name/Song Title) are called metadata and not properties.
    – user257256
    Jun 7, 2015 at 18:58

2 Answers 2

5

If you want a more complete output of the metadata you can use mediainfo or exiftool.

exiftool

To use exiftool simply use the command:

exiftool file.mp3

if it not yet installed, you can install it using:

sudo apt install libimage-exiftool-perl

Output sample:

exiftool 10.\ Trova\ Di\ Danú.mp3 
ExifTool Version Number         : 10.10
File Name                       : 10. Trova Di Danú.mp3
Directory                       : .
File Size                       : 6.7 MB
File Modification Date/Time     : 2009:03:06 02:21:58-03:00
File Access Date/Time           : 2017:11:10 09:41:16-03:00
File Inode Change Date/Time     : 2017:11:10 09:41:14-03:00
File Permissions                : rwxrwxrwx
File Type                       : MP3
File Type Extension             : mp3
MIME Type                       : audio/mpeg
MPEG Audio Version              : 1
Audio Layer                     : 3
Audio Bitrate                   : 192 kbps
Sample Rate                     : 44100
Channel Mode                    : Joint Stereo
MS Stereo                       : On
Intensity Stereo                : Off
Copyright Flag                  : False
Original Media                  : True
Emphasis                        : None
ID3 Size                        : 1422
Encoded By                      : 
User Defined URL                : 
Copyright                       : 
Title                           : Trova Di Danú
Album                           : Trova di Danú
Year                            : 2004
Track                           : 10
Comment (esl)                   : Subido por Davisote
Genre                           : Folk Metal
Composer                        : 
Original Artist                 : 
Artist                          : Tuatha de Danann
Comment                         : ICQ 12126479
Date/Time Original              : 2004
Duration                        : 0:04:50 (approx)

mediainfo

To use mediainfo simply use the command:

mediainfo file.mp3

To install it:

sudo add-apt-repository ppa:shiki/mediainfo 
sudo apt-get update 
sudo apt-get install mediainfo

Output sample:

mediainfo 10.\ Trova\ Di\ Danú.mp3 
General
Complete name                            : 10. Trova Di Danú.mp3
Format                                   : MPEG Audio
File size                                : 6.65 MiB
Duration                                 : 4mn 50s
Overall bit rate mode                    : Constant
Overall bit rate                         : 192 Kbps
Album                                    : Trova di Danú
Track name                               : Trova Di Danú
Track name/Position                      : 10
Performer                                : Tuatha de Danann
Genre                                    : Folk Metal
Recorded date                            : 2004
Writing library                          : LAME3.96
Comment                                  : Subido por Davisote / ICQ 12126479

Audio
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Mode                                     : Joint stereo
Duration                                 : 4mn 51s
Bit rate mode                            : Constant
Bit rate                                 : 192 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Stream size                              : 6.65 MiB (100%)
Writing library                          : LAME3.96
0
4

use the command

mp3info -p %a %t file.mp3
  • %a for artists
  • %t for track title

if mp3info is not installed in you system

sudo apt-get install mp3info

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