pytorch / pytorch/audio

Torchaudio is not detecting FFmpeg

Open
#3,789 17 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
799
Avg merge
58m
Merged PRs (30d)
3

Description

🐛 Describe the bug

Hi everyone,

I am trying to use torchaudio with FFmpeg but for some reason it is not being detected.

import torchaudio
print(torchaudio.list_audio_backends())

ffmpeg
ffmpeg files

I added the path 'C:\Program Files\ffmpeg\bin' to the PATH environment variable. As you can see I can execute ffmpeg from cmd. However, when I execute torchaudio.list_audio_backends() only 'soundfile' is detected. I tested this in a Python PIP (I can't use conda) virtual environment with version 3.10 and in another one with version 3.12 but, it didn't work in both. Torchaudio and torch versions are 2.2.1. I don't know if it is a problem with version compatibility but in the official documentation I saw ffmpeg 6 is supported and I checked the code which tries to load the libraries.

I checked a lot of related issues but I couldn't find the right solution.

Any suggestions are welcome!
Thanks.

Versions
Collecting environment information...

PyTorch version: 2.2.1+cpu
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A
OS: Microsoft Windows Server 2022 Standard
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: N/A

Python version: 3.10.7 (tags/v3.10.7:6cc6b13, Sep  5 2022, 14:08:36) [MSC v.1933 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.20348-SP0
Is CUDA available: False
CUDA runtime version: 12.3.103
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: NVIDIA A100-PCIE-40GB
Nvidia driver version: 546.12
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
'wmic' is not recognized as an internal or external command,
operable program or batch file.

Versions of relevant libraries:

[pip3] numpy==1.26.4
[pip3] pytorch-lightning==2.2.4
[pip3] pytorch-metric-learning==2.5.0
[pip3] torch==2.2.1
[pip3] torch-audiomentations==0.11.1
[pip3] torch-pitch-shift==1.2.4
[pip3] torchaudio==2.2.1
[pip3] torchmetrics==1.4.0
[conda] Could not collect

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report in a Python pip virtual environment on Windows Server 2022 with torch and torchaudio 2.2.1, then run torchaudio.list_audio_backends(). Inspect the FFmpeg library-loading code mentioned in the issue and compare it with the Windows PATH setup and FFmpeg 6 support described there. Done means identifying why only soundfile is detected and confirming the behavior or required change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
audio-video-rtc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.