1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
Installation
============
Binary wheels
-------------
Binary wheels are provided on PyPI for Linux, MacOS, and Windows linked against FFmpeg. The most straight-forward way to install PyAV is to run:
.. code-block:: bash
pip install av
Conda
-----
Another way to install PyAV is via `conda-forge <https://conda-forge.github.io>`_::
conda install av -c conda-forge
See the `Conda quick install <https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html>`_ docs to get started with (mini)Conda.
Bring your own FFmpeg
---------------------
PyAV can also be compiled against your own build of FFmpeg (version ``7.0`` or higher). You can force installing PyAV from source by running:
.. code-block:: bash
pip install av --no-binary av
PyAV depends upon several libraries from FFmpeg:
- ``libavcodec``
- ``libavdevice``
- ``libavfilter``
- ``libavformat``
- ``libavutil``
- ``libswresample``
- ``libswscale``
and a few other tools in general:
- ``pkg-config``
- Python's development headers
MacOS
^^^^^
On **MacOS**, Homebrew_ saves the day::
brew install ffmpeg pkg-config
.. _homebrew: http://brew.sh/
Ubuntu >= 18.04 LTS
^^^^^^^^^^^^^^^^^^^
On **Ubuntu 18.04 LTS** everything can come from the default sources::
# General dependencies
sudo apt-get install -y python-dev pkg-config
# Library components
sudo apt-get install -y \
libavformat-dev libavcodec-dev libavdevice-dev \
libavutil-dev libswscale-dev libswresample-dev libavfilter-dev
Windows
^^^^^^^
It is possible to build PyAV on Windows without Conda by installing FFmpeg yourself, e.g. from the `shared and dev packages <https://ffmpeg.zeranoe.com/builds/>`_.
Unpack them somewhere (like ``C:\ffmpeg``), and then :ref:`tell PyAV where they are located <build_on_windows>`.
Building from the latest source
-------------------------------
::
# Get PyAV from GitHub.
git clone https://github.com/PyAV-Org/PyAV.git
cd PyAV
# Prep a virtualenv.
source scripts/activate.sh
# Optionally build FFmpeg.
./scripts/build-deps
# Build PyAV.
make
On **MacOS** you may have issues with regards to Python expecting gcc but finding clang. Try to export the following before installation::
export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
.. _build_on_windows:
On **Windows** you must indicate the location of your FFmpeg, e.g.::
python setup.py build --ffmpeg-dir=C:\ffmpeg
|