Start New Discussion within our Software Development Community

I'm trying to extract some metadata from a m4v file. I'm looking for the duration, height, width, etc. I do all my programming on a Raspberry Pi and was looking at gexiv2 but could not get it going. I got exiftool working though. My script looks like this:

import exiftool

files = '/mnt/media/tv/Robotech/Season 1/Robotech - S01E01 - Boobytrap.m4v'
infile = open(files, 'r')
with exiftool.ExifTool() as et:
    metadata = et.get_metadata(files)
    print metadata

What I'm getting back is this:

{u'File:FilePermissions': 777, 
u'File:FileType': u'MP4', 
u'File:FileSize': 445367645, 
u'QuickTime:MajorBrand': u'mp42', 
u'SourceFile': u'/mnt/media/tv/Robotech/Season 1/Robotech - S01E01 - Boobytrap.m4v', 
u'QuickTime:CompatibleBrands': [u'mp42', u'isom', u'avc1'], 
u'File:FileInodeChangeDate': u'2013:03:04 20:28:38+00:00', 
u'File:MIMEType': u'video/mp4', 
u'File:FileAccessDate': u'2013:03:23 12:27:08+00:00', 
u'QuickTime:MovieDataSize': 444404359, 
u'File:FileModifyDate': u'2013:02:27 21:10:25+00:00', 
u'ExifTool:ExifToolVersion': 9.23, 
u'File:Directory': u'/mnt/media/tv/Robotech/Season 1', 
u'File:FileName': u'Robotech - S01E01 - Boobytrap.m4v', 
u'QuickTime:MinorVersion': u'0.0.0'}

This is great but does not contain the information I need. Does someone maybe have any suggestions on how I can get the information I need?
Thanks.

Got it. Forget being fancy just use ffmpeg:

ffmpeg -i Robotech\ -\ S01E01\ -\ Boobytrap.m4v 2>&1 | grep Video | awk '{print $7}'

will get you:

720x480

Perfect!

This question has already been answered. Start a new discussion instead.