def _mediainfo_screen_size(filename):
 try:
  if mediainfo:
   _media_info = mediainfo.parse(filename)
   for track in _media_info.tracks:
    if (track.track_type == u'Video'):
     return (track.width, track.height)
 except (OSError, TypeError):
  pass
 return (None, None)

def _mediainfo_screen_size ( filename ) : try : if mediainfo : _media_info = mediainfo . parse ( filename ) for track in _media_info . tracks : if ( track . track_type == u'Video' ) : return ( track . width , track . height ) except ( OSError , TypeError ) : pass return ( None , None )
attempts to read the width and height of a video file .