Gstreamer error

Hi all,
I’m trying to setup mopidy and Snapcast to use them in combination with home assistant tts service, but I can’t get this to work.

If I let mopidy create the snapfifo file, when I use the tts service I can hear the voice repeated in an infinite loop.
Indeed I read in other posts that should be Snapcast to create the snapfifo file.
But if I let Snapcast create the file I can’t here nothing from mopidy and I got this error

GStreamer error: gst-resource-error-quark: Error while seeking in file "/tmp/snapfifo". (11)

Instead if I manually create the file with mkfifo /tmp/snapfifo I get this error

Mar 24 14:13:31 hassbian mopidy[17603]: ERROR    GStreamer error: gst-resource-error-quark: Could not open file "/tmp/snapfifo" for writing. (6)
Mar 24 14:13:31 hassbian mopidy[17603]: WARNING  Setting GStreamer state to GST_STATE_PLAYING failed
Mar 24 14:13:31 hassbian mopidy[17603]: WARNING  Track is not playable: http://192.168.1.152:8123/api/tts_proxy/f0fa9097a41d357ca711da49ab4f935720e67a52_it_-_google.mp3

I’ve this in my Snapcast configuration now

SNAPSERVER_OPTS="-d -s airplay:///usr/bin/shairport-sync?name=Airplay&devicename=Multiroom&port=5000] -s pipe:///tmp/snapfifo?name=Mopidy&sampleformat=48000:16:2&codec=flac&mode=read"

the airplay part works flawlessly.

Any advice is really appreciated,
thanks

What do you mean by the ‘Home Assistant tts service’?
I use same setup, HA+Mopidy+Snapcast and if I type text in the tts section of the MPD tile on the overview page, it comes out of all speakers, I don’t use it very often and as far as I can remember I’ve only done it when mopidy isn’t playing.

Sorry for reopening the thread. But did you ever solved this issue?

I’m having a pretty similiar issue:

Pi4 with buster running a snapcast server and mopidy.

That’s my mopidy.conf:

# For further information about options in this file see:

# https://docs.mopidy.com/

#

# The initial commented out values reflect the defaults as of:

# Mopidy 3.0.2

# Mopidy-File 3.0.2

# Mopidy-HTTP 3.0.2

# Mopidy-M3U 3.0.2

# Mopidy-SoftwareMixer 3.0.2

# Mopidy-Stream 3.0.2

#

# Available options and defaults might have changed since then,

# run `mopidy config` to see the current effective config and

# `mopidy --version` to check the current version.

[core]

#cache_dir = $XDG_CACHE_DIR/mopidy

#config_dir = $XDG_CONFIG_DIR/mopidy

#data_dir = $XDG_DATA_DIR/mopidy

#max_tracklist_length = 10000

#restore_state = false

[local]

data_dir = /var/lib/mopidy/local

media_dir = /var/lib/mopidy/media

[logging]

#verbosity = 0

#format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n %(message)s

#color = true

#config_file =

[audio]

#mixer = software

#mixer_volume =

# output = alsasink

output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo

#buffer_time =

[proxy]

#scheme =

#hostname =

#port =

#username =

#password =

[file]

#enabled = true

#media_dirs =

# $XDG_MUSIC_DIR|Music

# ~/|Home

#excluded_file_extensions =

# .directory

# .html

# .jpeg

# .jpg

# .log

# .nfo

# .pdf

# .png

# .txt

# .zip

#show_dotfiles = false

#follow_symlinks = false

#metadata_timeout = 1000

[http]

enabled = true

hostname = 192.168.0.2

port = 6680

#zeroconf = Mopidy HTTP server on $hostname

#allowed_origins =

#csrf_protection = true

#default_app = mopidy

[m3u]

#enabled = true

#base_dir = $XDG_MUSIC_DIR

#default_encoding = latin-1

#default_extension = .m3u8

#playlists_dir =

[softwaremixer]

#enabled = true

[stream]

#enabled = true

#protocols =

# http

# https

# mms

# rtmp

# rtmps

# rtsp

#metadata_blacklist =

#timeout = 5000

I would like to pipe the output of mopidy to snapcast using this line:
[audio]

#mixer = software

#mixer_volume =

# output = alsasink

output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo

#buffer_time =

Sadly the mopidy log shows errors in writing to the file:

Does anyone know how to solve this issue?

I’m running Mopidy > 3

Here’s the documentation of snapcast concerning piping output from mopidy to snapserver: https://github.com/badaix/snapcast/blob/master/doc/player_setup.md#mopidy

Thanks in advance.

No one who might know how to solve this? I’m kind of desprate

I don’t use snapcast. But did you also change the sysctl setting as it suggests?

Are you trying to use the tts service? or just set up snapcast?

I would like to stream all output from mopidy to snapserver.

Assuming then that you are not using HASS or trying to use it’s tts service and that you just have mopidy and snapcast installed on a your pi, can you play any music without using snapcast - ie just on the basic install of mopidy?

Hey,

I’ve started a fresh install today. Removed all pieces of mopidy 2.3.1 and made a fresh install of mopidy 3.2. Rhasspy and HA are running on the same machine as well.

As long as I leave the audio section to:

[audio]
output = alsasink
#output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo

Everything is working just fine.
Flipping the upper lines with each other brings still an error.
I thought maybe the local file is causing some trouble so I configured mopidy-spotify, but still the same. The error is not much different than before.
That’s the error:

● mopidy.service - Mopidy music server
   Loaded: loaded (/lib/systemd/system/mopidy.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-04-23 19:53:54 CEST; 36s ago
  Process: 27351 ExecStartPre=/bin/mkdir -p /var/cache/mopidy (code=exited, status=0/SUCCESS)
  Process: 27352 ExecStartPre=/bin/chown mopidy:audio /var/cache/mopidy (code=exited, status=0/SUCCESS)
 Main PID: 27353 (mopidy)
    Tasks: 17 (limit: 4915)
   Memory: 69.7M
   CGroup: /system.slice/mopidy.service
           └─27353 /usr/bin/python3 /usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf

Apr 23 19:53:57 raspberrypi mopidy[27353]: INFO     [SpotifyBackend-3] mopidy_spotify.web Logged into Spotify Web API as maulik21
Apr 23 19:54:20 raspberrypi mopidy[27353]: INFO     [SpotifyBackend-3] mopidy_spotify.playlists Refreshed 85 Spotify playlists
Apr 23 19:54:20 raspberrypi mopidy[27353]: INFO     [MainThread] mopidy.commands Starting Mopidy core
Apr 23 19:54:20 raspberrypi mopidy[27353]: INFO     [MainThread] mopidy.commands Starting Mopidy frontends: IrisFrontend, HttpFrontend
Apr 23 19:54:20 raspberrypi mopidy[27353]: INFO     [IrisFrontend-10] mopidy_iris.core Starting Iris 3.47.0
Apr 23 19:54:20 raspberrypi mopidy[27353]: INFO     [HttpFrontend-12] mopidy.http.actor HTTP server running at [::]:6680
Apr 23 19:54:20 raspberrypi mopidy[27353]: INFO     [MainThread] mopidy.commands Starting GLib mainloop
Apr 23 19:54:23 raspberrypi mopidy[27353]: WARNING  [Audio-2] mopidy.audio.actor Setting GStreamer state to GST_STATE_PLAYING failed
Apr 23 19:54:23 raspberrypi mopidy[27353]: WARNING  [Core-9] mopidy.core.tracklist Track is not playable: spotify:track:5pKCDm2fw4k6D6C5Rk646C
Apr 23 19:54:23 raspberrypi mopidy[27353]: ERROR    [MainThread] mopidy.audio.gst GStreamer error: Could not open file "/tmp/snapfifo" for writing.

Shall I enable better debugging? Any hint on how to solve this?

Thanks for the help.

did you follow @kingosticks suggestion above?

I haven’t used Rhasspy and have stopped using HA but either of those could maybe interfering with the snapserver.
My only suggestion would be to start over again, maybe on a fresh card if you have one, get mopidy and snapserver running then build on from there, I have a feeling that’s what I had to do when I set it up. But it was a couple of years ago and the memory is fading now :slight_smile:
I’m afraid I haven’t really got the time until the weekend to look into it and try and offer any more assistance.

Yes I’ve set the sysctl setting as the documenation says.

Maybe I’ll try that some time. Atm I don’t have a second sd card. Basically I could try this on my ubuntu machine.

In case you have any idea on the weekend I’m happy to try it.

Thanks so far.

EDIT: I forgot to say that Rhassyp as well as HA are running in docker containers. So I don’t think they are interferring with snapcast or mopidy.

I had the same problem after updating my Pi4 to buster!

I fixed it by changing the ownership of the /tmp/snapfifo file from “snapserver:snapserver” to the “mopidy”-user:

sudo chown -R mopidy /tmp/snapfifo

And restart the mopdiy-service as usual
sudo systemctl restart mopidy.service

This fixed it for me!

BTW here is my audio output entry (im using icecast, snapcast-server and client and mopidy [with iris])

output = tee name=t ! queue ! audioresample ! queue ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo

Btw. you can run this command in a second terminal for debugging. This was a big help for me:

sudo journalctl -u mopidy

omg! i have been trying to get this working for 5 weeks and your chown command fixed it, so i can hear music from all the clients for the first time. thanks!