我正在尝试在 pydub 中将文件导出为 mp3,但出现此错误:
输出流 #0:0 的自动编码器选择失败。mp3 格式的默认编码器可能已禁用。请手动选择编码器
如何手动选择编码器,默认编码器是什么,如何启用它?
PS:我的 Pydub 打开 mp3 文件没有任何问题。我正在使用 Windows 和 Libav。
The other solution did not work for me. The problem for me was that the ffmpeg
version that came installed with Anaconda did not seem to be compiled with an encoder. So instead of:
DEA.L. mp3 MP3 (MPEG audio layer 3) (decoders: mp3 mp3float mp3_at ) (encoders: libmp3lame )
I saw:
DEA.L. mp3 MP3 (MPEG audio layer 3) (decoders: mp3 mp3float mp3_at )
Without the (encoders: ...)
part.
My solution was to do this:
ffmpeg -codecs | grep mp3
, to check if there is any encoder (there isn't!).conda uninstall ffmpeg
brew install ffmpeg --with-libmp3lame
ffmpeg -codecs | grep mp3
, to check if there is any encoder (now there is!).I had the same problem as Emiel, where the ffmpeg
version available in Anaconda did have an mp3 encoder. I solved the problem another way, by installing this version of ffmpeg
from the conda-forge
channel. I used:
conda install -n <anaconda-env> -c conda-forge ffmpeg
Now using ffmpeg -codecs | grep mp3
the mp3 encoders show up:
DEA.L. mp3 MP3 (MPEG audio layer 3) (decoders: mp3float mp3 ) (encoders: libmp3lame libshine )