Globals

av.open(file, mode='r', format=None, options=None, metadata_encoding=None, metadata_errors='strict')

Main entrypoint to opening files/streams.

Parameters:
  • file (str) – The file to open.
  • mode (str) – "r" for reading and "w" for writing.
  • format (str) – Specific format to use. Defaults to autodect.
  • options (dict) – Options to pass to the container and all streams.
  • container_options (dict) – Options to pass to the container.
  • stream_options (list) – Options to pass to each stream.
  • metadata_encoding (str) – Encoding to use when reading or writing file metadata. Defaults to utf-8, except no decoding is performed by default when reading on Python 2 (returning str instead of unicode).
  • metadata_errors (str) – Specifies how to handle encoding errors; behaves like str.encode parameter. Defaults to strict.

For devices (via libavdevice), pass the name of the device to format, e.g.:

>>> # Open webcam on OS X.
>>> av.open(format='avfoundation', file='0')