def _avi_screen_size(filename):
 try:
  if (not filename.endswith(u'.avi')):
   with io.open(filename, u'rb') as f:
    header = f.read(72)
   x = binascii.hexlify(header[68:72])
   height = int((((x[6:8] + x[4:6]) + x[2:4]) + x[0:2]), 16)
   assert (100 < height < 4320)
   x = binascii.hexlify(header[64:68])
   width = int((((x[6:8] + x[4:6]) + x[2:4]) + x[0:2]), 16)
   assert (100 < width < 7680)
   return (width, height)
 except Exception:
  pass
 return (None, None)

def _avi_screen_size ( filename ) : try : if ( not filename . endswith ( u'.avi' ) ) : with io . open ( filename , u'rb' ) as f : header = f . read ( 72 ) x = binascii . hexlify ( header [ 68 : 72 ] ) height = int ( ( ( ( x [ 6 : 8 ] + x [ 4 : 6 ] ) + x [ 2 : 4 ] ) + x [ 0 : 2 ] ) , 16 ) assert ( 100 < height < 4320 ) x = binascii . hexlify ( header [ 64 : 68 ] ) width = int ( ( ( ( x [ 6 : 8 ] + x [ 4 : 6 ] ) + x [ 2 : 4 ] ) + x [ 0 : 2 ] ) , 16 ) assert ( 100 < width < 7680 ) return ( width , height ) except Exception : pass return ( None , None )
parses avi file header for width and height .