Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.)

share|improve this question

6 Answers 6

up vote 22 down vote accepted

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"
share|improve this answer
    
For those on ffmpeg still, ffprobe does the same. –  Victor Sergienko Jul 2 at 23:11
    
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 –  DmitrySandalov Oct 24 at 11:31

exiftool

This might be a surprise, but exiftool from libimage-exiftool-perl Install 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.

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)
share|improve this answer
    
very nice. can be used for images too. (for avi files: no audio bitrate. but a lot of other info) –  cipricus Feb 1 '13 at 13:34

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.

share|improve this answer

I am using mediainfo to get all properties of media file ( 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                           : High@L4.0
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

Source : http://mediainfo.sourceforge.net/en

To install it:

sudo add-apt-repository ppa:shiki/mediainfo
sudo apt-get update
sudo apt-get install mediainfo
share|improve this answer
    
You don't need a PPA any more. –  Stan Jul 19 at 8:26

I use the following for audio files:

id3v2 -l <filename>
soxi <filename>

Also soxi supports video files as well.

The id3v2 Install id3v2 and sox Install sox packages provide those commands. They can be installed in the Software Center or by running:

sudo apt-get install sox
sudo apt-get install id3v2
share|improve this answer
2  
id3v2 -l merely displays ID3 tags, soxi supports a limited number of audio and video formats. –  Sadi Jan 31 '13 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? –  cipricus Jan 31 '13 at 16:12

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.

share|improve this answer
4  
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 '13 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. –  Eliah Kagan Jan 31 '13 at 15:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.