"docs/git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "5d8d61acc907a0e80bfee6dd35a22e4c75f16e82"
Commit bf07ea6b authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

[BC-breaking] Update pre-built ffmpeg4 to 4.4.4 (#3561)

Summary:
In https://github.com/pytorch/audio/pull/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 https://github.com/pytorch/audio/issues/3460, each binary build job was building FFmpeg 4.1.8 using the same compiler used to build torchaudio,
but after https://github.com/pytorch/audio/issues/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: https://github.com/pytorch/audio/pull/3561

Reviewed By: hwangjeff

Differential Revision: D48340201

Pulled By: mthrok

fbshipit-source-id: 7ece82910f290c7cf83f58311c4cf6a384e8795e
parent 2e0dfafa
...@@ -16,7 +16,7 @@ Please refer to https://pytorch.org/get-started/locally/ for the details. ...@@ -16,7 +16,7 @@ Please refer to https://pytorch.org/get-started/locally/ for the details.
each of which requires a corresponding PyTorch distribution. each of which requires a corresponding PyTorch distribution.
.. note:: .. note::
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>`__). 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>`__).
Dependencies Dependencies
------------ ------------
...@@ -25,18 +25,28 @@ Dependencies ...@@ -25,18 +25,28 @@ Dependencies
Please refer to the compatibility matrix bellow for supported PyTorch versions. Please refer to the compatibility matrix bellow for supported PyTorch versions.
.. _optional_dependencies:
Optional Dependencies Optional Dependencies
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
.. _ffmpeg:
* `FFmpeg <https://ffmpeg.org>`__ * `FFmpeg <https://ffmpeg.org>`__
Required to use :py:mod:`torchaudio.io` module. and ``backend="ffmpeg"`` in Required to use :py:mod:`torchaudio.io` module. and ``backend="ffmpeg"`` in
`I/O functions <./torchaudio.html#i-o>`__. `I/O functions <./torchaudio.html#i-o>`__.
Starting version 2.1, TorchAudio official binary distributions are compatible with Starting version 2.1, TorchAudio official binary distributions are compatible with
FFmpeg version 6, 5 and 4. At runtime, TorchAudio first looks for FFmpeg 6, FFmpeg version 6, 5 and 4. (>=4.4, <7). At runtime, TorchAudio first looks for FFmpeg 6,
if not found, then it continues to looks for 5 and move on to 4. if not found, then it continues to looks for 5 and move on to 4.
There are multiple ways to install FFmpeg libraries.
Please refer to the official documentation for how to install FFmpeg.
If you are using Anaconda Python distribution,
``conda install -c conda-forge 'ffmpeg<7'`` will install
compatible FFmpeg libraries.
If you need to specify the version of FFmpeg TorchAudio searches and links, you can If you need to specify the version of FFmpeg TorchAudio searches and links, you can
specify it via the environment variable ``TORCHAUDIO_USE_FFMPEG_VERSION``. For example, specify it via the environment variable ``TORCHAUDIO_USE_FFMPEG_VERSION``. For example,
by setting ``TORCHAUDIO_USE_FFMPEG_VERSION=5``, TorchAudio will only look for FFmpeg by setting ``TORCHAUDIO_USE_FFMPEG_VERSION=5``, TorchAudio will only look for FFmpeg
...@@ -46,6 +56,11 @@ Optional Dependencies ...@@ -46,6 +56,11 @@ Optional Dependencies
the FFmpeg integration entirely by setting the environment variable the FFmpeg integration entirely by setting the environment variable
``TORCHAUDIO_USE_FFMPEG=0``. ``TORCHAUDIO_USE_FFMPEG=0``.
There are multiple ways to install FFmpeg libraries.
If you are using Anaconda Python distribution,
``conda install -c conda-forge 'ffmpeg<7'`` will install
compatible FFmpeg libraries.
.. note:: .. note::
When searching for FFmpeg installation, TorchAudio looks for library files When searching for FFmpeg installation, TorchAudio looks for library files
...@@ -86,6 +101,7 @@ Optional Dependencies ...@@ -86,6 +101,7 @@ Optional Dependencies
* `sentencepiece <https://pypi.org/project/sentencepiece/>`__ * `sentencepiece <https://pypi.org/project/sentencepiece/>`__
Required for performing automatic speech recognition with :ref:`Emformer RNN-T<RNNT>`. Required for performing automatic speech recognition with :ref:`Emformer RNN-T<RNNT>`.
You can install it by running ``pip install sentencepiece``.
* `deep-phonemizer <https://pypi.org/project/deep-phonemizer/>`__ * `deep-phonemizer <https://pypi.org/project/deep-phonemizer/>`__
......
...@@ -7,26 +7,23 @@ Device ASR with Emformer RNN-T ...@@ -7,26 +7,23 @@ Device ASR with Emformer RNN-T
This tutorial shows how to use Emformer RNN-T and streaming API This tutorial shows how to use Emformer RNN-T and streaming API
to perform speech recognition on a streaming device input, i.e. microphone to perform speech recognition on a streaming device input, i.e. microphone
on laptop. on laptop.
.. note::
This tutorial requires FFmpeg libraries (>=4.1, <7) and SentencePiece.
There are multiple ways to install FFmpeg libraries.
If you are using Anaconda Python distribution,
``conda install -c conda-forge 'ffmpeg<7'`` will install
compatible FFmpeg libraries.
You can install SentencePiece by running ``pip install sentencepiece``.
.. note::
This tutorial was tested on MacBook Pro and Dynabook with Windows 10.
This tutorial does NOT work on Google Colab because the server running
this tutorial does not have a microphone that you can talk to.
""" """
######################################################################
#
# .. note::
#
# This tutorial requires FFmpeg libraries.
# Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
# the detail.
#
# .. note::
#
# This tutorial was tested on MacBook Pro and Dynabook with Windows 10.
#
# This tutorial does NOT work on Google Colab because the server running
# this tutorial does not have a microphone that you can talk to.
###################################################################### ######################################################################
# 1. Overview # 1. Overview
# ----------- # -----------
......
...@@ -13,12 +13,9 @@ apply various effects and codecs to waveform tensor. ...@@ -13,12 +13,9 @@ apply various effects and codecs to waveform tensor.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <7). # This tutorial requires FFmpeg libraries.
# # Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
# There are multiple ways to install FFmpeg libraries. # the detail.
# If you are using Anaconda Python distribution,
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
# compatible FFmpeg libraries.
# #
###################################################################### ######################################################################
...@@ -42,25 +39,15 @@ print(torchaudio.__version__) ...@@ -42,25 +39,15 @@ print(torchaudio.__version__)
###################################################################### ######################################################################
# #
try: from torchaudio.io import AudioEffector, CodecConfig
from torchaudio.io import AudioEffector, CodecConfig
except ImportError as err:
raise RuntimeError(
"This tutorial requires nightly build of TorchAudio. "
"Please install the nightly versions of PyTorch and torchaudio. "
"https://pytorch.org/get-started/locally/"
) from err
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from IPython.display import Audio from IPython.display import Audio
###################################################################### ######################################################################
# #
try: for k, v in torchaudio.utils.ffmpeg_utils.get_versions().items():
for k, v in torchaudio.utils.ffmpeg_utils.get_versions().items(): print(k, v)
print(k, v)
except Exception:
raise RuntimeError("This tutorial requires FFmpeg libraries 4.2>,<5. " "Please install FFmpeg.")
###################################################################### ######################################################################
# Usage # Usage
......
...@@ -13,14 +13,11 @@ to perform online speech recognition. ...@@ -13,14 +13,11 @@ to perform online speech recognition.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <7) and SentencePiece. # This tutorial requires FFmpeg libraries and SentencePiece.
# #
# There are multiple ways to install FFmpeg libraries. # Please refer to :ref:`Optional Dependencies <optional_dependencies>`
# If you are using Anaconda Python distribution, # for the detail.
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
# compatible FFmpeg libraries.
# #
# You can install SentencePiece by running ``pip install sentencepiece``.
###################################################################### ######################################################################
# 1. Overview # 1. Overview
......
...@@ -14,12 +14,9 @@ libavfilter provides. ...@@ -14,12 +14,9 @@ libavfilter provides.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <7). # This tutorial requires FFmpeg libraries.
# # Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
# There are multiple ways to install FFmpeg libraries. # the detail.
# If you are using Anaconda Python distribution,
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
# compatible FFmpeg libraries.
# #
###################################################################### ######################################################################
......
...@@ -23,14 +23,9 @@ play audio and video. ...@@ -23,14 +23,9 @@ play audio and video.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <7). # This tutorial requires FFmpeg libraries.
# # Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
# There are multiple ways to install FFmpeg libraries. # the detail.
# If you are using Anaconda Python distribution,
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
# compatible FFmpeg libraries.
# However, this distribution does not have SDL plugin, so it cannot play
# video.
# #
###################################################################### ######################################################################
......
...@@ -13,12 +13,9 @@ encode and save audio/video data into various formats/destinations. ...@@ -13,12 +13,9 @@ encode and save audio/video data into various formats/destinations.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <7). # This tutorial requires FFmpeg libraries.
# # Please refer to :ref:`FFmpeg dependency <ffmpeg_dependency>` for
# There are multiple ways to install FFmpeg libraries. # the detail.
# If you are using Anaconda Python distribution,
# ``conda install -c conda-forge 'ffmpeg<7'`` will install
# compatible FFmpeg libraries.
# #
###################################################################### ######################################################################
......
...@@ -15,8 +15,8 @@ if (APPLE) ...@@ -15,8 +15,8 @@ if (APPLE)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64") if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
FetchContent_Declare( FetchContent_Declare(
f4 f4
URL ${base_url}/2023-07-06/macos_arm64/4.1.8.tar.gz URL ${base_url}/2023-08-14/macos_arm64/4.4.4.tar.gz
URL_HASH SHA256=a44b8152b7f204ce5050fc7f6fd2bbbafe7ae4e45f03e135f3b45dd9a08f404e URL_HASH SHA256=9a593eb241eb8b23bc557856ee6db5d9aecd2d8895c614a949f3a1ad9799c1a1
) )
FetchContent_Declare( FetchContent_Declare(
f5 f5
...@@ -31,8 +31,8 @@ if (APPLE) ...@@ -31,8 +31,8 @@ if (APPLE)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
FetchContent_Declare( FetchContent_Declare(
f4 f4
URL ${base_url}/2023-07-06/macos_x86_64/4.1.8.tar.gz URL ${base_url}/2023-08-14/macos_x86_64/4.4.4.tar.gz
URL_HASH SHA256=392d5af0b24535bfc69d6244e7595e5f07117b93d94505d0a4b34c82ae479f48 URL_HASH SHA256=0935e359c0864969987d908397f9208d6dc4dc0ef8bfe2ec730bb2c44eae89fc
) )
FetchContent_Declare( FetchContent_Declare(
f5 f5
...@@ -58,8 +58,8 @@ elseif (UNIX) ...@@ -58,8 +58,8 @@ elseif (UNIX)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
FetchContent_Declare( FetchContent_Declare(
f4 f4
URL ${base_url}/2023-07-06/linux_aarch64/4.1.8.tar.gz URL ${base_url}/2023-08-14/linux_aarch64/4.4.4.tar.gz
URL_HASH SHA256=aae0b713040e30ceebe0d0bc82353d3d9054055c7af8a4f4abc1766015ab7681 URL_HASH SHA256=6f00437d13a3b3812ebe81c6e6f3a84a58f260d946a1995df87ba09aae234504
) )
FetchContent_Declare( FetchContent_Declare(
f5 f5
...@@ -74,8 +74,8 @@ elseif (UNIX) ...@@ -74,8 +74,8 @@ elseif (UNIX)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
FetchContent_Declare( FetchContent_Declare(
f4 f4
URL ${base_url}/2023-07-06/linux_x86_64/4.1.8.tar.gz URL ${base_url}/2023-08-14/linux_x86_64/4.4.4.tar.gz
URL_HASH SHA256=52e53b8857739bdd54f9d8541e22569b57f6c6f16504ee83963c2ed3e7061a23 URL_HASH SHA256=9b87eeba9b6975e25f28ba12163bd713228ed84f4c2b3721bc5ebe92055edb51
) )
FetchContent_Declare( FetchContent_Declare(
f5 f5
...@@ -101,8 +101,8 @@ elseif (UNIX) ...@@ -101,8 +101,8 @@ elseif (UNIX)
elseif(MSVC) elseif(MSVC)
FetchContent_Declare( FetchContent_Declare(
f4 f4
URL ${base_url}/2023-07-06/windows/4.1.8.tar.gz URL ${base_url}/2023-08-14/windows/4.4.4.tar.gz
URL_HASH SHA256=c45cd36e0575490f97ace07365bb67c5e1cbe9f3e6a4272d035c19348df96790 URL_HASH SHA256=9f9a65cf03a3e164edca601ba18180a504e44e03fae48ce706ca3120b55a4db5
) )
FetchContent_Declare( FetchContent_Declare(
f5 f5
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment