Posted: . At: 11:51 AM. This was 5 years ago. Post ID: 12762
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



How to get metadata from a video file with the Linux command line easily.


Use the Linux command line to query a movie file for metadata with this very useful utility. This gives the user a lot of very useful information about a file.

Install this useful utility.

4.4 Mon Dec 10 jason@Yog-Sothoth 0: $ sudo apt-get install mediainfo

Then query a video file for useful metadata.

4.4 Mon Dec 10 jason@Yog-Sothoth 0: $ mediainfo The.Fifth.Element.1997.REMASTERED.1080p.BluRay.x264.AC3-ETRG.Sample.mp4
General
Complete name                            : The.Fifth.Element.1997.REMASTERED.1080p.BluRay.x264.AC3-ETRG.Sample.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/avc1/iso2)
File size                                : 40.7 MiB
Duration                                 : 1 min 5 s
Overall bit rate                         : 5 182 kb/s
Encoded date                             : UTC 2015-08-24 02:54:22
Tagged date                              : UTC 2015-08-24 02:54:23

This returns very useful information about the video file.

Some information about the video codec.

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 5 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 5 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 min 5 s
Bit rate                                 : 4 375 kb/s
Maximum bit rate                         : 11.7 Mb/s
Width                                    : 1 920 pixels
Height                                   : 800 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.119
Stream size                              : 34.3 MiB (84%)
Language                                 : English
Encoded date                             : UTC 2015-08-24 02:54:22
Tagged date                              : UTC 2015-08-24 02:54:22
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Menus                                    : 4

Also comprehensive information about the audio codec used.

Audio #1
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : mp4a-40-2
Duration                                 : 1 min 5 s
Bit rate mode                            : Constant
Bit rate                                 : 160 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 1.26 MiB (3%)
Title                                    : Stereo / Stereo
Language                                 : English
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 2015-08-24 02:54:22
Tagged date                              : UTC 2015-08-24 02:54:22
 
Audio #2
ID                                       : 3
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Codec ID                                 : ac-3
Duration                                 : 1 min 5 s
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 5.03 MiB (12%)
Title                                    : Surround Sound / Surround Sound
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Alternate group                          : 1
Encoded date                             : UTC 2015-08-24 02:54:22
Tagged date                              : UTC 2015-08-24 02:54:22

This file had two audio tracks, so is therefore listing both of them.

This is a very useful utility for working out what audio a video comes with, as many movies have multiple language options, like Japanese and English. This utility gives a lot of information about the file the user wants to know about, and I recommend installing it if you have a lot of movies and wish to find out more about them.

Another way, is to use FFMPEG.

4.4 Mon Dec 10 jason@Yog-Sothoth 0: $ ffprobe -hide_banner The.Fifth.Element.1997.REMASTERED.1080p.BluRay.x264.AC3-ETRG.mp4

This is a sample of the output.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'The.Fifth.Element.1997.REMASTERED.1080p.BluRay.x264.AC3-ETRG.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    iTunEXTC        : mpaa|PG-13|300|
    iTunMOVI        : <?xml version="1.0" encoding="UTF-8"?>
                    : <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                    : <plist version="1.0">
                    : <dict>
                    : 	<key>cast</key>
                    : 	<array>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Bruce Willis</string>
                    : 		</dict>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Gary Oldman</string>
                    : 		</dict>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Ian Holm</string>
                    : 		</dict>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Chris Tucker</string>
                    : 		</dict>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Milla Jovovich</string>
                    : 		</dict>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Luke Perry</string>
                    : 		</dict>
                    : 	</array>
                    : 	<key>directors</key>
                    : 	<array>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Luc Besson</string>
                    : 		</dict>
                    : 	</array>
                    : 	<key>producers</key>
                    : 	<array>
                    : 		<dict>
                    : 			<key>name</key>
                    : 			<string>Patrice Ledoux</string>

This also retrieves the synopsis of the film.

    title           : The Fifth Element
    artist          : Luc Besson
    genre           : Sci-Fi & Fantasy
    date            : 1997
    synopsis        : In the colorful future, a cab driver unwittingly becomes the central figure in the search for a legendary cosmic weapon to keep Evil and Mr Zorg at bay.
    encoder         : HandBrake 0.10.1 2015030800
    hd_video        : 2
    media_type      : 9
  Duration: 02:05:53.55, start: 0.000000, bitrate: 4536 kb/s

Another very good way to get movie information.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.