Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

What is the best way to obtain information as bitrate, framerate, width/height of an movie file (in my case .avi) from the command line? I am looking for a basic tool that works similarly as ImageMagicks identify.

Running mplayer already gives this information (but also does a lot more):

VIDEO: [FMP4] 800x711 24bpp 25.000 fps 1320.9 kbps (161.2 kbyte/s)

Is there a way to make mplayer only give this output (I did not find it in the man) or is there another standard bash-command to obtain the same information?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

mplayer comes with an midentify utility that does mostly what you want.

The output looks like variable assignments, so it is pretty easy to use in scripts/simple to parse.

If midentify isn't installed with your mplayer package, you might have an script in /usr/share/mplayer or something like that. If not, midenfify just runs mplayer with a specific set of arguments:

# This is a wrapper around the -identify functionality.
# It is supposed to escape the output properly, so it can be easily
# used in shellscripts by 'eval'ing the output of this script.
# Written by Tobias Diedrich <>
# Licensed under GNU GPL.

if [ -z "$1" ]; then
        echo "Usage: <file> [<file> ...]"
        exit 1

mplayer -vo null -ao null -frames 0 -identify "$@" 2>/dev/null |
    sed -ne '/^ID_/ {
                      s/[]()|&;<>`'"'"'\\!$" []/\\&/g;p

The -ao, -vo and -frames parameters prevent mplayer from actually playing the clip. The rest is just formatting.


$ midentify some_random.avi 
share|improve this answer
midentify is not installed on this system, mplayer movie.avi -identify gives this kind of output, but also plays the movie. – Bernhard Jan 14 '12 at 11:28
It's just a wrapper script, I edited some information in - you could adapt that mplayer command to suit your exact needs. – Mat Jan 14 '12 at 11:32
Your script does exactly what I need. Also via ssh without X11 forwarding whatsoever. Thank you! – Bernhard Jan 14 '12 at 11:51
Edited to better reflect that it's not my script, it comes with the mplayer source code. – Mat Jan 14 '12 at 11:54
Nice thanks but it shows me video bitrate of 0 (this is MPEG4 AVC VBR). :-( – lzap Apr 27 '13 at 17:21

mediainfo command also gives you lots of information:

$ mediainfo IMGP3793.AVI 
Complete name                            : IMGP3793.AVI
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 121 MiB
Duration                                 : 2mn 16s
Overall bit rate                         : 7 439 Kbps

ID                                       : 0
Format                                   : JPEG
Codec ID                                 : MJPG
Duration                                 : 2mn 16s
Bit rate                                 : 7 339 Kbps
Width                                    : 640 pixels
Height                                   : 480 pixels
Original height                          : 960 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 30.288 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 8 bits
Scan type                                : Interlaced
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.789
Stream size                              : 119 MiB (99%)

ID                                       : 1
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Unsigned
Codec ID                                 : 1
Duration                                 : 2mn 16s
Bit rate mode                            : Constant
Bit rate                                 : 88.2 Kbps
Channel count                            : 1 channel
Sampling rate                            : 11.025 KHz
Bit depth                                : 8 bits
Stream size                              : 1.44 MiB (1%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 33 ms (1.00 video frame)
share|improve this answer

You can use the file command.

share|improve this answer
Easy and fast solution, basically what I was looking for. Only bitrate information is missing here. – Bernhard Jan 14 '12 at 11:33

Your Answer


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.