Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Mac OS X has the command afinfo to fetch audio file info. Is there a similar command to fetch video file info for videos (.mov, .m4v) other than the mdls command?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

None that comes with OS X itself.

You can download the MediaInfo command-line interface (see the "CLI" link under x64). It's also available through Homebrew in the media-info package.

For a video, it'll produce something like the following output:

Format                                   : MPEG-4
Format profile                           : QuickTime
Format settings                          : Compressed header
Codec ID                                 : qt  
File size                                : 12.1 MiB
Duration                                 : 2mn 27s
Overall bit rate mode                    : Variable
Overall bit rate                         : 689 Kbps
Encoded date                             : UTC 2006-06-13 06:43:09
Tagged date                              : UTC 2006-06-13 06:43:12
Writing library                          : Apple QuickTime

Video #1
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L2.1
Format settings, CABAC                   : No
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=2, N=24
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 2mn 23s
Source duration                          : 2mn 23s
Bit rate mode                            : Variable
Bit rate                                 : 569 Kbps
Maximum bit rate                         : 770 Kbps
Width                                    : 320 pixels
Height                                   : 240 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Constant
Frame rate                               : 24.975 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.297
Stream size                              : 9.74 MiB (80%)
Source stream size                       : 9.74 MiB (80%)
Language                                 : English
Encoded date                             : UTC 2006-06-13 06:18:04
Tagged date                              : UTC 2006-06-13 06:43:12
Color primaries                          : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics                 : BT.709-5, BT.1361
Matrix coefficients                      : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
share|improve this answer

If it's helpful, here's a little script to output the filename and length for all the MP4s in a specific directory:

#! /bin/bash
# get video length of file.
for MP4 in `ls *mp4`
    echo "\"$MP4\",\c"
    mediainfo $MP4 | grep "^Duration" | head -1 | sed 's/^.*: \([0-9][0-9]*\)mn *\([0-9][0-9]*\)s/00:\1:\2/'

Doesn't work if there are spaces in filenames. If your videos > 1hr just adjust the REGEXP to suit.

share|improve this answer

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.