Globals, mode='r', **kwargs)

Main entrypoint to opening files/streams.

  • file (str) – The file to open, which can be either a string or a file-like object.

  • 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".

  • metadata_errors (str) – Specifies how to handle encoding errors; behaves like str.encode parameter. Defaults to "strict".

  • buffer_size (int) – Size of buffer for Python input/output operations in bytes. Honored only when file is a file-like object. Defaults to 32768 (32k).

  • timeout (float or tuple) – How many seconds to wait for data before giving up, as a float, or a (open timeout, read timeout) tuple.

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

>>> # Open webcam on OS X.
>>>'avfoundation', file='0') 

More information on using input and output devices is available on the FFmpeg website.