<commit_before>**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 = av.open('/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)


Dependencies
------------

PyAV depends upon the following components of the underlying libraries:

- ``libavformat``
- ``libavcodec``
- ``libavdevice``
- ``libavutil``
- ``libswscale``
- either ``libswresample`` or ``libavresample``


Mac OS X
^^^^^^^^

On **Mac OS X** Homebrew_ saves the day::

    brew install ffmpeg


Ubuntu 14.04 LTS
^^^^^^^^^^^^^^^^

On **Ubuntu 14.04 LTS** everything can come from the default sources::

    sudo apt-get install -y \
        libavformat-dev libavcodec-dev libavdevice-dev \
        libavutil-dev libswscale-dev libavresample-dev \


Ubuntu 10.04 LTS
^^^^^^^^^^^^^^^^

On **Ubuntu 10.04 LTS** you will be unable to satisfy these requirements with the default package sources. We recomment compiling and installing FFmpeg or Libav from source. For FFmpeg::

    wget http://ffmpeg.org/releases/ffmpeg-1.2.2.tar.bz2
    tar -xjf ffmpeg-1.2.2.tar.bz2
    cd ffmpeg-1.2.2

    ./configure --disable-static --enable-shared --disable-doc
    make
    sudo make install


Installation
------------

From PyPI::

    $ pip install av


From Source::
<commit_msg>Docs: Reference @mkassner's script for building dependencies<commit_after>**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 = av.open('/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)


Dependencies
------------

PyAV depends upon the following components of the underlying libraries:

- ``libavformat``
- ``libavcodec``
- ``libavdevice``
- ``libavutil``
- ``libswscale``
- either ``libswresample`` or ``libavresample``


Mac OS X
^^^^^^^^

On **Mac OS X** Homebrew_ saves the day::

    brew install ffmpeg


Ubuntu 14.04 LTS
^^^^^^^^^^^^^^^^

On **Ubuntu 14.04 LTS** everything can come from the default sources::

    sudo apt-get install -y \
        libavformat-dev libavcodec-dev libavdevice-dev \
        libavutil-dev libswscale-dev libavresample-dev \

Ubuntu 12.04 LTS
^^^^^^^^^^^^^^^^

On **Ubuntu 12.04 LTS** you will be unable to satisfy these requirements with the default package sources. We recomment compiling and installing FFmpeg or Libav from source. For FFmpeg::

    wget http://ffmpeg.org/releases/ffmpeg-1.2.2.tar.bz2
    tar -xjf ffmpeg-1.2.2.tar.bz2
    cd ffmpeg-1.2.2

    ./configure --disable-static --enable-shared --disable-doc
    make
    sudo make install

`See this script <https://gist.github.com/mkassner/1caa1b45c19521c884d5>`_ for a very detailed installation of all dependencies.


Installation
------------

From PyPI::

    $ pip install av


From Source::

{'fraction_non_alphanumeric': 0.14924958310172318, 'fraction_numerical': 0.02028904947192885, 'mean_word_length': 2.981194690265487, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5236169', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1088, 'n_words': 378}