gstreamer:没有可用于"音频/x-wav"类型的解码器/找不到合适的插件



我开发了一个Kivy Python应用程序。它应该有一个健全的效果。在Kivy中,它简单为:

from kivy.core.audio import SoundLoader
...
def btn(self):
sound = SoundLoader.load("images/crunch.ogg")
if sound:
sound.play()

当这段代码运行时,我得到了:

[WARNING] [AudioGstplayer] b"No decoder available for type 'audio/x-wav'."
[ERROR  ] [AudioGstplayer] b'Your GStreamer installation is missing a plug-in.'
[ERROR  ] [AudioGstplayer] b'Internal data stream error.'

我了解到Kivy使用GStreamer。所以我试着在终端中使用它的基本实用程序来播放声音:

(base) $ gst-play-1.0 -v PycharmProjects/dima_kivy/images/crunch.wav
Press 'k' to see a list of keyboard shortcuts.
Now playing /home/slv/PycharmProjects/dima_kivy/images/crunch.wav
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: ring-buffer-max-size = 0
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: buffer-size = -1
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: buffer-duration = -1
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: use-buffering = false
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: download = false
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: uri = file:///home/slv/PycharmProjects/dima_kivy/images/crunch.wav
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: connection-speed = 0
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0: source = "(GstFileSrc) source"
/GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = audio/x-wav
WARNING No decoder available for type 'audio/x-wav'.
WARNING debug information: gsturidecodebin.c(921): unknown_type_cb (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0
ERROR Your GStreamer installation is missing a plug-in. for file:///home/slv/PycharmProjects/dima_kivy/images/crunch.wav
ERROR debug information: gsturidecodebin.c(988): no_more_pads_full (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0:
no suitable plugins found:
gstdecodebin2.c(4679): gst_decode_bin_expose (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0:
no suitable plugins found:
Missing decoder: WAV (audio/x-wav)

问题似乎与Kivy无关。我在谷歌上搜索了一下安装帮助的人——我也是:

sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

运行此";安装所有";命令什么也没改变。行为保持不变。我想有一些错误的配置,但我甚至不知道在哪里可以找到(

求你了,救命!

我的系统:Ubuntu 20.04.1 LTS

gst-inspect-1.0输出:

(base) slv@slv-ubuntu-comp:~$ gst-inspect-1.0 audio/x-wav
Factory Details:
Rank                     primary (256)
Name                     audio/x-wav
Caps                     audio/x-wav
Extensions               wav
Plugin Details:
Name                     typefindfunctions
Description              default typefind functions
Filename                 /home/slv/miniconda3/lib/gstreamer-1.0/libgsttypefindfunctions.so
Version                  1.14.5
License                  LGPL
Source module            gst-plugins-base
Source release date      2019-05-29
Binary package           GStreamer Base Plug-ins source release
Origin URL               Unknown package origin
(base) slv@slv-ubuntu-comp:~$ gst-inspect-1.0 | grep wav
typefindfunctions: application/x-shockwave-flash: swf, swfl
typefindfunctions: audio/x-wav: wav
typefindfunctions: audio/x-wavpack: wv, wvp
typefindfunctions: audio/x-wavpack-correction: wvc

最后我发现当我使用conda:安装时

conda install kivy -c conda-forge

我不小心也在baseconda环境中创建了它,结果导致gstreamer的标准Ubuntu安装的系统路径被覆盖。因此,我通过删除该环境中的kivy来修复我的基础conda环境。现在命令gst-play-1.0~/PycharmProjects/dima_kiv/images/crunch.wav运行良好,并在基本环境中产生预期的声音。

至于错误";gstreamer:没有可用于类型"audio/x-wav"的解码器/没有找到合适的插件";在我的开发环境中,我向前迈出了一步,在我的发展环境中安装了来自conda-forge的good插件,如下所示:

conda install gst-plugins-good -c conda-forge

它修复了标题中提到的错误,但我的电脑仍然没有声音。对于这个新问题,我将向stackoverflow社区提出另一个问题。

最新更新