PyAV Documentation

PyAV aims to be a Pythonic binding for FFmpeg or Libav.

Currently, it includes the basics for reading/writing audio and video. We aim to provide all of the power and control of the underlying library, but manage the gritty details for you as much as possible.

Basic Demo

import av

container ='/path/to/video.mp4')

for packet in container.demux():
    for frame in packet.decode():
        if frame.type == 'video':
            frame.to_image().save('/path/to/frame-%04d.jpg' % frame.index)


From PyPI:

$ pip install av

From Source:

$ git clone
$ cd PyAV
$ virtualenv venv
$ . venv/bin/activate
$ pip install cython pil
$ make
$ python build_ext --inplace


We are attempting to write this wrapper to work with either FFmpeg or Libav. We are using ctypes to detect the differences that we have discerned exist as this wrapper is being developed. This is a fairly trial-and-error process, so please let us know if there are any odd compiler errors or something won’t link due to missing functions.

Additionally, we are far from wrapping the full extents of the libraries. Notable omissions include device and filter support, but there are many C struct members which are currently unexposed.

Table Of Contents

Next topic


This Page