Skip to content

Commit

Permalink
2023-07-08 nightly release (9c7bf1b)
Browse files Browse the repository at this point in the history
  • Loading branch information
chronos_secgrp_pytorch_oss_ci_oncall committed Jul 8, 2023
1 parent a42a8b8 commit 28150c5
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 291 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ if (BUILD_SOX)
add_subdirectory(torchaudio/csrc/sox)
endif()
if (USE_FFMPEG)
add_subdirectory(third_party/ffmpeg)
add_subdirectory(torchaudio/csrc/ffmpeg)
endif()
if (BUILD_CUDA_CTC_DECODER)
Expand Down
264 changes: 0 additions & 264 deletions cmake/FindFFMPEG.cmake

This file was deleted.

91 changes: 91 additions & 0 deletions third_party/ffmpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
################################################################################
# This file defines the following FFmpeg libraries using pre-built binaries.

add_library(ffmpeg4 INTERFACE)
add_library(ffmpeg ALIAS ffmpeg4)

################################################################################

include(FetchContent)

set(base_url https://pytorch.s3.amazonaws.com/torchaudio/ffmpeg)

if (APPLE)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
FetchContent_Declare(
f4
URL ${base_url}/2023-07-06/macos_arm64/4.1.8.tar.gz
URL_HASH SHA256=a44b8152b7f204ce5050fc7f6fd2bbbafe7ae4e45f03e135f3b45dd9a08f404e
)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
FetchContent_Declare(
f4
URL ${base_url}/2023-07-06/macos_x86_64/4.1.8.tar.gz
URL_HASH SHA256=392d5af0b24535bfc69d6244e7595e5f07117b93d94505d0a4b34c82ae479f48
)
else ()
message(
FATAL_ERROR
"CPU architecture ${CMAKE_SYSTEM_PROCESSOR} is not currently supported. If you do not need FFmpeg integration, then setting USE_FFMPEG=0 will bypass the issue.")
endif()
elseif (UNIX)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
FetchContent_Declare(
f4
URL ${base_url}/2023-07-06/linux_aarch64/4.1.8.tar.gz
URL_HASH SHA256=aae0b713040e30ceebe0d0bc82353d3d9054055c7af8a4f4abc1766015ab7681
)
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
FetchContent_Declare(
f4
URL ${base_url}/2023-07-06/linux_x86_64/4.1.8.tar.gz
URL_HASH SHA256=52e53b8857739bdd54f9d8541e22569b57f6c6f16504ee83963c2ed3e7061a23
)
else ()
# Possible case ppc64le (though it's not officially supported.)
message(
FATAL_ERROR
"CPU architecture ${CMAKE_SYSTEM_PROCESSOR} is not currently supported. If you do not need FFmpeg integration, then setting USE_FFMPEG=0 will bypass the issue.")
endif()
elseif(MSVC)
FetchContent_Declare(
f4
URL ${base_url}/2023-07-06/windows/4.1.8.tar.gz
URL_HASH SHA256=c45cd36e0575490f97ace07365bb67c5e1cbe9f3e6a4272d035c19348df96790
)
endif()

FetchContent_MakeAvailable(f4)
target_include_directories(ffmpeg4 INTERFACE ${f4_SOURCE_DIR}/include)

if(APPLE)
target_link_libraries(
ffmpeg4
INTERFACE
${f4_SOURCE_DIR}/lib/libavutil.56.dylib
${f4_SOURCE_DIR}/lib/libavcodec.58.dylib
${f4_SOURCE_DIR}/lib/libavformat.58.dylib
${f4_SOURCE_DIR}/lib/libavdevice.58.dylib
${f4_SOURCE_DIR}/lib/libavfilter.7.dylib
)
elseif (UNIX)
target_link_libraries(
ffmpeg4
INTERFACE
${f4_SOURCE_DIR}/lib/libavutil.so.56
${f4_SOURCE_DIR}/lib/libavcodec.so.58
${f4_SOURCE_DIR}/lib/libavformat.so.58
${f4_SOURCE_DIR}/lib/libavdevice.so.58
${f4_SOURCE_DIR}/lib/libavfilter.so.7
)
elseif(MSVC)
target_link_libraries(
ffmpeg4
INTERFACE
${f4_SOURCE_DIR}/bin/avutil.lib
${f4_SOURCE_DIR}/bin/avcodec.lib
${f4_SOURCE_DIR}/bin/avformat.lib
${f4_SOURCE_DIR}/bin/avdevice.lib
${f4_SOURCE_DIR}/bin/avfilter.lib
)
endif()
2 changes: 1 addition & 1 deletion tools/setup_helpers/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _get_build(var, default=False):
_BUILD_SOX = False if platform.system() == "Windows" else _get_build("BUILD_SOX", True)
_BUILD_RIR = _get_build("BUILD_RIR", True)
_BUILD_RNNT = _get_build("BUILD_RNNT", True)
_USE_FFMPEG = _get_build("USE_FFMPEG", False)
_USE_FFMPEG = _get_build("USE_FFMPEG", True)
_USE_ROCM = _get_build("USE_ROCM", torch.backends.cuda.is_built() and torch.version.hip is not None)
_USE_CUDA = _get_build("USE_CUDA", torch.backends.cuda.is_built() and torch.version.hip is None)
_BUILD_ALIGN = _get_build("BUILD_ALIGN", True)
Expand Down
7 changes: 0 additions & 7 deletions torchaudio/csrc/ffmpeg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
message(STATUS "FFMPEG_ROOT=$ENV{FFMPEG_ROOT}")
find_package(FFMPEG 4.1 REQUIRED COMPONENTS avdevice avfilter avformat avcodec avutil)
add_library(ffmpeg INTERFACE)
target_include_directories(ffmpeg INTERFACE "${FFMPEG_INCLUDE_DIRS}")
target_link_libraries(ffmpeg INTERFACE "${FFMPEG_LIBRARIES}")


set(
sources
ffmpeg.cpp
Expand Down
Loading

0 comments on commit 28150c5

Please sign in to comment.