Closed zdposter closed 1 year ago
Hi
It seems like you have statically linked ffmpeg
command. What TorchAudio requires is not ffmpeg
command itself but the library used by ffmpeg
, that is libavformat
and such. The message says FFmpeg for simplicity.
The website you used to download ffmpeg
, https://www.gyan.dev/ffmpeg/builds/ also provides shared libraries, so you can download and place the DLL files to proper locations according to your system's configuration.
Thank you very much for response. As far as I see gyan.dev/ffmpeg/builds provide 5.x ffmpeg version but Readme mentions this:
Note This software was compiled against an unmodified copy of FFmpeg (licensed under the LGPLv2.1), with the specific rpath removed so as to enable the use of system libraries. The LGPL source can be downloaded here.
which should be 4.1. and it is very old version.
gyan.dev older releases are without version info (there is just build date info)... I am convinced windows wheel of torchaudio should include all necessary libs (that can not be installed with pip) especially if package requires specific version of external library. Another reason for distribution of ffmpeg dlls is change of ctypes behaviour on windows from python 3.8: dll are loaded only from trusted location.
TorchAudio is complied against FFmpeg 4.1, so that it works with all the versions from 4.1 to 4.4. FFmpeg 5 was too new when we implemented the feature. We do not want to drop the support for FFmpeg 4 yet, but supporting both 4 and 5 requires major work, and we do not have a bandwidth to do so at the moment. If you want to use FFmpeg 5, you can build torchaudio from source.
We cannot always include third party libraries due to licenses they impose.
I do not want to use FFmpeg 5 - I want to use TorchAudio on Windows ;-)
The whole process for making TorchAudio work is quite frustrating: e.g. bucket401.blogspot.com suggest to use ffmpeg-n4.3.2-160-gfbb9368226-win64-lgpl-shared-4.3.zip but with this version torch.classes.torchaudio.ffmpeg_StreamReader
(later) raise another error: RuntimeError: Unsupported device/format: "avfoundation"
...
So FFmpeg=< 4.1<4.4 is not sufficient description for requirement... It also need support for avfoundation
.
Can you just provide link to FFmpeg(compiled) version that will work with TorchAudio?
I understand you cannot always include third party libraries, but for me it looks like I can not use TorchAudio without FFmpeg. And I see a lot other projects to distribute ffmpeg (at least I found this program installing ffmpeg.dll on my computer: VS Code, MS Teams, Skype, Edge, LogiTune, oneAPI, Dropbox, Obsidian...)
I just find out that problem with "avfoundation" is problem of script I am testing (AVFoundation is the currently recommended framework by Apple for streamgrabbing on OSX >= 10.7 as well as on iOS.), but rest of points (you you can not distribute it, provide link to package that works with TorchAudio) are valid
I have been confused by this as well. What helped me is to bind the ffmpeg dlls like so :
import os ffmpeg_path = r"C:\localTools\ffmpeg-n5.1.3-12-g3344d47a88-win64-lgpl-shared-5.1\bin" os.environ["PATH"] += os.pathsep + ffmpeg_path os.add_dll_directory(ffmpeg_path)
I did not been aware of the os.add_dll_directrory
hope this helps.
According to https://pytorch.org/audio/master/installation.html
conda install -c conda-forge 'ffmpeg<7'
works for me.
🐛 Describe the bug
crashed with:
I installed
torchaudio
with:Output for ffmpeg:
Versions
cc @peterjc123 @maxluk @nbcsm @guyang3532 @gunandrose4u @smartcat2010 @mszhanyi