Skip to content

Commit bf07ea6

Browse files
mthrokfacebook-github-bot
authored andcommitted
[BC-breaking] Update pre-built ffmpeg4 to 4.4.4 (#3561)
Summary: In #3460, we switched the build process for FFmpeg extension. Since it is complicated to install FFmpeg in some environments, at build time, pre-built binaries and its headers are downloaded and used as a scaffolding for torchaudio build. Now even though we did not change any code or FFmpeg version, it turned out that this causes segmentation fault on Ubuntu when using system Python and FFmpeg 4.4 installed via aptitude. While investigating the issue, I swapped the said pre-built FFmpeg scaffolding with FFmpeg 4.4 from aptitude, and the segmentation fault did not happen. This indicates that it is binary compatibility issue. Before #3460, each binary build job was building FFmpeg 4.1.8 using the same compiler used to build torchaudio, but after #3460 the environments to build FFmpeg 4.1.8 and torchaudio are different. My hypothesis is that this difference is causing some ABI incompatibility when linking against FFmpeg 4.4. (Also, I don't remember well, but I read somewhere that 4.4 has a different ABI) Through experiments, it turned out upgrading the pre-built FFmpeg scaffolding to 4.4 resolves this. So this commit upgrade the pre-built FFmpeg 4 to 4.4. The potential (yet unconfirmed) downside is that torchaudio will no longer work with 4.1, 4.2, and 4.3. Since FFmpeg 4.4 is what Ubuntu 20.04 and 22.04 support by default, and Google Colab is also on 20.04, I think it is more important to support 4.4. Therefore we drop the support for 4.1-4.3 from normal build (and official distributions). Those who wish to use 4.1-4.3 can build torchaudio from source by linking to specific FFmpeg. Pull Request resolved: #3561 Reviewed By: hwangjeff Differential Revision: D48340201 Pulled By: mthrok fbshipit-source-id: 7ece82910f290c7cf83f58311c4cf6a384e8795e
1 parent 2e0dfaf commit bf07ea6

8 files changed

+61
-75
lines changed

docs/source/installation.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Please refer to https://pytorch.org/get-started/locally/ for the details.
1616
each of which requires a corresponding PyTorch distribution.
1717

1818
.. 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.1.8>`__ (`license <https://github.com/FFmpeg/FFmpeg/blob/n4.1.8/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>`__).
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>`__).
2020

2121
Dependencies
2222
------------
@@ -25,18 +25,28 @@ Dependencies
2525

2626
Please refer to the compatibility matrix bellow for supported PyTorch versions.
2727

28+
.. _optional_dependencies:
29+
2830
Optional Dependencies
2931
~~~~~~~~~~~~~~~~~~~~~
3032

33+
.. _ffmpeg:
34+
3135
* `FFmpeg <https://ffmpeg.org>`__
3236

3337
Required to use :py:mod:`torchaudio.io` module. and ``backend="ffmpeg"`` in
3438
`I/O functions <./torchaudio.html#i-o>`__.
3539

3640
Starting version 2.1, TorchAudio official binary distributions are compatible with
37-
FFmpeg version 6, 5 and 4. At runtime, TorchAudio first looks for FFmpeg 6,
41+
FFmpeg version 6, 5 and 4. (>=4.4, <7). At runtime, TorchAudio first looks for FFmpeg 6,
3842
if not found, then it continues to looks for 5 and move on to 4.
3943

44+
There are multiple ways to install FFmpeg libraries.
45+
Please refer to the official documentation for how to install FFmpeg.
46+
If you are using Anaconda Python distribution,
47+
``conda install -c conda-forge 'ffmpeg<7'`` will install
48+
compatible FFmpeg libraries.
49+
4050
If you need to specify the version of FFmpeg TorchAudio searches and links, you can
4151
specify it via the environment variable ``TORCHAUDIO_USE_FFMPEG_VERSION``. For example,
4252
by setting ``TORCHAUDIO_USE_FFMPEG_VERSION=5``, TorchAudio will only look for FFmpeg
@@ -46,6 +56,11 @@ Optional Dependencies
4656
the FFmpeg integration entirely by setting the environment variable
4757
``TORCHAUDIO_USE_FFMPEG=0``.
4858

59+
There are multiple ways to install FFmpeg libraries.
60+
If you are using Anaconda Python distribution,
61+
``conda install -c conda-forge 'ffmpeg<7'`` will install
62+
compatible FFmpeg libraries.
63+
4964
.. note::
5065

5166
When searching for FFmpeg installation, TorchAudio looks for library files
@@ -86,6 +101,7 @@ Optional Dependencies
86101
* `sentencepiece <https://pypi.org/project/sentencepiece/>`__
87102

88103
Required for performing automatic speech recognition with :ref:`Emformer RNN-T<RNNT>`.
104+
You can install it by running ``pip install sentencepiece``.
89105

90106
* `deep-phonemizer <https://pypi.org/project/deep-phonemizer/>`__
91107

examples/tutorials/device_asr.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,23 @@
77
This tutorial shows how to use Emformer RNN-T and streaming API
88
to perform speech recognition on a streaming device input, i.e. microphone
99
on laptop.
10-
11-
.. note::
12-
13-
This tutorial requires FFmpeg libraries (>=4.1, <7) and SentencePiece.
14-
15-
There are multiple ways to install FFmpeg libraries.
16-
If you are using Anaconda Python distribution,
17-
``conda install -c conda-forge 'ffmpeg<7'`` will install
18-
compatible FFmpeg libraries.
19-
20-
You can install SentencePiece by running ``pip install sentencepiece``.
21-
22-
.. note::
23-
24-
This tutorial was tested on MacBook Pro and Dynabook with Windows 10.
25-
26-
This tutorial does NOT work on Google Colab because the server running
27-
this tutorial does not have a microphone that you can talk to.
2810
"""
2911

12+
######################################################################
13+
#
14+
# .. note::
15+
#
16+
# This tutorial requires FFmpeg libraries.
17+
# Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
18+
# the detail.
19+
#
20+
# .. note::
21+
#
22+
# This tutorial was tested on MacBook Pro and Dynabook with Windows 10.
23+
#
24+
# This tutorial does NOT work on Google Colab because the server running
25+
# this tutorial does not have a microphone that you can talk to.
26+
3027
######################################################################
3128
# 1. Overview
3229
# -----------

examples/tutorials/effector_tutorial.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@
1313
#
1414
# .. note::
1515
#
16-
# This tutorial requires FFmpeg libraries (>=4.1, <7).
17-
#
18-
# There are multiple ways to install FFmpeg libraries.
19-
# If you are using Anaconda Python distribution,
20-
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
21-
# compatible FFmpeg libraries.
16+
# This tutorial requires FFmpeg libraries.
17+
# Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
18+
# the detail.
2219
#
2320

2421
######################################################################
@@ -42,25 +39,15 @@
4239

4340
######################################################################
4441
#
45-
try:
46-
from torchaudio.io import AudioEffector, CodecConfig
47-
except ImportError as err:
48-
raise RuntimeError(
49-
"This tutorial requires nightly build of TorchAudio. "
50-
"Please install the nightly versions of PyTorch and torchaudio. "
51-
"https://pytorch.org/get-started/locally/"
52-
) from err
42+
from torchaudio.io import AudioEffector, CodecConfig
5343

5444
import matplotlib.pyplot as plt
5545
from IPython.display import Audio
5646

5747
######################################################################
5848
#
59-
try:
60-
for k, v in torchaudio.utils.ffmpeg_utils.get_versions().items():
61-
print(k, v)
62-
except Exception:
63-
raise RuntimeError("This tutorial requires FFmpeg libraries 4.2>,<5. " "Please install FFmpeg.")
49+
for k, v in torchaudio.utils.ffmpeg_utils.get_versions().items():
50+
print(k, v)
6451

6552
######################################################################
6653
# Usage

examples/tutorials/online_asr_tutorial.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
#
1414
# .. note::
1515
#
16-
# This tutorial requires FFmpeg libraries (>=4.1, <7) and SentencePiece.
16+
# This tutorial requires FFmpeg libraries and SentencePiece.
1717
#
18-
# There are multiple ways to install FFmpeg libraries.
19-
# If you are using Anaconda Python distribution,
20-
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
21-
# compatible FFmpeg libraries.
18+
# Please refer to :ref:`Optional Dependencies <optional_dependencies>`
19+
# for the detail.
2220
#
23-
# You can install SentencePiece by running ``pip install sentencepiece``.
2421

2522
######################################################################
2623
# 1. Overview

examples/tutorials/streamreader_basic_tutorial.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
#
1515
# .. note::
1616
#
17-
# This tutorial requires FFmpeg libraries (>=4.1, <7).
18-
#
19-
# There are multiple ways to install FFmpeg libraries.
20-
# If you are using Anaconda Python distribution,
21-
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
22-
# compatible FFmpeg libraries.
17+
# This tutorial requires FFmpeg libraries.
18+
# Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
19+
# the detail.
2320
#
2421

2522
######################################################################

examples/tutorials/streamwriter_advanced.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,9 @@
2323
#
2424
# .. note::
2525
#
26-
# This tutorial requires FFmpeg libraries (>=4.1, <7).
27-
#
28-
# There are multiple ways to install FFmpeg libraries.
29-
# If you are using Anaconda Python distribution,
30-
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
31-
# compatible FFmpeg libraries.
32-
# However, this distribution does not have SDL plugin, so it cannot play
33-
# video.
26+
# This tutorial requires FFmpeg libraries.
27+
# Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
28+
# the detail.
3429
#
3530

3631
######################################################################

examples/tutorials/streamwriter_basic_tutorial.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@
1313
#
1414
# .. note::
1515
#
16-
# This tutorial requires FFmpeg libraries (>=4.1, <7).
17-
#
18-
# There are multiple ways to install FFmpeg libraries.
19-
# If you are using Anaconda Python distribution,
20-
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
21-
# compatible FFmpeg libraries.
16+
# This tutorial requires FFmpeg libraries.
17+
# Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
18+
# the detail.
2219
#
2320

2421
######################################################################

third_party/ffmpeg/multi/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ if (APPLE)
1515
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
1616
FetchContent_Declare(
1717
f4
18-
URL ${base_url}/2023-07-06/macos_arm64/4.1.8.tar.gz
19-
URL_HASH SHA256=a44b8152b7f204ce5050fc7f6fd2bbbafe7ae4e45f03e135f3b45dd9a08f404e
18+
URL ${base_url}/2023-08-14/macos_arm64/4.4.4.tar.gz
19+
URL_HASH SHA256=9a593eb241eb8b23bc557856ee6db5d9aecd2d8895c614a949f3a1ad9799c1a1
2020
)
2121
FetchContent_Declare(
2222
f5
@@ -31,8 +31,8 @@ if (APPLE)
3131
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
3232
FetchContent_Declare(
3333
f4
34-
URL ${base_url}/2023-07-06/macos_x86_64/4.1.8.tar.gz
35-
URL_HASH SHA256=392d5af0b24535bfc69d6244e7595e5f07117b93d94505d0a4b34c82ae479f48
34+
URL ${base_url}/2023-08-14/macos_x86_64/4.4.4.tar.gz
35+
URL_HASH SHA256=0935e359c0864969987d908397f9208d6dc4dc0ef8bfe2ec730bb2c44eae89fc
3636
)
3737
FetchContent_Declare(
3838
f5
@@ -58,8 +58,8 @@ elseif (UNIX)
5858
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
5959
FetchContent_Declare(
6060
f4
61-
URL ${base_url}/2023-07-06/linux_aarch64/4.1.8.tar.gz
62-
URL_HASH SHA256=aae0b713040e30ceebe0d0bc82353d3d9054055c7af8a4f4abc1766015ab7681
61+
URL ${base_url}/2023-08-14/linux_aarch64/4.4.4.tar.gz
62+
URL_HASH SHA256=6f00437d13a3b3812ebe81c6e6f3a84a58f260d946a1995df87ba09aae234504
6363
)
6464
FetchContent_Declare(
6565
f5
@@ -74,8 +74,8 @@ elseif (UNIX)
7474
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
7575
FetchContent_Declare(
7676
f4
77-
URL ${base_url}/2023-07-06/linux_x86_64/4.1.8.tar.gz
78-
URL_HASH SHA256=52e53b8857739bdd54f9d8541e22569b57f6c6f16504ee83963c2ed3e7061a23
77+
URL ${base_url}/2023-08-14/linux_x86_64/4.4.4.tar.gz
78+
URL_HASH SHA256=9b87eeba9b6975e25f28ba12163bd713228ed84f4c2b3721bc5ebe92055edb51
7979
)
8080
FetchContent_Declare(
8181
f5
@@ -101,8 +101,8 @@ elseif (UNIX)
101101
elseif(MSVC)
102102
FetchContent_Declare(
103103
f4
104-
URL ${base_url}/2023-07-06/windows/4.1.8.tar.gz
105-
URL_HASH SHA256=c45cd36e0575490f97ace07365bb67c5e1cbe9f3e6a4272d035c19348df96790
104+
URL ${base_url}/2023-08-14/windows/4.4.4.tar.gz
105+
URL_HASH SHA256=9f9a65cf03a3e164edca601ba18180a504e44e03fae48ce706ca3120b55a4db5
106106
)
107107
FetchContent_Declare(
108108
f5

0 commit comments

Comments
 (0)