high res flac Getting 'the song is not encoded correctly'

82 views
Skip to first unread message

Arturo Pérez

unread,
Mar 14, 2018, 10:17:12 PM3/14/18
to sonosp...@googlegroups.com
Hi all,

Got sonospy today and after some work got it to index my high res files and show up on the Sonos controller app on my iPhone.

All my songs are high resolution FLAC.  The albums show up, seemingly tagged correctly etc.  But when I hit the play icon i get 'the song is not encoded correctly’ .
Any help to get this sample/bit conversion going will be much appreciated.  Static files that do not need transcoding are served just fine.

I installed the converters (listed below) and still no transcoding.  I “replaced” the converters with shell scripts so I can modify the settings.  What I’ve found is that no
matter what conversion is done the transcoder cannot write to stdout.

Using ffmpeg to stdout:
av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:: Broken pipe

If I modify my script to write to a tmp file and then cat that to stdout:
cat: write error: Broken pipe

I’m not a python guy but it looks to me like whatever consumes the data that self.proxy.wmpcontroller.add_transcoded_file(dummystaticfile)
provides is not actually reading the pipe.

Installation details follow.
====
I installed a bunch of converters that I saw were being using in transcode.py (listed below)
$ sox --version
sox:      SoX v14.4.1
$ flac --version
flac 1.3.0
$ vlc --version
VLC media player 2.2.7 Umbrella (revision 2.2.7-0-g6e32381286)
VLC version 2.2.7 Umbrella (2.2.7-0-g6e32381286)
$ lame --version
LAME 64bits version 3.99.5 (http://lame.sf.net)

Commandline to run sonospy and output.

$ python pycpoint.py -p -sSonospy=MusicService,$HOME/Sonospy.db  -r -d 
Args:
option.debug: True
option.proxyonly: True
option.register: True
    Music service: Sonospy=MusicService,$HOME/Sonospy.db
Proxy. Name: Locke
>>>> new device (from controller): WFADevice at http://<IP1>:1990  udn: uuid:7c1f22bb-d0c0-40ad-5590-fbd73bf6377e
>>>> new device (from controller): <IP2> - Sonos BRIDGE at http://<IP2>:1400  udn: uuid:RINCON_000E58ECC10201400
>>>> new device (from controller): <IP3> upmpd at http://<IP3>:49152  udn: uuid:5afaa578-18a8-92ba-f3df-70cd60aafe60
>>>> new device (from controller): <IP4> - Sonos PLAY:1 at http://<IP4>:1400  udn: uuid:RINCON_000E58C4790601400
>>>> new device (from controller): <IP5> at http://<IP5>:9791  udn: uuid:ba1f8e7e-dc37-4260-a0ae-9ad282ae6f13
customsd call success: True,  args: {'csrfToken': 'Pa3ZxCXkexH/9S50UOHpiMAlkpEEXOxJ', 'name': '', 'sid': '240'}
>>>> new device (from controller): <IP6> - Sonos CONNECT at http://<IP6>:1400  udn: uuid:RINCON_000E58A5748E01400
>>>> new device (from controller): <IP7> - Sonos PLAY:3 at http://<IP7>:1400  udn: uuid:RINCON_000E58F946C001400
>>>> new device (from controller): <IP8> - Sonos CONNECT:AMP at http://<IP8>:1400  udn: uuid:RINCON_000E58DC5B0E01400
customsd call success: True,  args: {'caps': ['search', 'trFavorites', 'alFavorites', 'arFavorites', 'ucPlaylists'], 'presentationMapVersion': '5', 'secureUri': 'http://<IP3>:50104/smapi/control', 'pollInterval': '30', 'csrfToken': '3/LimX1CVnQ/RX8vTEzPGLQ7IOGqByIt', 'authType': 'Anonymous', 'name': ‘MusicService', 'presentationMapUri': u'http://<IP3>:50104/5b3b4359-7d84-37ec-db91-643f5aa71634.xml', 'uri': 'http://<IP3>:50104/smapi/control', 'sid': '240', 'containerType': 'MService'}
>>>> new device (from controller): <IP9>  at http://<IP9>:8060  udn: uuid:29800014-0007-10d7-8089-88dea90372ad
>>>> new device (from controller): Monitor Service at http://<IP1->:9791  udn: uuid:71d4b236-64c9-47fc-8a1d-13a6c4c511ae

Mark Henkelis

unread,
Mar 15, 2018, 6:03:33 PM3/15/18
to sonosp...@googlegroups.com

Hi,

What operating system are you running Sonospy on?

Also, what resolution are the high res FLAC files (channels, sample rate, bits per sample)?

Mark.

--
You received this message because you are subscribed to the Google Groups "Sonospy Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonospy-deve...@googlegroups.com.
To post to this group, send email to sonosp...@googlegroups.com.
Visit this group at https://groups.google.com/group/sonospy-devel.
For more options, visit https://groups.google.com/d/optout.

artur9

unread,
Mar 15, 2018, 8:28:13 PM3/15/18
to Sonospy Development
I am running on Linux:

Linux host 3.16.0-4-amd64 #1 SMP Debian 3.16.51-3 (2017-12-13) x86_64 GNU/Linux

Python 2.7.9


I have a variety of high res flac from 88k up to 176k.  The sample I've been trying to transcode is

Audio

Format                                   : FLAC

Format/Info                              : Free Lossless Audio Codec

Duration                                 : 8mn 52s

Bit rate mode                            : Variable

Bit rate                                 : 2 618 Kbps

Channel(s)                               : 2 channels

Sampling rate                            : 96.0 KHz

Bit depth                                : 24 bits

Stream size                              : 166 MiB (99%)

Writing library                          : libFLAC 1.3.0 (UTC 2013-05-26)

Mark Henkelis

unread,
Mar 18, 2018, 1:10:11 PM3/18/18
to sonosp...@googlegroups.com

FLAC transcodes will use SoX.

I've replicated the error here, at least the "not encoded correctly" error, if not the pipe error (running the SoX transcode manually works for me).

It appears that something has changed on the Sonos end, at least in relation to FLAC (as other transcodes work). When transcoding I don't know the final length of the streamed data until transcoding has finished, which is too late for the initial http call from Sonos. The current code sets the content length to zero, which used to work - now it looks like Sonos sees the zero and gives up.

As a test I've changed the code to return the original length of the FLAC file - this will be longer than the stream after transcoding, but it appears to work with the test file I have. I've attached an updated webserver.py module, can you copy that over the one in sonospy/sonospy/brisa/core (after backing that file up) and try it please.

Thanks, Mark.

webserver.py

artur9

unread,
Mar 18, 2018, 5:44:29 PM3/18/18
to Sonospy Development
That works well.  

I cannot find a gapless album to try it on so I don't know if that would be an issue.  

The only thing I've noticed is that one cannot skip forward in a track.  Not surprising and not normally something I do often in any case.


artur9

unread,
Mar 22, 2018, 9:56:43 PM3/22/18
to Sonospy Development
I finally got around to trying a gapless album and it worked perfectly.  Ship it, I say ;-)

Matthew Antkowiak

unread,
Oct 7, 2018, 3:59:32 AM10/7/18
to Sonospy Development
Hi

Have these changes been incorporated into the trunk? I could not see a commit for them and I am still having having issues around downsampling flacs.

However, when I try loading the webserver.py on the latest code set, sonospy if failing (probably due to inconsistencies with the optimisation code committed on 9th June).

Cheers

Matthew

Reply all
Reply to author
Forward
0 new messages