- Download and install Command Line Interface (CLI) for MediaInfo from Here.
See getting info for media file examples here:
set mkvFile to quoted form of (POSIX path of (choose file of type {"public.movie"}))
set mediaInfoPath to "usr/local/bin/mediainfo "
-- Get all metadata of the media file:
set mediaFileMetadata to do shell script (mediaInfoPath & mkvFile)
-- Get all available for Inform option parameters:
set InformParameters to do shell script (mediaInfoPath & " --Info-Parameters")
-- Get format of the media file:
set mediaFileFormat to do shell script (mediaInfoPath & "--Inform=\"General;%Format/String%\" " & mkvFile)
-- Get format of the video stream:
set videoStreamFormat to do shell script (mediaInfoPath & "--Inform=\"Video;%Format/String%\" " & mkvFile)
-- Get the duration of the media file:
set mediaFileDuration to do shell script (mediaInfoPath & "--Inform=\"General;%Duration/String3%\" " & mkvFile)
-- Get the duration of video stream:
set videoStreamDuration to do shell script (mediaInfoPath & "--Inform=\"Video;%Duration/String3%\" " & mkvFile)
-- Get the duration of audio stream:
set audioStreamDuration to do shell script (mediaInfoPath & "--Inform=\"Audio;%Duration/String3%\" " & mkvFile)
-- Get video frame dimensions:
set frameWidth to do shell script (mediaInfoPath & "--Inform=\"Video;%Width/String%\" " & mkvFile)
set frameHeight to do shell script (mediaInfoPath & "--Inform=\"Video;%Height/String%\" " & mkvFile)
set frameDimensions to (word 1 of frameWidth) & "x" & (word 1 of frameHeight) & " pixels"
-- Get frame rate of the video stream:
set videoFrameRate to do shell script (mediaInfoPath & "--Inform=\"Video;%FrameRate/String%\" " & mkvFile)
-- Get overall bit rate of media file:
set mediaBitrate to do shell script (mediaInfoPath & "--Inform=\"General;%OverallBitRate/String%\" " & mkvFile)
-- Get display aspect ratio:
set DAR to do shell script (mediaInfoPath & "--Inform=\"Video;%DisplayAspectRatio/String%\" " & mkvFile)
-- Get video track ID:
set videoTrackID to do shell script (mediaInfoPath & "--Inform=\"Video;%ID/String%\" " & mkvFile)
-- Get audio track IDs:
set audioTrackIDs to do shell script (mediaInfoPath & "--Inform=\"Audio;%ID/String%\" " & mkvFile)
-- Get subtitle track IDs:
set subtitleTrackIDs to do shell script (mediaInfoPath & "--Inform=\"Text;%ID/String%\" " & mkvFile)
-- Get video track's scan type (interlasing):
set scanType to do shell script (mediaInfoPath & "--Inform=\"Video;%ScanType/String%\" " & mkvFile)
-- Get video track's encoding settings:
set encodingSettings to ¬
do shell script (mediaInfoPath & "--Inform=\"Video;%Encoded_Library_Settings%\" " & mkvFile)
return mediaFileMetadata
NOTE: mediainfo utility has many, many other options to analyze media files (see Get all available for Inform option parameters). It is fantastically powerfull.