def get_video_dims(fname):
    """
    Pull out the frame length, spatial height and spatial width of
    a video file using ffmpeg.

    Parameters
    ----------
    fname : str
        Path to video file to be inspected.

    Returns
    -------
    shape : tuple
        The spatiotemporal dimensions of the video
        (length, height, width).
    """
    try:
        import pyffmpeg
    except __HOLE__:
        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()
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/utils/video.py/get_video_dims