Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

How can I get information about a video with a command-line tool? (e.g. video duration, audio codec, bitrate etc)

share|improve this question

marked as duplicate by Radu Rădeanu, Basharat Sialvi, Kevin Bowen, psusi, Jorge Castro Jun 3 '13 at 19:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Yes, I said that in the answer and I flagged the question as it. – Leo Jun 3 '13 at 12:03
Yes, unfortunately I didn't see that question even tough I searched for something similar in the portal before. Sorry! :P – franzlorenzon Jun 3 '13 at 12:16
up vote 26 down vote accepted

You have several commands to get that information:

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':  
    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
    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"

Source: Command to see media file info in terminal? (then, duplicated).

And also you have:

You can use MPlayer to get that information.

$ mplayer -vo null -ao null -identify -frames 0 foo.avi


share|improve this answer
On MacOSX /w Homebrew: brew install libav will get you the avprobe binary. – Darian Moody Jul 1 '15 at 11:29
On a side note, why would avprobe send its output to stderr instead of stdout? – Jose Gómez Apr 24 at 16:08

There are several ways to achieve this. Here are three methods, using three different utilities.

Using exiftool

  1. Install libimage-exiftool-perl using the command sudo apt-get install libimage-exiftool-perl.
  2. Run exiftool /path/to/file
  3. The output you get is similar to this:

    ExifTool Version Number         : 9.04
    File Name                       : filename.avi
    Directory                       : Path/To/File
    File Size                       : ### MB
    File Modification Date/Time     : 2013:04:14 10:46:51+04:00
    File Access Date/Time           : 2013:05:19 09:21:08+04:00
    File Permissions                : rwxrwxr--
    File Type                       : AVI
    MIME Type                       : video/x-msvideo
    Frame Rate                      : 25
    Max Data Rate                   : 0 kB/s
    Frame Count                     : 105154
    Stream Count                    : 2
    Stream Type                     : Video
    Video Codec                     : xvid
    Video Frame Rate                : 25
    Video Frame Count               : 105154
    Quality                         : 10000
    Sample Size                     : Variable
    Image Width                     : 640
    Image Height                    : 360
    Planes                          : 1
    Bit Depth                       : 12
    Compression                     : XVID
    Image Length                    : 1382400
    Pixels Per Meter X              : 0
    Pixels Per Meter Y              : 0
    Num Colors                      : Use BitDepth
    Num Important Colors            : All
    Audio Codec                     : 
    Audio Sample Rate               : 41.67
    Audio Sample Count              : 175252
    Encoding                        : MP3
    Num Channels                    : 2
    Sample Rate                     : 48000
    Avg Bytes Per Sec               : 16000
    Bits Per Sample                 : 0
    Stream Name                     :
    Duration                        : 1:10:06
    Image Size                      : 640x360


Using ffmpeg

  1. Install ffmpeg using the command sudo apt-get install ffmpeg.
  2. Run ffmpeg -i /path/to/file
  3. The output you get is similar to this:

    Input #0, avi, from 'Path/To/File':
      Duration: 01:10:06.16, start: 0.000000, bitrate: 1172 kb/s
        Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 640x360 [PAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
        Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
           title           :


Using mplayer

  1. Install mplayer using the command sudo apt-get install mplayer.
  2. Run mplayer -vo null -ao null -identify -frames 0 /path/to/file
  3. The output you get is similar to this:

    Playing Path/To/File.
    libavformat version 53.21.1 (external)
    Mismatching header version 53.19.0
    AVI file format detected.
    [aviheader] Video stream found, -vid 0
    [aviheader] Audio stream found, -aid 1
    VIDEO:  [XVID]  640x360  12bpp  25.000 fps  1031.9 kbps (126.0 kbyte/s)
    Load subtitles in Path/To/File
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    libavcodec version 53.35.0 (external)
    Mismatching header version 53.32.2
    Unsupported PixelFormat 61
    Unsupported PixelFormat 53
    Unsupported PixelFormat 81
    Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
    Requested audio codec family [mpg123] (afm=mpg123) not available.
    Enable it at compilation.
    Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
    AUDIO: 48000 Hz, 2 ch, floatle, 128.0 kbit/4.17% (ratio: 16000->384000)
    Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
    AO: [null] 48000Hz 2ch floatle (4 bytes per sample)
    Starting playback...
    Exiting... (End of file)


share|improve this answer

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