Is there a command analogous to afinfo for videos on a Mac OS X?
Solution 1:
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.
Sample terminal usage:
$ mediainfo myMovie.mov
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 : [email protected]
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
Solution 2:
You can get much information using the mdls builtin command, which is a general purpose file metadata utility. It works not only for video files, but for all types of files. It is the utility used by the finder when you use the "get info" menu command.
Here's part of the output I get when with the command on an mp4 file named forest.mp4
$mdls forest.mp4
kMDItemCodecs = (
"H.264"
)
kMDItemContentCreationDate = 2014-10-17 05:08:09 +0000
kMDItemContentModificationDate = 2014-10-17 05:08:09 +0000
kMDItemContentType = "public.mpeg-4"
kMDItemContentTypeTree = (
"public.mpeg-4",
"public.movie",
"public.audiovisual-content",
"public.data",
"public.item",
"public.content"
)
kMDItemDateAdded = 2016-01-11 20:30:01 +0000
kMDItemDisplayName = "forest.mp4"
kMDItemDownloadedDate = (
"2014-12-08 15:11:56 +0000"
)
kMDItemDurationSeconds = 29.96166666666667
kMDItemFSContentChangeDate = 2014-10-17 05:08:09 +0000
kMDItemFSCreationDate = 2014-10-17 05:08:09 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = (null)
kMDItemFSLabel = 0
kMDItemFSName = "forest.mp4"
kMDItemFSNodeCount = (null)
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 45363721
kMDItemFSTypeCode = ""
kMDItemKind = "MPEG-4 Movie"
kMDItemLogicalSize = 45363721
kMDItemMediaTypes = (
Video
)
kMDItemPhysicalSize = 45367296
kMDItemPixelHeight = 1080
kMDItemPixelWidth = 1920
kMDItemStreamable = 0
kMDItemTotalBitRate = 12110
kMDItemVideoBitRate = 12110
Furthermore, you can specify which attribute you want listed. For example, to only get the duration of the movie:
$ mdls -name kMDItemDurationSeconds forest.mp4
kMDItemDurationSeconds = 29.96166666666667