avreader.utils

get_file_info(fpath[, stream])

Extract some information about the audiovisual file.

avreader.utils.get_file_info(fpath, stream='audio+video')[source]

Extract some information about the audiovisual file.

Parameters
  • fpath (str) – Path to the input file.

  • stream (str, optional (default="audio+video")) – The stream on which we want to retrieve the information. The value can be ‘audio’, ‘video’, ‘audio+video’.

Returns

file_info (dict) – Extracted information from the audiovisual file structured as follows:

{
    'audio': {
        'duration': float,
        'channels': int,
        'sample_rate': int,
    },
    'video': {
        'duration': float,
        'width': int,
        'height': int,
        'frame_rate': float,
    },
}

If the stream parameter is different from ‘audio+video’, the sub-dictionary of the corresponding stream is returned.

Raises
  • ValueError – [description]

  • subprocess.CalledProcessError – If the FFprobe command fail.