Struggling to get Mopidy to play over Snapcast

Hi… I’m struggling to get anything to output from my Mopidy server to a snapclient. I’m receiving the error ‘Could not open file “tmp/snapfifo” for writing’ when attempting to play any track. I’ve attempted to manually create the file and change permissions to 777 to see if that would do anything, but I’m still getting the same error. Anyone have any ideas?

Config:

$ sudo mopidyctl config
Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config” as user mopidy
[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

[logging]
verbosity = 0
format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s
color = false
config_file =

[audio]
mixer = software
mixer_volume =
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 =

[iris]
enabled = true
country = NZ
locale = en_NZ
spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
data_dir = $XDG_DATA_DIR/iris

[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 = 0.0.0.0
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true
default_app = mopidy

[m3u]
enabled = true
base_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

[spotify]
enabled = true
username = ********
password = ********
client_id = *********
client_secret = ********
bitrate = 320
volume_normalization = true
private_session = true
timeout = 10
allow_cache = true
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries =
US

[mpris]
enabled = true
bus_type = session

[mpd]
enabled = true
hostname = ::
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
listall
listallinfo
default_playlist_scheme = m3u

[alsamixer]
enabled = true
card = 0
control = Master
min_volume = 0
max_volume = 100
volume_scale = cubic

Dependencies:

$ sudo mopidyctl deps
Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf deps” as user mopidy
Executable: /usr/bin/mopidy
Platform: Linux-5.4.0-73-generic-x86_64-with-glibc2.29
Python: CPython 3.8.5 from /usr/lib/python3.8
Mopidy: 3.1.1 from /usr/lib/python3/dist-packages
Mopidy-ALSAMixer: 2.0.1 from /usr/lib/python3/dist-packages
Mopidy-Iris: 3.58.0 from /usr/local/lib/python3.8/dist-packages
setuptools: 45.2.0 from /usr/lib/python3/dist-packages
Mopidy: 3.1.1 from /usr/lib/python3/dist-packages
Pykka: 2.0.3 from /usr/lib/python3/dist-packages
Mopidy-Spotify: 4.1.0 from /usr/lib/python3/dist-packages
Mopidy-MPRIS: 3.0.3 from /usr/lib/python3/dist-packages
Mopidy-MPD: 3.1.0 from /usr/lib/python3/dist-packages
GStreamer: 1.16.2.0 from /usr/lib/python3/dist-packages/gi
Detailed information:
Python wrapper: python-gi 3.36.0
Relevant elements:
Found:
uridecodebin
souphttpsrc
appsrc
alsasink
osssink
oss4sink
pulsesink
id3demux
id3v2mux
lamemp3enc
mpegaudioparse
mpg123audiodec
vorbisdec
vorbisenc
vorbisparse
oggdemux
oggmux
oggparse
flacdec
flacparse
shout2send
Not found:
flump3dec
mad

Debug:

May 18 15:29:31 mopidy systemd[1]: Starting Mopidy music server…
May 18 15:29:31 mopidy systemd[1]: Started Mopidy music server.
May 18 15:29:31 mopidy mopidy[1471]: INFO [MainThread] mopidy.main Starting Mopidy 3.1.1
May 18 15:29:31 mopidy mopidy[1471]: INFO [MainThread] mopidy.config Loading config from builtin defaults
May 18 15:29:31 mopidy mopidy[1471]: INFO [MainThread] mopidy.config Loading config from file:///usr/share/mopidy/conf.d/mopidy.conf
May 18 15:29:31 mopidy mopidy[1471]: INFO [MainThread] mopidy.config Loading config from file:///etc/mopidy/mopidy.conf
May 18 15:29:31 mopidy mopidy[1471]: INFO [MainThread] mopidy.config Loading config from command line options
May 18 15:29:32 mopidy mopidy[1471]: INFO [MainThread] mopidy.main Enabled extensions: iris, mpd, mpris, file, m3u, alsamixer, stream, softwaremixer, spotify, http
May 18 15:29:32 mopidy mopidy[1471]: INFO [MainThread] mopidy.main Disabled extensions: none
May 18 15:29:32 mopidy mopidy[1471]: INFO [MainThread] mopidy.commands Starting Mopidy mixer: SoftwareMixer
May 18 15:29:32 mopidy mopidy[1471]: INFO [MainThread] mopidy.commands Starting Mopidy audio
May 18 15:29:32 mopidy mopidy[1471]: INFO [MainThread] mopidy.commands Starting Mopidy backends: FileBackend, M3UBackend, StreamBackend, SpotifyBackend
May 18 15:29:32 mopidy mopidy[1471]: INFO [Audio-2] mopidy.audio.actor Audio output set to “audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo”
May 18 15:29:32 mopidy mopidy[1471]: INFO [SpotifyEventLoop] mopidy_spotify.backend Logged in to Spotify in online mode
May 18 15:29:33 mopidy mopidy[1471]: INFO [SpotifyBackend-6] mopidy_spotify.web Logged into Spotify Web API as ************
May 18 15:29:34 mopidy mopidy[1471]: INFO [SpotifyBackend-6] mopidy_spotify.playlists Refreshed 6 Spotify playlists
May 18 15:29:34 mopidy mopidy[1471]: INFO [SpotifyBackend-6] mopidy_spotify.backend Spotify private session activated
May 18 15:29:34 mopidy mopidy[1471]: INFO [MainThread] mopidy.commands Starting Mopidy core
May 18 15:29:34 mopidy mopidy[1471]: INFO [MainThread] mopidy.commands Starting Mopidy frontends: IrisFrontend, HttpFrontend, MprisFrontend, MpdFrontend
May 18 15:29:34 mopidy mopidy[1471]: INFO [IrisFrontend-10] mopidy_iris.core Starting Iris 3.58.0
May 18 15:29:34 mopidy mopidy[1471]: INFO [HttpFrontend-12] mopidy.http.actor HTTP server running at [::ffff:0.0.0.0]:6680
May 18 15:29:34 mopidy mopidy[1471]: WARNING [MprisFrontend-13] mopidy_mpris.frontend MPRIS frontend setup failed (g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0))
May 18 15:29:34 mopidy mopidy[1471]: INFO [MainThread] mopidy_mpd.actor MPD server running at [::]:6600
May 18 15:29:34 mopidy mopidy[1471]: INFO [MainThread] mopidy.commands Starting GLib mainloop
May 18 15:29:35 mopidy snapserver[737]: ControlServer::NewConnection: 10.1.0.167
May 18 15:29:35 mopidy snapserver[737]: 2021-05-18 15-29-35 [Notice] (handleAccept) ControlServer::NewConnection: 10.1.0.167
May 18 15:29:54 mopidy mopidy[1471]: WARNING [Audio-2] mopidy.audio.actor Setting GStreamer state to GST_STATE_PLAYING failed
May 18 15:29:54 mopidy mopidy[1471]: ERROR [MainThread] mopidy.audio.gst GStreamer error: Could not open file “/tmp/snapfifo” for writing.
May 18 15:29:54 mopidy mopidy[1471]: WARNING [Core-9] mopidy.core.tracklist Track is not playable: spotify:track:3AUMiJI6rDcz3iQcTf3dH7

Check that the /tmp/snapfifo is a fifo and not a file, and check the permissions. I have read that you can switch to some kind of tcp stream also but haven’t grokked that yet. :slight_smile: anyway, do this:

mkfifo /tmp/snapfifo
chown mopidy:audio /tmp/snapfifo

…I think these are the standard values…

This might be it! I’ll have to re set up my config this week and give it a go!

I changed to TCP streaming but that gave unacceptable delays (and some audio artifacts) when playing/pausing, possibly due to some excessive buffering somewhere. I have solved this by going back to FIFO and modifying the startup scripts for both Mopidy and Snapserver to create the FIFO manually at service start. That worked.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.