Retrieve Video File Information from Command Line in Linux

command linelinuxvideo

I'd like to see from command line all informations pertaining to a given video file, including length, quality, bitrate, resolution, audio and video formats, number and language of audio streams and subtitles, and so on; the more, the best.

Right now I must resort on the "information" tab of VLC because even Dolphin file manager isn't helping me with this: it shows me only some of these informations and just for some formats (i.e. .mkv doesn't seem supported that way).

Best Answer

Give mediainfo a try. On the command line type mediainfo input.mkv. For more detailed video information mediainfo --fullscan input.mkv.

Output example:

General
Unique ID                                : 239093944660469735839645243666869007606 (0xB3DFD199E22F0E7CBAE1FE52206834F6)
Complete name                            : input.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 39.6 MiB
Duration                                 : 20s 288ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 16.4 Mbps
Movie name                               : My best movie
Encoded date                             : UTC 2012-11-10 16:42:02
Writing application                      : mkvmerge v5.8.0 ('No Sleep / Pillow') built on Sep  2 2012 15:37:04
Writing library                          : libebml v1.2.3 + libmatroska v1.3.0
Produzent                                : ??? ???????
Thanks to                                : Bruce Davey
Lead performer                           : Rudy Youngblood
Remixed by                               : ©????

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.0
MultiView_Count                          : 2
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=2, N=13
Muxing mode                              : Header stripping
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 20s 280ms
Bit rate mode                            : Variable
Bit rate                                 : 15.8 Mbps
Maximum bit rate                         : 16.0 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Bits/(Pixel*Frame)                       : 0.304
Stream size                              : 38.2 MiB (96%)
Title                                    : Sony Hardware Video H.264 Encoder
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Muxing mode                              : Header stripping
Codec ID                                 : A_AC3
Duration                                 : 20s 288ms
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Compression mode                         : Lossy
Delay relative to video                  : -80ms
Stream size                              : 634 KiB (2%)
Title                                    : Sony Hardware Audio AC3 Encoder
Language                                 : Russian
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 3
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : The same subtitle format used on BDs/HD-DVDs
Title                                    : Sony Hardware PGS Encoder
Language                                 : English
Default                                  : Yes
Forced                                   : No