From de8c59cb54d9bbf58135fab46c755c0f39a307d2 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sat, 12 Jul 2025 21:52:23 +0100 Subject: [PATCH 1/7] Debug ffmpeg4 CUDA --- .github/workflows/linux_cuda_wheel.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index bd57cac5..689bed23 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -91,7 +91,7 @@ jobs: with: python-version: ${{ matrix.python-version }} # We install conda packages at the start because otherwise conda may have conflicts with dependencies. - default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }}" + default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }} conda-forge::xorg-libxau" - name: Check env run: | ${CONDA_RUN} env From df5010a75bacc2d3fe3854a98f920abd9ac7002b Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 13 Jul 2025 09:07:51 +0100 Subject: [PATCH 2/7] Add comment --- .github/workflows/linux_cuda_wheel.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index 689bed23..d1fd2c2f 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -69,7 +69,7 @@ jobs: python-version: ['3.9'] cuda-version: ['12.6', '12.8'] # TODO: put back ffmpeg 5 https://github.com/pytorch/torchcodec/issues/325 - ffmpeg-version-for-tests: ['4.4.2', '6', '7'] + ffmpeg-version-for-tests: ['4.4.2', '5', '6', '7'] container: image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}" @@ -91,6 +91,7 @@ jobs: with: python-version: ${{ matrix.python-version }} # We install conda packages at the start because otherwise conda may have conflicts with dependencies. + # Note: xorg-libxau was addded to fix a problem with ffmpeg 4. We should consider removing it. default-packages: "nvidia/label/cuda-${{ matrix.cuda-version }}.0::libnpp nvidia::cuda-nvrtc=${{ matrix.cuda-version }} nvidia::cuda-toolkit=${{ matrix.cuda-version }} nvidia::cuda-cudart=${{ matrix.cuda-version }} nvidia::cuda-driver-dev=${{ matrix.cuda-version }} conda-forge::ffmpeg=${{ matrix.ffmpeg-version-for-tests }} conda-forge::xorg-libxau" - name: Check env run: | From 48901fea26f1eb773b513d29b2be020734cbcae2 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 13 Jul 2025 09:45:51 +0100 Subject: [PATCH 3/7] Add same skips for 5? --- test/test_decoders.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_decoders.py b/test/test_decoders.py index dcf9a158..0e601340 100644 --- a/test/test_decoders.py +++ b/test/test_decoders.py @@ -360,7 +360,7 @@ def test_getitem_slice(self, device, seek_mode): ] ) for sliced, ref in zip(all_frames, decoder): - if not (device == "cuda" and get_ffmpeg_major_version() == 4): + if not (device == "cuda" and get_ffmpeg_major_version() in (4, 5)): # TODO: remove the "if". # See https://github.com/pytorch/torchcodec/issues/428 assert_frames_equal(sliced, ref) @@ -563,7 +563,7 @@ def test_get_frames_at_fails(self, device, seek_mode): @pytest.mark.parametrize("device", cpu_and_cuda()) def test_get_frame_at_av1(self, device): - if device == "cuda" and get_ffmpeg_major_version() == 4: + if device == "cuda" and get_ffmpeg_major_version() in (4, 5): return decoder = VideoDecoder(AV1_VIDEO.path, device=device) @@ -1445,7 +1445,7 @@ def test_s16_ffmpeg4_bug(self): cm = ( pytest.raises(RuntimeError, match="The frame has 0 channels, expected 1.") - if get_ffmpeg_major_version() == 4 + if get_ffmpeg_major_version() in (4, 5) else contextlib.nullcontext() ) with cm: From 4abaa9d6f684cc548282654653bc878a6c556644 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 13 Jul 2025 09:57:18 +0100 Subject: [PATCH 4/7] Fix one --- test/test_decoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_decoders.py b/test/test_decoders.py index 0e601340..a93ff8ed 100644 --- a/test/test_decoders.py +++ b/test/test_decoders.py @@ -1445,7 +1445,7 @@ def test_s16_ffmpeg4_bug(self): cm = ( pytest.raises(RuntimeError, match="The frame has 0 channels, expected 1.") - if get_ffmpeg_major_version() in (4, 5) + if get_ffmpeg_major_version() == 4 else contextlib.nullcontext() ) with cm: From 1cce117d9ba135839ee501336664453aab765b02 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 13 Jul 2025 10:28:05 +0100 Subject: [PATCH 5/7] Revert "Fix one" This reverts commit 4abaa9d6f684cc548282654653bc878a6c556644. --- test/test_decoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_decoders.py b/test/test_decoders.py index a93ff8ed..0e601340 100644 --- a/test/test_decoders.py +++ b/test/test_decoders.py @@ -1445,7 +1445,7 @@ def test_s16_ffmpeg4_bug(self): cm = ( pytest.raises(RuntimeError, match="The frame has 0 channels, expected 1.") - if get_ffmpeg_major_version() == 4 + if get_ffmpeg_major_version() in (4, 5) else contextlib.nullcontext() ) with cm: From 3818135f34015bde542e5be613217129de1eb369 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 13 Jul 2025 10:28:06 +0100 Subject: [PATCH 6/7] Revert "Add same skips for 5?" This reverts commit 48901fea26f1eb773b513d29b2be020734cbcae2. --- test/test_decoders.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_decoders.py b/test/test_decoders.py index 0e601340..dcf9a158 100644 --- a/test/test_decoders.py +++ b/test/test_decoders.py @@ -360,7 +360,7 @@ def test_getitem_slice(self, device, seek_mode): ] ) for sliced, ref in zip(all_frames, decoder): - if not (device == "cuda" and get_ffmpeg_major_version() in (4, 5)): + if not (device == "cuda" and get_ffmpeg_major_version() == 4): # TODO: remove the "if". # See https://github.com/pytorch/torchcodec/issues/428 assert_frames_equal(sliced, ref) @@ -563,7 +563,7 @@ def test_get_frames_at_fails(self, device, seek_mode): @pytest.mark.parametrize("device", cpu_and_cuda()) def test_get_frame_at_av1(self, device): - if device == "cuda" and get_ffmpeg_major_version() in (4, 5): + if device == "cuda" and get_ffmpeg_major_version() == 4: return decoder = VideoDecoder(AV1_VIDEO.path, device=device) @@ -1445,7 +1445,7 @@ def test_s16_ffmpeg4_bug(self): cm = ( pytest.raises(RuntimeError, match="The frame has 0 channels, expected 1.") - if get_ffmpeg_major_version() in (4, 5) + if get_ffmpeg_major_version() == 4 else contextlib.nullcontext() ) with cm: From 24646b7347f40aba05e8acf8ab5970bdcfbce6a1 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Sun, 13 Jul 2025 10:28:32 +0100 Subject: [PATCH 7/7] Remove 5 --- .github/workflows/linux_cuda_wheel.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux_cuda_wheel.yaml b/.github/workflows/linux_cuda_wheel.yaml index d1fd2c2f..61d6f50d 100644 --- a/.github/workflows/linux_cuda_wheel.yaml +++ b/.github/workflows/linux_cuda_wheel.yaml @@ -69,7 +69,7 @@ jobs: python-version: ['3.9'] cuda-version: ['12.6', '12.8'] # TODO: put back ffmpeg 5 https://github.com/pytorch/torchcodec/issues/325 - ffmpeg-version-for-tests: ['4.4.2', '5', '6', '7'] + ffmpeg-version-for-tests: ['4.4.2', '6', '7'] container: image: "pytorch/manylinux2_28-builder:cuda${{ matrix.cuda-version }}"