You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, torchaudio tries to build FFmpeg extension with support for multiple FFmpeg versions. This process uses pre-built FFmpeg libraries compiled for specific CPU architectures like ``x86_64`` and ``aarch64`` (``arm64``).
52
-
53
-
If your CPU is not one of those, then the build process can fail. To workaround, one can disable FFmpeg integration (by setting the environment variable ``USE_FFMPEG=0``) or switch to the single version FFmpeg extension.
54
-
55
-
To build single version FFmpeg extension, FFmpeg binaries must be provided by user and available in the build environment. To do so, install FFmpeg and set ``FFMPEG_ROOT`` environment variable to specify the location of FFmpeg.
Copy file name to clipboardExpand all lines: docs/source/build.rst
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
Building from source
2
2
====================
3
3
4
-
TorchAudio integrates PyTorch for numerical computation and third party libraries for multimedia I/O. It requires the following tools to build from source.
4
+
TorchAudio integrates PyTorch for numerical computation. It requires the following tools to build from source.
5
5
6
6
- `PyTorch <https://pytorch.org>`_
7
7
- `CMake <https://cmake.org/>`_
@@ -22,15 +22,12 @@ TorchAudio integrates PyTorch for numerical computation and third party librarie
22
22
Customizing the build
23
23
---------------------
24
24
25
-
TorchAudio's integration with third party libraries can be enabled/disabled via
25
+
Optional features of torchaudio can be enabled/disabled via
26
26
environment variables.
27
27
28
28
They can be enabled by passing ``1`` and disabled by ``0``.
29
29
30
-
- ``BUILD_SOX``: Enable/disable I/O features based on libsox.
31
-
- ``BUILD_KALDI``: Enable/disable feature extraction based on Kaldi.
32
30
- ``BUILD_RNNT``: Enable/disable custom RNN-T loss function.
33
-
- ``USE_FFMPEG``: Enable/disable I/O features based on FFmpeg libraries.
Copy file name to clipboardExpand all lines: docs/source/build.windows.rst
-99Lines changed: 0 additions & 99 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -131,102 +131,3 @@ Now that we have everything ready, we can build TorchAudio.
131
131
To use ``pip``, please use ``--no-use-pep517`` option.
132
132
133
133
``pip install -v -e . --no-use-pep517``
134
-
135
-
[Optional] Build TorchAudio with a custom FFmpeg
136
-
------------------------------------------------
137
-
138
-
By default, torchaudio tries to build FFmpeg extension with support for multiple FFmpeg versions. This process uses pre-built FFmpeg libraries compiled for specific CPU architectures like ``x86_64``.
139
-
140
-
If your CPU is different, then the build process can fail. To workaround, one can disable FFmpeg integration (by setting the environment variable ``USE_FFMPEG=0``) or switch to the single version FFmpeg extension.
141
-
142
-
To build single version FFmpeg extension, FFmpeg binaries must be provided by user and available in the build environment. To do so, install FFmpeg and set ``FFMPEG_ROOT`` environment variable to specify the location of FFmpeg.
The following section illustrates a way to build FFmpeg libraries from source.
154
-
155
-
Conda-forge's FFmpeg package comes with support for major codecs and GPU decoders, so regular users and developers do not need to build FFmpeg from source.
156
-
157
-
If you are not using Conda, then you can either find a pre-built binary distribution or build FFmpeg by yourself.
158
-
159
-
Also, in case torchaudio developer needs to update and customize the CI for FFmpeg build, this section might be helpful.
160
-
161
-
1. Install MSYS2
162
-
~~~~~~~~~~~~~~~~
163
-
164
-
To build FFmpeg in a way it is usable from the TorchAudio development environment, we need to build binaries native to ``MINGW64``. To do so, we need tools required by FFmpeg's build process, such as ``pkg-config`` and ``make``, that work in ``MINGW64`` environment. For this purpose, we use MSYS2.
165
-
166
-
FFmpeg's official documentation touches this https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW
167
-
168
-
Please follow the instruction at https://www.msys2.org/ to install MSYS2.
169
-
170
-
.. note::
171
-
172
-
In CI environment, often `Chocolatery <https://chocolatey.org/>`_ can be used to install MSYS2.
The Bash environment in MSYS2 does not play well with Conda env, so do not add Conda initialization script in ``~/.bashrc`` of MSYS2 environment. (i.e. ``C:\msys2\home\USER\.bashrc``) Instead, add it in ``C:\Users\USER\.bashrc``)
185
-
186
-
3. Install build tools
187
-
~~~~~~~~~~~~~~~~~~~~~~
188
-
189
-
.. code-block::
190
-
191
-
$ pacman -S mingw-w64-x86_64-make
192
-
$ pacman -S mingw-w64-x86_64-yasm
193
-
194
-
After the installation, you should have packages similar to the following;
195
-
196
-
.. code-block::
197
-
198
-
$ pacman -Qe
199
-
base 2020.12-1
200
-
base-devel 2022.01-2
201
-
filesystem 2023.01-2
202
-
mingw-w64-x86_64-make 4.3-1
203
-
mingw-w64-x86_64-pkgconf 1.8.0-2
204
-
mingw-w64-x86_64-yasm 1.3.0-4
205
-
msys2-runtime 3.4.3-5
206
-
207
-
4. Build FFmpeg
208
-
~~~~~~~~~~~~~~~
209
-
210
-
Check out FFmpeg source code.
211
-
212
-
.. code-block::
213
-
214
-
git clone https://github.com/ffmpeg/ffmpeg
215
-
cd ffmpeg
216
-
git checkout <VERSION>
217
-
218
-
Build
219
-
220
-
.. code-block::
221
-
222
-
./configure --toolchain=msvc
223
-
make -j
224
-
225
-
If the build succeeds, ``ffmpeg.exe`` should be found in the same directory. Make sure that you can run it.
226
-
227
-
5. Verify the build
228
-
~~~~~~~~~~~~~~~~~~~
229
-
230
-
Check that the resulting FFmpeg binary is accessible from Conda env
231
-
232
-
Now launch a new command prompt and enable the TorchAudio development environment. Make sure that you can run the ``ffmpeg.exe`` command generated in the previous step.
Copy file name to clipboardExpand all lines: docs/source/installation.rst
-46Lines changed: 0 additions & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,6 @@ Please refer to https://pytorch.org/get-started/locally/ for the details.
15
15
Starting ``0.10``, torchaudio has CPU-only and CUDA-enabled binary distributions,
16
16
each of which requires a corresponding PyTorch distribution.
17
17
18
-
.. note::
19
-
This software was compiled against an unmodified copies of FFmpeg, with the specific rpath removed so as to enable the use of system libraries. The LGPL source can be downloaded from the following locations: `n4.1.8 <https://github.com/FFmpeg/FFmpeg/releases/tag/n4.4.4>`__ (`license <https://github.com/FFmpeg/FFmpeg/blob/n4.4.4/COPYING.LGPLv2.1>`__), `n5.0.3 <https://github.com/FFmpeg/FFmpeg/releases/tag/n5.0.3>`__ (`license <https://github.com/FFmpeg/FFmpeg/blob/n5.0.3/COPYING.LGPLv2.1>`__) and `n6.0 <https://github.com/FFmpeg/FFmpeg/releases/tag/n6.0>`__ (`license <https://github.com/FFmpeg/FFmpeg/blob/n6.0/COPYING.LGPLv2.1>`__).
20
-
21
18
Dependencies
22
19
------------
23
20
@@ -30,49 +27,6 @@ Dependencies
30
27
Optional Dependencies
31
28
~~~~~~~~~~~~~~~~~~~~~
32
29
33
-
.. _ffmpeg_dependency:
34
-
35
-
* `FFmpeg <https://ffmpeg.org>`__
36
-
37
-
Starting version 2.1, TorchAudio official binary distributions are compatible with
38
-
FFmpeg version 6, 5 and 4. (>=4.4, <7). At runtime, TorchAudio first looks for FFmpeg 6,
39
-
if not found, then it continues to looks for 5 and move on to 4.
40
-
41
-
There are multiple ways to install FFmpeg libraries.
42
-
Please refer to the official documentation for how to install FFmpeg.
43
-
If you are using Anaconda Python distribution,
44
-
``conda install -c conda-forge 'ffmpeg<7'`` will install
45
-
compatible FFmpeg libraries.
46
-
47
-
If you need to specify the version of FFmpeg TorchAudio searches and links, you can
48
-
specify it via the environment variable ``TORIO_USE_FFMPEG_VERSION``. For example,
49
-
by setting ``TORIO_USE_FFMPEG_VERSION=5``, TorchAudio will only look for FFmpeg
50
-
5.
51
-
52
-
If for some reason, this search mechanism is causing an issue, you can disable
53
-
the FFmpeg integration entirely by setting the environment variable
54
-
``TORIO_USE_FFMPEG=0``.
55
-
56
-
There are multiple ways to install FFmpeg libraries.
57
-
If you are using Anaconda Python distribution,
58
-
``conda install -c conda-forge 'ffmpeg<7'`` will install
59
-
compatible FFmpeg libraries.
60
-
61
-
.. note::
62
-
63
-
When searching for FFmpeg installation, TorchAudio looks for library files
64
-
which have names with version numbers.
65
-
That is, ``libavutil.so.<VERSION>`` for Linux, ``libavutil.<VERSION>.dylib``
66
-
for macOS, and ``avutil-<VERSION>.dll`` for Windows.
67
-
Many public pre-built binaries follow this naming scheme, but some distributions
68
-
have un-versioned file names.
69
-
If you are having difficulties detecting FFmpeg, double check that the library
70
-
files you installed follow this naming scheme, (and then make sure
71
-
that they are in one of the directories listed in library search path.)
0 commit comments