Elleo / gst-deepspeech

NOTE: This plugin is now deprecated in favour of the coqui-stt branch in gst-plugins-bad: https://gitlab.freedesktop.org/philn/gstreamer/-/tree/coqui-stt/subprojects/gst-plugins-bad/ext/coqui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WARNING: erroneous pipeline: no element "pulsesrc"

crypdick opened this issue · comments

When I try to run gst-launch-1.0 -m pulsesrc ! audioconvert ! audiorate ! audioresample ! deepspeech silence-threshold=0.3 silence-length=20 ! fakesink I get the following error:

WARNING: erroneous pipeline: no element "pulsesrc"

I made sure pulseaudio is running:

 ~  pulseaudio
E: [pulseaudio] pid.c: Daemon already running.
E: [pulseaudio] main.c: pa_pid_file_create() failed.

Output with --gst-debug=3 flag:

0:00:00.007713784  8198 0x558804df8f20 WARN     GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "pulsesrc"!
0:00:00.007834543  8198 0x558804df8f20 ERROR           GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "pulsesrc"
0:00:00.009160327  8198 0x558804df8f20 ERROR           GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@0x558804e05940]
0:00:00.009744172  8198 0x558804df8f20 WARN     GST_ELEMENT_FACTORY gstelementfactory.c:456:gst_element_factory_make: no such element factory "deepspeech"!
0:00:00.009851068  8198 0x558804df8f20 ERROR           GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "deepspeech"
0:00:00.009947543  8198 0x558804df8f20 ERROR           GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no sink [source=@0x558804e11160]
0:00:00.010576128  8198 0x558804df8f20 ERROR           GST_PIPELINE grammar.y:901:priv_gst_parse_yyparse: link has no source [sink=@0x558804e16b60]
WARNING: erroneous pipeline: no element "pulsesrc"

I ran pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2 and tried feeding the output into the pulsesrc device flag (full command: gst-launch-1.0 --gst-debug=3 -m pulsesrc device="alsa_input.pci-0000_00_05.0.analog-stereo" ! audioconvert ! audiorate ! audioresample ! deepspeech silence-threshold=0.3 silence-length=20 ! fakesink. No difference in output.

I have all the dependencies:

sudo apt install deepspeech-model libdeepspeech libdeepspeech-dev libtensorflow-cc gstreamer1.0-deepspeech ibus-deepspeech 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libdeepspeech-dev is already the newest version (0.1.1-1).
libdeepspeech is already the newest version (0.1.1-1).
libtensorflow-cc is already the newest version (0.1.1-1).
deepspeech-model is already the newest version (0.1.1-1).
gstreamer1.0-deepspeech is already the newest version (0.1.1).
ibus-deepspeech is already the newest version (0.1.0-3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Output of GST_DEBUG=5 gst-inspect-1.0 deepspeech > gst-log.txt 2>&1: https://pastebin.ubuntu.com/p/yWxM2TsF4K/

Output of pactl list sinks:

Sink #0
	State: SUSPENDED
	Name: alsa_output.pci-0000_00_05.0.analog-stereo
	Description: Built-in Audio Analog Stereo
	Driver: module-alsa-card.c
	Sample Specification: s16le 2ch 48000Hz
	Channel Map: front-left,front-right
	Owner Module: 7
	Mute: no
	Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	Base Volume: 65536 / 100% / 0.00 dB
	Monitor Source: alsa_output.pci-0000_00_05.0.analog-stereo.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.resolution_bits = "16"
		device.api = "alsa"
		device.class = "sound"
		alsa.class = "generic"
		alsa.subclass = "generic-mix"
		alsa.name = "Intel 82801AA-ICH"
		alsa.id = "Intel ICH"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.device = "0"
		alsa.card = "0"
		alsa.card_name = "Intel 82801AA-ICH"
		alsa.long_card_name = "Intel 82801AA-ICH with AD1980 at irq 21"
		alsa.driver_name = "snd_intel8x0"
		device.bus_path = "pci-0000:00:05.0"
		sysfs.path = "/devices/pci0000:00/0000:00:05.0/sound/card0"
		device.bus = "pci"
		device.vendor.id = "8086"
		device.vendor.name = "Intel Corporation"
		device.product.id = "2415"
		device.product.name = "82801AA AC'97 Audio Controller"
		device.form_factor = "internal"
		device.string = "front:0"
		device.buffering.buffer_size = "19188"
		device.buffering.fragment_size = "6396"
		device.access_mode = "mmap"
		device.profile.name = "analog-stereo"
		device.profile.description = "Analog Stereo"
		device.description = "Built-in Audio Analog Stereo"
		alsa.mixer_name = "Analog Devices AD1980"
		alsa.components = "AC97a:41445370"
		module-udev-detect.discovered = "1"
		device.icon_name = "audio-card-pci"
	Ports:
		analog-output;output-amplifier-on: Analog Output / Amplifier (priority: 9910)
		analog-output;output-amplifier-off: Analog Output / No Amplifier (priority: 9900)
	Active Port: analog-output;output-amplifier-on
	Formats:
		pcm

By the way, when I run gst-inspect-1.0 deepspeech I get the no plugin error, but it works fine when I run it as sudo. Ditto with pulsesrc. I suspect things are getting installed with the wrong permissions?

Running as sudo comes with its own issues:

sudo gst-launch-1.0 -m pulsesrc ! audioconvert ! audiorate ! audioresample ! deepspeech silence-threshold=0.3 silence-length=20 ! fakesink
Setting pipeline to PAUSED ...
Home directory not accessible: Permission denied
ERROR: Pipeline doesn't want to pause.
Got message #17 from element "fakesink0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #18 from element "deepspeech0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #19 from element "audioresample0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #20 from element "audiorate0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #21 from element "audioconvert0" (state-changed): GstMessageStateChanged, old-state=(GstState)GST_STATE_NULL, new-state=(GstState)GST_STATE_READY, pending-state=(GstState)GST_STATE_VOID_PENDING;
Got message #22 from element "pulsesrc0" (error): GstMessageError, gerror=(GError)NULL, debug=(string)"pulsesrc.c\(1015\):\ gst_pulsesrc_open\ \(\):\ /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0";
ERROR: from element /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: Failed to connect: Connection refused
Additional debug info:
pulsesrc.c(1015): gst_pulsesrc_open (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0
Setting pipeline to NULL ...
Freeing pipeline ...

Hi crypdick,

If pulsesrc is only found as root as well then it would appear to be something more general going wrong with gstreamer on your system/user, as pulsesrc isn't part of gst-deepspeech, it's a well established gstreamer plugin (from the gstreamer1.0-plugins-good package).

Could you try deleting your user's gstreamer plugin registry cache (iirc: ~/.cache/gstreamer-1.0/registry*), then running GST_DEBUG=5 GST_DEBUG_NO_COLOR=1 gst-inspect-1.0 > log.txt 2>&1 and upload log.txt. I'll take a look and see if there's anything obvious I can see going wrong there.

Thanks!
Mike

Here's the output of rm -rf .cache/gstreamer-1.0/registry* && GST_DEBUG=5 GST_DEBUG_NO_COLOR=1 gst-inspect-1.0 > log.txt 2>&1: https://gist.github.com/crypdick/e2cf5bd7aca45ada0dfe0eadb1a8208f

Ah, I think I've spotted the issue; it looks like you're using anaconda and it's setup environment variables for your user to just search for gstreamer plugins inside the anaconda environment:

0:00:00.003892203 12021 0x5559c5e56c00 DEBUG GST_REGISTRY gstregistry.c:1663:scan_and_update_registry: scanning main plugins /home/richardd/bin/anaconda3/lib/gstreamer-1.0

Presumably you don't have gstreamer-plugins-good installed within the anaconda environment which is why it's not finding pulsesrc, and gst-deepspeech will install to /usr/local/ by default (or /usr/ for the PPA packages) so it's not seeing the deepspeech plugin either.

My advice would be to simply disable the anaconda environment prior to running gst-deepspeech based things; but alternatively you could attempt to compile everything against the anaconda version of the gstreamer libraries and install within the anaconda environment instead.

Sorry for the delay. My workstation bit the dust and I finally have a new box set up.

I installed gstreamer in anaconda:

conda install -c anaconda gstreamer
conda install -c anaconda gst-plugins-base
conda install -c retrev gst-plugins-good 

That didn't help the no element "pulsesrc" error. I finally got things working by running

/usr/bin/gst-launch-1.0 -m pulsesrc ! audioconvert ! audiorate ! audioresample ! deepspeech silence-threshold=0.3 silence-length=20 ! fakesink