Commit d38a7854 authored by moto's avatar moto Committed by Facebook GitHub Bot
Browse files

Upgrade to FFmpeg5 (#3298)

Summary:
This commit upgrade the version of FFmpeg compiled against TorchAudio binary distribution to 5.0.4.

FFmpeg 5.0 was released in Jan 2022, and many package managers provide a version of FFmpeg v5.
Conda-forge lists 5.1 for all the platforms TorchAudio supports.https://anaconda.org/conda-forge/ffmpeg

Pull Request resolved: https://github.com/pytorch/audio/pull/3298

Reviewed By: hwangjeff

Differential Revision: D45865599

Pulled By: mthrok

fbshipit-source-id: d95638eb80daaf477a710a992f4ead9b9009bb9b
parent e4c1d70b
...@@ -462,7 +462,7 @@ jobs: ...@@ -462,7 +462,7 @@ jobs:
name: smoke test name: smoke test
command: | command: |
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION} source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
conda install 'ffmpeg<5' conda install 'ffmpeg>=5.0,<6'
./test/smoke_test/run_smoke_test.sh ./test/smoke_test/run_smoke_test.sh
smoke_test_linux_conda_gpu: smoke_test_linux_conda_gpu:
...@@ -485,7 +485,7 @@ jobs: ...@@ -485,7 +485,7 @@ jobs:
name: smoke test name: smoke test
command: | command: |
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION} source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
conda install 'ffmpeg<5' conda install 'ffmpeg>=5.0,<6'
./test/smoke_test/run_smoke_test.sh ./test/smoke_test/run_smoke_test.sh
smoke_test_linux_pip: smoke_test_linux_pip:
...@@ -537,11 +537,7 @@ jobs: ...@@ -537,11 +537,7 @@ jobs:
command: | command: |
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')" eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate python${PYTHON_VERSION} conda activate python${PYTHON_VERSION}
if [[ "${PYTHON_VERSION}" == "3.11" ]]; then conda install 'ffmpeg>=5.0,<6'
conda install -c conda-forge ffmpeg=4.4.2
else
conda install 'ffmpeg<5'
fi
./test/smoke_test/run_smoke_test.sh ./test/smoke_test/run_smoke_test.sh
smoke_test_windows_conda_gpu: smoke_test_windows_conda_gpu:
...@@ -568,7 +564,7 @@ jobs: ...@@ -568,7 +564,7 @@ jobs:
conda env remove -n python${PYTHON_VERSION} || true conda env remove -n python${PYTHON_VERSION} || true
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION} conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
conda activate python${PYTHON_VERSION} conda activate python${PYTHON_VERSION}
conda install -v -y ${CONDA_CHANNEL_FLAGS:-} -c pytorch-${UPLOAD_CHANNEL} -c nvidia pytorch numpy ffmpeg pytorch-cuda=${CU_VERSION:2:2}.${CU_VERSION:4} conda install -v -y ${CONDA_CHANNEL_FLAGS:-} -c pytorch-${UPLOAD_CHANNEL} -c nvidia pytorch numpy 'ffmpeg>=5.0,<6' pytorch-cuda=${CU_VERSION:2:2}.${CU_VERSION:4}
# Install from torchaudio file # Install from torchaudio file
conda install -v -y $(ls ~/workspace/conda-bld/win-64/torchaudio*.tar.bz2) conda install -v -y $(ls ~/workspace/conda-bld/win-64/torchaudio*.tar.bz2)
......
...@@ -462,7 +462,7 @@ jobs: ...@@ -462,7 +462,7 @@ jobs:
name: smoke test name: smoke test
command: | command: |
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION} source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
conda install 'ffmpeg<5' conda install 'ffmpeg>=5.0,<6'
./test/smoke_test/run_smoke_test.sh ./test/smoke_test/run_smoke_test.sh
smoke_test_linux_conda_gpu: smoke_test_linux_conda_gpu:
...@@ -485,7 +485,7 @@ jobs: ...@@ -485,7 +485,7 @@ jobs:
name: smoke test name: smoke test
command: | command: |
source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION} source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
conda install 'ffmpeg<5' conda install 'ffmpeg>=5.0,<6'
./test/smoke_test/run_smoke_test.sh ./test/smoke_test/run_smoke_test.sh
smoke_test_linux_pip: smoke_test_linux_pip:
...@@ -537,11 +537,7 @@ jobs: ...@@ -537,11 +537,7 @@ jobs:
command: | command: |
eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')" eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
conda activate python${PYTHON_VERSION} conda activate python${PYTHON_VERSION}
if [[ "${PYTHON_VERSION}" == "3.11" ]]; then conda install 'ffmpeg>=5.0,<6'
conda install -c conda-forge ffmpeg=4.4.2
else
conda install 'ffmpeg<5'
fi
./test/smoke_test/run_smoke_test.sh ./test/smoke_test/run_smoke_test.sh
smoke_test_windows_conda_gpu: smoke_test_windows_conda_gpu:
...@@ -568,7 +564,7 @@ jobs: ...@@ -568,7 +564,7 @@ jobs:
conda env remove -n python${PYTHON_VERSION} || true conda env remove -n python${PYTHON_VERSION} || true
conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION} conda create -yn python${PYTHON_VERSION} python=${PYTHON_VERSION}
conda activate python${PYTHON_VERSION} conda activate python${PYTHON_VERSION}
conda install -v -y ${CONDA_CHANNEL_FLAGS:-} -c pytorch-${UPLOAD_CHANNEL} -c nvidia pytorch numpy ffmpeg pytorch-cuda=${CU_VERSION:2:2}.${CU_VERSION:4} conda install -v -y ${CONDA_CHANNEL_FLAGS:-} -c pytorch-${UPLOAD_CHANNEL} -c nvidia pytorch numpy 'ffmpeg>=5.0,<6' pytorch-cuda=${CU_VERSION:2:2}.${CU_VERSION:4}
# Install from torchaudio file # Install from torchaudio file
conda install -v -y $(ls ~/workspace/conda-bld/win-64/torchaudio*.tar.bz2) conda install -v -y $(ls ~/workspace/conda-bld/win-64/torchaudio*.tar.bz2)
......
...@@ -36,4 +36,4 @@ conda activate "${env_dir}" ...@@ -36,4 +36,4 @@ conda activate "${env_dir}"
# 3. Install minimal build tools # 3. Install minimal build tools
pip --quiet install cmake ninja pip --quiet install cmake ninja
conda install --quiet -y 'ffmpeg>=4.1' pkg-config conda install --quiet -y -c conda-forge 'ffmpeg==5.1' pkg-config
...@@ -35,4 +35,4 @@ conda activate "${env_dir}" ...@@ -35,4 +35,4 @@ conda activate "${env_dir}"
# 3. Install minimal build tools # 3. Install minimal build tools
pip --quiet install cmake ninja pip --quiet install cmake ninja
conda install --quiet -y 'ffmpeg>=4.1' conda install --quiet -y -c conda-forge 'ffmpeg==5.1'
...@@ -61,7 +61,7 @@ jobs: ...@@ -61,7 +61,7 @@ jobs:
# Install torchaudio # Install torchaudio
# TODO: Enable NVDec/NVEnc # TODO: Enable NVDec/NVEnc
conda install --quiet -y 'ffmpeg>=4.1' pkg-config conda install --quiet -y -c conda-forge 'ffmpeg>=5.0,<6' pkg-config
pip --quiet install cmake>=3.18.0 ninja pip --quiet install cmake>=3.18.0 ninja
cd packaging cd packaging
. ./pkg_helpers.bash . ./pkg_helpers.bash
......
...@@ -55,7 +55,7 @@ jobs: ...@@ -55,7 +55,7 @@ jobs:
"${CUDATOOLKIT}" "${CUDATOOLKIT}"
# Install torchaudio # Install torchaudio
conda install --quiet -y 'ffmpeg>=4.1' pkg-config conda install --quiet -y -c conda-forge 'ffmpeg==5.1' pkg-config
python3 -m pip --quiet install cmake>=3.18.0 ninja python3 -m pip --quiet install cmake>=3.18.0 ninja
USE_FFMPEG=1 python3 -m pip install -v -e . --no-use-pep517 USE_FFMPEG=1 python3 -m pip install -v -e . --no-use-pep517
......
...@@ -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 copy of FFmpeg (licensed under `the LGPLv2.1 <https://github.com/FFmpeg/FFmpeg/blob/a5d2008e2a2360d351798e9abe883d603e231442/COPYING.LGPLv2.1>`_), with the specific rpath removed so as to enable the use of system libraries. The LGPL source can be downloaded `here <https://github.com/FFmpeg/FFmpeg/releases/tag/n4.1.8>`_. This software was compiled against an unmodified copy of FFmpeg (licensed under `the LGPLv2.1 <https://github.com/FFmpeg/FFmpeg/blob/0e15444aceca0e78f99f3d67758eb79d11b86599/COPYING.LGPLv2.1>`_), with the specific rpath removed so as to enable the use of system libraries. The LGPL source can be downloaded `here <https://github.com/FFmpeg/FFmpeg/releases/tag/n5.0.3>`_.
Dependencies Dependencies
------------ ------------
...@@ -31,8 +31,8 @@ Optional Dependencies ...@@ -31,8 +31,8 @@ Optional Dependencies
* `FFmpeg <https://ffmpeg.org>`_. * `FFmpeg <https://ffmpeg.org>`_.
Required to use :py:mod:`torchaudio.io` module. Required to use :py:mod:`torchaudio.io` module.
TorchAudio official binary distributions are compatible with FFmpeg 4.1 to 4.4. TorchAudio official binary distributions are compatible with FFmpeg 5.
If you need to use FFmpeg 5, please build TorchAudio from source. If you need to use FFmpeg 6, please build TorchAudio from source.
* `sentencepiece <https://pypi.org/project/sentencepiece/>`_ * `sentencepiece <https://pypi.org/project/sentencepiece/>`_
......
...@@ -10,11 +10,11 @@ on laptop. ...@@ -10,11 +10,11 @@ on laptop.
.. note:: .. note::
This tutorial requires FFmpeg libraries (>=4.1, <4.4) and SentencePiece. This tutorial requires FFmpeg libraries (>=5.0, <6) and SentencePiece.
There are multiple ways to install FFmpeg libraries. There are multiple ways to install FFmpeg libraries.
If you are using Anaconda Python distribution, If you are using Anaconda Python distribution,
``conda install 'ffmpeg<4.4'`` will install ``conda install -c conda-forge 'ffmpeg<6'`` will install
the required FFmpeg libraries. the required FFmpeg libraries.
You can install SentencePiece by running ``pip install sentencepiece``. You can install SentencePiece by running ``pip install sentencepiece``.
......
...@@ -13,11 +13,11 @@ apply various effects and codecs to waveform tensor. ...@@ -13,11 +13,11 @@ apply various effects and codecs to waveform tensor.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <5). # This tutorial requires FFmpeg libraries (>=5.0, <6).
# #
# There are multiple ways to install FFmpeg libraries. # There are multiple ways to install FFmpeg libraries.
# If you are using Anaconda Python distribution, # If you are using Anaconda Python distribution,
# ``conda install -c anaconda 'ffmpeg<5'`` will install # ``conda install -c conda-forge 'ffmpeg<6'`` will install
# the required libraries. # the required libraries.
# #
......
...@@ -13,11 +13,11 @@ to perform online speech recognition. ...@@ -13,11 +13,11 @@ to perform online speech recognition.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <4.4) and SentencePiece. # This tutorial requires FFmpeg libraries (>=5, <6) and SentencePiece.
# #
# There are multiple ways to install FFmpeg libraries. # There are multiple ways to install FFmpeg libraries.
# If you are using Anaconda Python distribution, # If you are using Anaconda Python distribution,
# ``conda install 'ffmpeg<4.4'`` will install # ``conda install -c conda-forge 'ffmpeg<6'`` will install
# the required FFmpeg libraries. # the required FFmpeg libraries.
# #
# You can install SentencePiece by running ``pip install sentencepiece``. # You can install SentencePiece by running ``pip install sentencepiece``.
......
...@@ -14,11 +14,11 @@ libavfilter provides. ...@@ -14,11 +14,11 @@ libavfilter provides.
# #
# .. note:: # .. note::
# #
# This tutorial requires FFmpeg libraries (>=4.1, <4.4). # This tutorial requires FFmpeg libraries (>=5.0, <6).
# #
# There are multiple ways to install FFmpeg libraries. # There are multiple ways to install FFmpeg libraries.
# If you are using Anaconda Python distribution, # If you are using Anaconda Python distribution,
# ``conda install -c anaconda 'ffmpeg<4.4'`` will install # ``conda install -c conda-forge 'ffmpeg<6'`` will install
# the required libraries. # the required libraries.
# #
......
...@@ -23,17 +23,14 @@ play audio and video. ...@@ -23,17 +23,14 @@ play audio and video.
# #
# .. note:: # .. note::
# #
# This tutorial requires torchaudio nightly build and FFmpeg libraries (>=4.1, <4.4). # This tutorial requires FFmpeg libraries (>=5.0, <6).
#
# To install torchaudio nightly build, please refer to
# https://pytorch.org/get-started/locally/ .
#
# #
# There are multiple ways to install FFmpeg libraries. # There are multiple ways to install FFmpeg libraries.
# If you are using Anaconda Python distribution, # If you are using Anaconda Python distribution,
# ``conda install 'ffmpeg<4.4'`` will install the required FFmpeg libraries, # ``conda install -c conda-forge 'ffmpeg<6'`` will install
# however, this distribution does not have SDL plugin, so it cannot play # the required libraries.
# video. # This distribution, however, does not have SDL plugin, so
# it cannot play video.
# #
###################################################################### ######################################################################
......
...@@ -13,14 +13,12 @@ encode and save audio/video data into various formats/destinations. ...@@ -13,14 +13,12 @@ encode and save audio/video data into various formats/destinations.
# #
# .. note:: # .. note::
# #
# This tutorial requires torchaudio nightly build and FFmpeg libraries (>=4.1, <4.4). # This tutorial requires FFmpeg libraries (>=5.0, <6).
#
# To install torchaudio nightly build, please refer to
# https://pytorch.org/get-started/locally/ .
# #
# There are multiple ways to install FFmpeg libraries. # There are multiple ways to install FFmpeg libraries.
# If you are using Anaconda Python distribution, # If you are using Anaconda Python distribution,
# ``conda install 'ffmpeg<4.4'`` will install the required FFmpeg libraries. # ``conda install -c conda-forge 'ffmpeg<6'`` will install
# the required libraries.
# #
###################################################################### ######################################################################
......
...@@ -32,7 +32,7 @@ cd "${build_dir}" ...@@ -32,7 +32,7 @@ cd "${build_dir}"
# NOTE: # NOTE:
# When changing the version of FFmpeg, update the README so that the link to the source points # When changing the version of FFmpeg, update the README so that the link to the source points
# the same version. # the same version.
curl -LsS -o ffmpeg.tar.gz https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n4.1.8.tar.gz curl -LsS -o ffmpeg.tar.gz https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n5.0.3.tar.gz
tar -xf ffmpeg.tar.gz --strip-components 1 tar -xf ffmpeg.tar.gz --strip-components 1
./configure \ ./configure \
--prefix="${prefix}" \ --prefix="${prefix}" \
...@@ -72,11 +72,11 @@ ls ${prefix}/* ...@@ -72,11 +72,11 @@ ls ${prefix}/*
# macOS: Fix rpath so that the libraries are searched dynamically in user environment. # macOS: Fix rpath so that the libraries are searched dynamically in user environment.
# In Linux, this is handled by `--enable-rpath` flag. # In Linux, this is handled by `--enable-rpath` flag.
if [[ "$(uname)" == Darwin ]]; then if [[ "$(uname)" == Darwin ]]; then
avcodec=libavcodec.58 avcodec=libavcodec.59
avdevice=libavdevice.58 avdevice=libavdevice.59
avfilter=libavfilter.7 avfilter=libavfilter.8
avformat=libavformat.58 avformat=libavformat.59
avutil=libavutil.56 avutil=libavutil.57
otool="/usr/bin/otool" otool="/usr/bin/otool"
# NOTE: miniconda has a version of otool and install_name_tool installed and we want # NOTE: miniconda has a version of otool and install_name_tool installed and we want
......
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