Skip to content

Commit 56fff61

Browse files
author
pytorchbot
committed
2025-07-08 nightly release (eb51e0e)
1 parent dd94c26 commit 56fff61

File tree

13 files changed

+382
-70
lines changed

13 files changed

+382
-70
lines changed

.github/workflows/build_ffmpeg.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,25 @@ jobs:
7070
artifact_dir="${RUNNER_ARTIFACT_DIR}/$(date +%Y-%m-%d)/macos_$(uname -m)"
7171
mkdir -p "${artifact_dir}"
7272
mv ffmpeg.tar.gz "${artifact_dir}/${FFMPEG_VERSION}.tar.gz"
73+
74+
LGPL-Windows:
75+
strategy:
76+
fail-fast: false
77+
matrix:
78+
ffmpeg-version: ["4.4.4", "5.1.4", "6.1.1", "7.0.1"]
79+
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
80+
with:
81+
job-name: Build
82+
upload-artifact: ffmpeg-lgpl-windows_x86_64-${{ matrix.ffmpeg-version }}
83+
repository: pytorch/torchcodec
84+
script: |
85+
export FFMPEG_VERSION="${{ matrix.ffmpeg-version }}"
86+
export FFMPEG_ROOT="${PWD}/ffmpeg"
87+
88+
packaging/build_ffmpeg.bat
89+
90+
tar -cf ffmpeg.tar.gz ffmpeg/include ffmpeg/bin
91+
92+
artifact_dir="${RUNNER_ARTIFACT_DIR}/$(date +%Y-%m-%d)/windows_$(uname -m)"
93+
mkdir -p "${artifact_dir}"
94+
mv ffmpeg.tar.gz "${artifact_dir}/${FFMPEG_VERSION}.tar.gz"

examples/encoding/audio_encoding.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ def make_sinewave() -> tuple[torch.Tensor, int]:
7878
# %%
7979
# The encoder supports some encoding options that allow you to change how to
8080
# data is encoded. For example, we can decide to encode our mono data (1
81-
# channel) into stereo data (2 channels):
82-
encoded_samples = encoder.to_tensor(format="wav", num_channels=2)
81+
# channel) into stereo data (2 channels), and to specify an output sample rate:
82+
83+
desired_sample_rate = 32000
84+
encoded_samples = encoder.to_tensor(format="wav", num_channels=2, sample_rate=desired_sample_rate)
8385

8486
stereo_samples_back = AudioDecoder(encoded_samples).get_all_samples()
8587

8688
print(stereo_samples_back)
87-
play_audio(stereo_samples_back.data, rate=stereo_samples_back.sample_rate)
89+
play_audio(stereo_samples_back.data, rate=desired_sample_rate)
8890

8991
# %%
9092
# Check the docstring of the encoding methods to learn about the different

packaging/build_ffmpeg.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:: Taken from torchaudio
2+
@echo off
3+
4+
set PROJ_FOLDER=%cd%
5+
6+
choco install -y --no-progress msys2 --package-parameters "/NoUpdate"
7+
C:\tools\msys64\usr\bin\env MSYSTEM=MINGW64 /bin/bash -l -c "pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain diffutils"
8+
C:\tools\msys64\usr\bin\env MSYSTEM=MINGW64 /bin/bash -l -c "cd ${PROJ_FOLDER} && packaging/vc_env_helper.bat bash packaging/build_ffmpeg.sh"
9+
10+
:end

packaging/vc_env_helper.bat

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
:: Taken from torchaudio
2+
@echo on
3+
4+
set VC_VERSION_LOWER=17
5+
set VC_VERSION_UPPER=18
6+
7+
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
8+
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
9+
set "VS15INSTALLDIR=%%i"
10+
set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat"
11+
goto vswhere
12+
)
13+
)
14+
15+
:vswhere
16+
if "%VSDEVCMD_ARGS%" == "" (
17+
call "%VS15VCVARSALL%" x64 || exit /b 1
18+
) else (
19+
call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% || exit /b 1
20+
)
21+
22+
@echo on
23+
24+
if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
25+
26+
set DISTUTILS_USE_SDK=1
27+
28+
set args=%1
29+
shift
30+
:start
31+
if [%1] == [] goto done
32+
set args=%args% %1
33+
shift
34+
goto start
35+
36+
:done
37+
if "%args%" == "" (
38+
echo Usage: vc_env_helper.bat [command] [args]
39+
echo e.g. vc_env_helper.bat cl /c test.cpp
40+
)
41+
42+
%args% || exit /b 1

0 commit comments

Comments
 (0)