86

I need a command to quickly see in terminal essential information about an audio or video file.

(Then I'll consider adding that to Thunar's custom actions, etc.)

1

7 Answers 7

82

avprobe from the package libav-tools is pretty good.

Sample output avprobe somefile.mp4

avprobe version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2007-2012 the Libav developers
  built on Nov  6 2012 16:51:33 with gcc 4.6.3
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'somefile.mp4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: isomavc1
    creation_time   : 2012-08-10 15:01:14
  Duration: 00:01:02.55, start: 0.000000, bitrate: 682 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1904x1040 [PAR 1:1 DAR 119:65], 680 kb/s, 19.18 fps, 20 tbr, 20 tbn, 40 tbc
    Metadata:
      creation_time   : 2012-08-10 15:01:14

To add to Thunar custom action, in relation to what was suggested here, the analog formula to add would be:

gnome-terminal --window-with-profile=new1 -e "avprobe %f"
2
  • 21
    For those on ffmpeg still, ffprobe does the same. Jul 2, 2014 at 23:11
  • 2
    Didn't work for me to find out remote video info under proxy environment. This one worked: mplayer -vo null -ao null -identify -frames 0 http://example.com/myvideo.mkv Oct 24, 2014 at 11:31
57

I use mediainfo to get all properties of media files ( audio and video files )

root@server:Videos::08:47 PM# mediainfo Vazquez.mp4 
General
Complete name                            : Vazquez.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
File size                                : 103 MiB
Duration                                 : 3mn 52s
Overall bit rate mode                    : Variable
Overall bit rate                         : 3 730 Kbps
Encoded date                             : UTC 2011-11-10 07:30:57
Tagged date                              : UTC 2011-11-10 07:30:57
gsst                                     : 0
gstd                                     : 232083
gssd                                     : B7AA66E45HH1322313268839354
gshh                                     : o-o.preferred.bhartibb-blr1.v12.lscache7.c.youtube.com

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=24
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 3mn 52s
Bit rate                                 : 3 576 Kbps
Maximum bit rate                         : 5 947 Kbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 24.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.072
Stream size                              : 98.9 MiB (96%)
Tagged date                              : UTC 2011-11-10 07:30:58

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 3mn 52s
Bit rate mode                            : Variable
Bit rate                                 : 152 Kbps
Maximum bit rate                         : 188 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Compression mode                         : Lossy
Stream size                              : 4.20 MiB (4%)
Title                                    : IsoMedia File Produced by Google, 5-11-2011
Encoded date                             : UTC 2011-11-10 07:30:58
Tagged date                              : UTC 2011-11-10 07:30:58

mediainfo is now in Ubuntu repositories and can be installed by running

sudo apt install mediainfo

Previously it was necessary to use a PPA but this has no packages for current Ubuntu versions.

3
  • 4
    You don't need a PPA any more.
    – Stan
    Jul 19, 2014 at 8:26
  • also, if you pass . as a file name then mediainfo will recursively list all files in the current folder.
    – ccpizza
    Dec 28, 2018 at 23:40
  • exiftool has a ton more info, including geolocation. See also: superuser.com/a/1370421/425838, and the other answer here. Pipe to grep to quickly jump to the GPS lines and see the geo-tagging/geo-location of the photo as well: exiftool myphoto.jpg | grep GPS. Mar 6, 2021 at 23:12
28

exiftool

This might be a surprise, but exiftool from libimage-exiftool-perl has this capability as well.

It supports showing info from a lot of media file formats, and can write metadata too for some of these formats.

Installation

sudo apt install libimage-exiftool-perl

Example output for an audio file:

# exiftool The\ Police\ -\ Live\!\ Disc\ 2\ -\ Atlanta\ -\ 01.\ Synchronicity\ I.mp3 
ExifTool Version Number         : 9.13
File Name                       : The Police - Live! Disc 2 - Atlanta - 01. Synchronicity I.mp3
Directory                       : .
File Size                       : 3.9 MB
File Modification Date/Time     : 2012:03:23 19:44:23+01:00
File Access Date/Time           : 2012:12:26 11:44:38+01:00
File Inode Change Date/Time     : 2012:03:23 19:44:23+01:00
File Permissions                : rw-------
File Type                       : MP3
MIME Type                       : audio/mpeg
MPEG Audio Version              : 1
Audio Layer                     : 3
Sample Rate                     : 44100
Channel Mode                    : Joint Stereo
MS Stereo                       : On
Intensity Stereo                : Off
Copyright Flag                  : False
Original Media                  : True
Emphasis                        : None
VBR Frames                      : 6660
VBR Bytes                       : 4044318
VBR Scale                       : 57
Encoder                         : LAME3.96
Lame VBR Quality                : 4
Lame Quality                    : 3
Lame Method                     : VBR (old/rh)
Lame Low Pass Filter            : 18 kHz
Lame Bitrate                    : 32 kbps
Lame Stereo Mode                : Joint Stereo
Track                           : 1/15
Disc                            : 2/2
Artist                          : The Police
Title                           : Synchronicity I
Album                           : Live!
Year                            : 2003
Genre                           : Rock
Comment                         : Atlanta
Discid                          : c611270f
ID3 Size                        : 128
Audio Bitrate                   : 186 kbps
Date/Time Original              : 2003
Duration                        : 0:02:53 (approx)
2
  • very nice. can be used for images too. (for avi files: no audio bitrate. but a lot of other info)
    – user47206
    Feb 1, 2013 at 13:34
  • See also: superuser.com/a/1370421/425838. Pipe to grep to quickly jump to the GPS lines and see the geo-tagging/geo-location of the photo as well: exiftool myphoto.jpg | grep GPS. Mar 6, 2021 at 23:10
10

Depending on what you consider essential, you might want to use the file utility for this, which gives general information on any file. Its primary purpose is to tell you what type of file you have, but it may provide the level of detail you need.

$ file '01 - Nina Simone - Mood Indigo.mp3'
01 - Nina Simone - Mood Indigo.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo

However, if you need to know the contents of tags--title, artists, etc.--file will not tell you that.

1
  • And you do not have to install extra software for this.
    – jarno
    May 16, 2019 at 21:25
3

I knew about this command: avconv -i <filename>

For myfile.flv: avconv -i myfile.flv

My idea was to add that command to Thunar's custom actions and just run it from context menu no matter the extension. But it had to be run in terminal, so I took a look at this answer. (To open the terminal and keep it open, I created a new profile in gnome-terminal (Edit/Profiles) called "new1", and under Profile preferences/"Title and command" set it "When command exits" to "Hold the terminal open".)

In the end (by trial and error) I came up with this:

gnome-terminal --window-with-profile=new1 -e "avconv -i %f"

which works put in Thunar's custom actions - and should work for any media file.

2
  • 5
    avprobe and avconv use the same underlying library, and give you the same results, but avconv is the encoder so with this command you also get an error at the end At least one output file must be specified.
    – chronitis
    Jan 31, 2013 at 14:48
  • Anyone interested may want to see the chat discussion here. Topics include differences between different terminal apps, and different programs giving more or less desirable output depending on file type. Jan 31, 2013 at 15:25
3

There are also the following for audio files, although may not compete well with exiftool:

id3v2 -l <filename>
soxi <filename>

Also soxi supports video files as well.

The id3v2 and sox packages (which can be installed by clicking these links) provide those commands. They can also be installed in the Software Center, or by running:

sudo apt-get install sox
sudo apt-get install id3v2

An example: id3v2 -l 'Beatles - Here Comes The Sun.mp3' output:

id3v1 tag info for Beatles - Here Comes The Sun.mp3:
Title  : Here Comes The Sun              Artist: Beatles                       
Album  : Abbey Road                      Year: 1969, Genre: Pop (13)
Comment:                                 Track: 7
id3v2 tag info for Beatles - Here Comes The Sun.mp3:
TIT2 (Title/songname/content description): Here Comes The Sun
TYER (Year): 1969
TPUB (Publisher): Capitol
TCON (Content type): Pop (13)
TALB (Album/Movie/Show title): Abbey Road
PRIV (Private frame):  (unimplemented)
PRIV (Private frame):  (unimplemented)
TRCK (Track number/Position in set): 7
PRIV (Private frame):  (unimplemented)
PRIV (Private frame):  (unimplemented)
PRIV (Private frame):  (unimplemented)
PRIV (Private frame):  (unimplemented)
TPE2 (Band/orchestra/accompaniment): The Beatles
PRIV (Private frame):  (unimplemented)
PRIV (Private frame):  (unimplemented)
PRIV (Private frame):  (unimplemented)
TCOM (Composer): George Harrison
TPE1 (Lead performer(s)/Soloist(s)): Beatles
3
  • 2
    id3v2 -l merely displays ID3 tags, soxi supports a limited number of audio and video formats.
    – Sadi
    Jan 31, 2013 at 16:07
  • when i run soxi some.mp3 i get no handler for file extension mp3. the same for avi. soxi supports a limited number of audio and video formats: THAT limited, or is there something more to do beside installing them?
    – user47206
    Jan 31, 2013 at 16:12
  • Other answers give exemplary output. Would be nice to see this here, too.
    – Felix
    Dec 6, 2017 at 6:34
0

If you are using Ubuntu Xfce with Thunar then this will work in the custom actions:

xfce4-terminal --hold -e "avprobe %f"

You must log in to answer this question.