Error when outputting stream in FLAC format
I'm starting to use mopidy for internet streaming (Tidal and Spotify).
I've played around a bit with it, and currently I have this output setting:
output = audioresample ! audioconvert ! flacenc ! oggmux ! shout2send mount=mopidy ip=127.0.0.1 port=8000 password=BLA
I've used it before with vorbisenc, and it always worked fine.
Now, I've tried flacenc, and I get the following errors, always at the end of the first track of a playlist (from Spotify and from Tidal streaming):
2017-09-19 22:53:03,809 WARNING [1970:MainThread] mopidy.audio.gst: GStreamer warning: gst-stream-error-quark: The stream is in the wrong format. (11)
2017-09-19 22:53:04,364 ERROR [1970:MainThread] mopidy.audio.gst: GStreamer error: gst-stream-error-quark: received more encoded samples 4608 than provided 4096 as inputs (8)
2017-09-19 22:53:04,364 ERROR [1970:MainThread] mopidy.audio.gst: GStreamer error: gst-stream-error-quark: received more encoded samples 4608 than provided 4096 as inputs (8)
Indeed, it looks like an error from GStreamer. But, after this, mopidy (and moped) is absolutely non-responsive, and the service needs to be restarted to operate again.
This seems similar to #1623
Using your pipeline in Gstreamer v1.14.4 I get:
WARNING 2019-02-01 01:02:41,869 [9104:MainThread] mopidy.audio.gst
GStreamer warning: gst-stream-error-quark: The stream is in the wrong format. (11)
**
ERROR:gstaudioencoder.c:1023:gst_audio_encoder_finish_frame: code should not be reached
DEBUG 2019-02-01 01:02:41,869 [9104:MainThread] mopidy.audio.gst
Got WARNING bus message: error=u'gst-stream-error-quark: The stream is in the wrong format. (11)' debug=u'gstflacenc.c(1372): gst_flac_enc_handle_frame (): /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:abin/GstBin:audio-sink/mopidy+audio+actor+_Outputs:mopidy+audio+actor+_outputs0/GstBin:bin0/GstFlacEnc:flacenc0:\nStream discontinuity detected. The output may have wrong timestamps, consider using audiorate to handle discontinuities'
Aborted (core dumped)
But the following seems to work so not sure what's going on in our pipeline.
gst-launch-1.0 audiotestsrc ! audioresample ! audioconvert ! flacenc ! oggmux ! shout2send mount=name ip=127.0.0.1 port=8000 password=hackme
I'm seeing this behavior too.
mopidy (2.2.2-1) on 18.04/bionic with libgstreamer (1.14.1-1~ubuntu18.04.1).
Results in the same error as those mentioned above:
mopidy[9364]: WARNING GStreamer warning: gst-stream-error-quark: The stream is in the wrong format. (11)
Apr 03 23:48:45 mopidy-home-lan mopidy[9364]: **
Apr 03 23:48:45 mopidy-home-lan mopidy[9364]: ERROR:gstaudioencoder.c:1023:gst_audio_encoder_finish_frame: code should not be reached
``
Can you reproduce this with gst-launch and a particular input file? Are you using the same output config as the OP i.e. Shout2send? If so, can you try with the latest develop version of Mopidy from this repo.
Can you reproduce this with gst-launch and a particular input file? Are you using the same output config as the OP i.e. Shout2send? If so, can you try with the latest develop version of Mopidy from this repo.
Yes, I'm using same config as OP -- shout2send.
Thanks for the suggestion. I'll take a look at this shortly and update with my results. More soon.
Just to be clear, @kingosticks, I should install per: http://docs.mopidy.com/en/latest/devenv/#devenv?
Yes, or directly from github using pip as per the methods described at https://stackoverflow.com/a/24811490 (make sure it's the develop branch).
If we can reproduce it with gst-launch we can hopefully get gstreamer to look at it.
Running dev branch:
INFO 2019-04-04 20:20:40,719 [1673:MainThread] mopidy.__main__
Starting Mopidy 3.0.0a1
Started with mopidy -v --config /etc/mopidy/mopidy.conf
My gstreamer pipeline is:
output = audioresample ! audioconvert ! flacenc ! oggmux ! shout2send [redacted options]
Received WebSocket message from [IP redacted]: u'{"method":"core.playback.get_time_position","jsonrpc":"2.0","id":121}'
DEBUG 2019-04-04 20:23:17,493 [1673:HttpServer] mopidy.http.handlers
Sent WebSocket message to [IP redacted]: '{"jsonrpc": "2.0", "id": 121, "result": 163840}'
DEBUG 2019-04-04 20:23:19,235 [1673:SpotifyEventLoop] mopidy_spotify.playback
End of track reached
DEBUG 2019-04-04 20:23:19,237 [1673:Audio-2] mopidy.audio.gst
Sending appsrc end-of-stream event.
DEBUG 2019-04-04 20:23:19,240 [1673:Dummy-15] mopidy.audio.gst
Got about-to-finish event.
DEBUG 2019-04-04 20:23:19,241 [1673:Dummy-15] mopidy.audio.actor
Running about-to-finish callback.
DEBUG 2019-04-04 20:23:19,244 [1673:SpotifyBackend-6] mopidy_spotify.playback
Audio requested change of track; loading and starting Spotify player
DEBUG 2019-04-04 20:23:19,251 [1673:Audio-2] mopidy.audio.gst
Sending TAG event for track 'spotify:track:7gPfxkIAVdR4KCHbWT10JS': 'taglist, artist=(string)"Avi\\ Avital\\,\\ Johann\\ Sebastian\\ Bach", title=(string)"Partita\\ for\\ Violin\\ Solo\\ No.2\\ in\\ D\\ Minor\\,\\ BWV\\ 1004:\\ 1.\\ Allemande\\ \\(Arr.\\ for\\ Mandolin\\ by\\ Avi\\ Avital\\)", album=(string)"Pr\\303\\251lude";'
DEBUG 2019-04-04 20:23:19,253 [1673:Dummy-15] mopidy.audio.gst
Got source-setup signal: element=GstAppSrc
DEBUG 2019-04-04 20:23:19,257 [1673:SpotifyBackend-6] mopidy_spotify.playback
Audio requested seek to 0
DEBUG 2019-04-04 20:23:19,257 [1673:SpotifyBackend-6] mopidy_spotify.playback
Skipping seek due to issue mopidy/mopidy#300
DEBUG 2019-04-04 20:23:19,471 [1673:Dummy-16] mopidy.audio.gst
Got SEGMENT pad event: rate=1.0 format=time start=0 stop=18446744073709551615 position=0
DEBUG 2019-04-04 20:23:19,473 [1673:Dummy-16] mopidy.audio.actor
Audio event: position_changed(position=0L)
DEBUG 2019-04-04 20:23:19,476 [1673:Dummy-16] mopidy.listener
Sending position_changed to AudioListener: {'position': 0L}
WARNING 2019-04-04 20:23:19,480 [1673:MainThread] mopidy.audio.gst
GStreamer warning: gst-stream-error-quark: The stream is in the wrong format. (11)
DEBUG 2019-04-04 20:23:19,481 [1673:MainThread] mopidy.audio.gst
Got WARNING bus message: error=u'gst-stream-error-quark: The stream is in the wrong format. (11)' debug=u'gstflacenc.c(1372): gst_flac_enc_handle_frame (): /GstPlayBin:playbin0/GstPlaySink:playsink/GstBin:abin/GstBin:audio-sink/mopidy+audio+actor+_Outputs:mopidy+audio+actor+_outputs0/GstBin:bin0/GstFlacEnc:flacenc0:\nStream discontinuity detected. The output may have wrong timestamps, consider using audiorate to handle discontinuities'
**
ERROR:gstaudioencoder.c:1023:gst_audio_encoder_finish_frame: code should not be reached
Aborted (core dumped)