def get_video_dims(fname):
 try:
  import pyffmpeg
 except ImportError:
  raise ImportError('This function requires pyffmpeg <http://code.google.com/p/pyffmpeg/>')
 mp = pyffmpeg.FFMpegReader()
 try:
  mp.open(fname)
  tracks = mp.get_tracks()
  for track in tracks:
   if isinstance(track, pyffmpeg.VideoTrack):
    break
  else:
   raise ValueError('no video track found')
  return ((track.duration(),) + track.get_orig_size())
 finally:
  mp.close()

def get_video_dims ( fname ) : try : import pyffmpeg except ImportError : raise ImportError ( 'This function requires pyffmpeg <http://code.google.com/p/pyffmpeg/>' ) mp = pyffmpeg . FFMpegReader ( ) try : mp . open ( fname ) tracks = mp . get_tracks ( ) for track in tracks : if isinstance ( track , pyffmpeg . VideoTrack ) : break else : raise ValueError ( 'no video track found' ) return ( ( track . duration ( ) , ) + track . get_orig_size ( ) ) finally : mp . close ( )
pull out the frame length .