Jump to content

Streaming Audio (Internetradio) auf Sonos/DLNA


DerJens2021

Recommended Posts

DerJens2021

Hallo,

bei mir funktionieren Internet-Radiostreams mit DLNA/Sonos-Geräten nicht.

Ich habe in Emby (v4.6.4.0/Windows) eine Datei sunshinelive.strm angelegt, darin ist der folgende Link hinterlegt:

http://192.168.1.12:3000/EXT/S19.2E-133-7-169

Das ist ein Link auf ein MP3-Stream, der ist gültig und funktioniert auch. Das habe ich mit ffprobe geprüft.

.\ffprobe.exe http://192.168.1.12:3000/EXT/S19.2E-133-7-169
ffprobe version 4.3.0-emby_2021_02_27-g8f222573e9+634 Copyright (c) 2007-2021 the FFmpeg developers and softworkz for Emby LLC
  built with gcc 9.2.0 (Rev2, Built by MSYS2 project)
Input #0, mp3, from 'http://192.168.1.12:3000/EXT/S19.2E-133-7-169':
  Metadata:
    encoder         : Lavf58.29.100
    icy-name        : sunshine live
  Duration: N/A, start: 0.000000, bitrate: 256 kb/s
    Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 256 kb/s

Ich kann den Radiostream über das Emby-Webinterface problemlos abspielen. Ich kann den Stream aber nicht an meine Sonos-Geräte schicken. Das geht weder über DLNA, noch über das Sonos-Plugin.

2021-08-07 09:37:25.505 Debug Dlna: 192.168.1.53 - Sonos Play:1 Wohnzimmer EG - Received PlayRequest: PlayNow
2021-08-07 09:37:25.506 Debug SqliteItemRepository: Public GetItemLinks
2021-08-07 09:37:25.507 Debug Dlna: 192.168.1.53 - Sonos Play:1 Wohnzimmer EG - Playlist created
2021-08-07 09:37:25.507 Debug Dlna: 192.168.1.53 - Sonos Play:1 Wohnzimmer EG - Playing 1 items
2021-08-07 09:37:25.507 Debug Dlna: 192.168.1.53 - Sonos Play:1 Wohnzimmer EG - SetAvTransport Uri: http://192.168.1.23:8096/audio/420/stream.mp3?DeviceId=uuid:RINCON_949F3XXXXXXXX1400_MR&MediaSourceId=8af74a5XXXXXXXX14b48aaca68b64bf0&Static=true&PlaySessionId=bcb0XXXXXXXX48748790d9e98cd10575 DlnaHeaders: DLNA.ORG_PN=MP3;DLNA.ORG_OP=00;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01D00000000000000000000000000000
2021-08-07 09:37:25.507 Debug HttpClient: POST http://192.168.1.53:1400/MediaRenderer/AVTransport/Control
2021-08-07 09:37:25.516 Error HttpClient: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>1023</errorCode></UPnPError></detail></s:Fault></s:Body></s:Envelope>
2021-08-07 09:37:25.522 Error Server: Error processing request
        *** Error Report ***
        Version: 4.6.4.0
        Command line: C:\Users\XXXXXXXX\Software\emby\EmbyServer.dll
        Operating system: Microsoft Windows 10.0.19042
        Framework: .NET Core 3.1.13
        OS/Process: x64/x64
        Runtime: C:/Users/XXXX/Software/emby/System.Private.CoreLib.dll
        Processor count: 2
        Data path: C:\Users\XXXX\Software\programdata
        Application path: C:\Users\Jens\Software\emby
        MediaBrowser.Model.Net.HttpException: MediaBrowser.Model.Net.HttpException: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>1023</errorCode></UPnPError></detail></s:Fault></s:Body></s:Envelope>
           at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod)
           at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsync(HttpRequestOptions options, String httpMethod)
           at Emby.Dlna.PlayTo.SsdpHttpClient.SendCommandAsync(String baseUrl, DeviceService service, String command, ReadOnlyMemory`1 postData, CancellationToken cancellationToken, Boolean logRequest, String header)
           at Emby.Dlna.PlayTo.Device.SetAvTransport(String url, String header, String metaData, CancellationToken cancellationToken)
           at Emby.Dlna.PlayTo.PlayToController.SetPlaylistIndex(Int32 index, CancellationToken cancellationToken)
           at Emby.Dlna.PlayTo.PlayToController.SendPlayCommand(PlayRequest command, CancellationToken cancellationToken)
           at Emby.Server.Implementations.Session.SessionManager.SendMessageToSession[T](SessionInfo session, Boolean requireUserInterface, ReadOnlyMemory`1 name, T data, CancellationToken cancellationToken)
           at Emby.Server.Implementations.Session.SessionManager.SendPlayCommand(String controllingSessionId, String sessionId, PlayRequest command, CancellationToken cancellationToken)
           at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
           at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
           at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
        Source: Emby.Server.Implementations
        TargetSite: Void MoveNext()

Emby versucht den Stream zu transkodieren. Wenn ich folgende URL im Browser aufrufe, dauert es mehrere Sekunden, bis der Stream dann aber problemlos im Browser abgespielt wird.

http://192.168.1.23:8096/audio/420/stream.mp3?DeviceId=uuid:RINCON_949XXXXXXXX401400_MR&amp;MediaSourceId=8af7XXXXXXXX33014b48aaca68b64bf0&amp;Static=true&amp;PlaySessionId=bcb0de550eXXXXXXXX90d9e98cd10575

Im log steht dann:

2021-08-07 09:58:16.365 Info Server: http/1.1 GET http://192.168.1.23:8096/audio/420/stream.mp3?DeviceId=uuid:RINCON_949XXXXXXXX401400_MR&amp;MediaSourceId=8af74a5XXXXXXXX14b48aaca68b64bf0&amp;Static=true&amp;PlaySessionId=bcb0de5XXXXXXXX48790d9e98cd10575. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
2021-08-07 09:58:16.397 Info App: ProcessRun 'StreamTranscode 4f42c3' Execute: C:\Users\XXXXXXXX\Software\emby\ffmpeg.exe -loglevel +timing -y -print_graphs_file "C:\Users\XXXXXXXX\Software\programdata\logs\ffmpeg-transcode-4f42c33d-ffa0-4995-a69c-e19e9695e876_1graph.txt" -f mp3 -i "http://192.168.1.12:3000/EXT/S19.2E-133-7-169" -map 0:0 -vn -sn -c:a:0 copy -ar:a:0 48000 -ac:a:0 2 "C:\Users\XXXXXXXX\Software\programdata\transcoding-temp\XEF6E03.mp3"
2021-08-07 09:58:16.400 Debug App: ProcessRun 'StreamTranscode 4f42c3' Started.

[...]

2021-08-07 09:58:28.506 Info Server: http/1.1 GET http://192.168.1.23:8096/audio/420/stream.mp3?DeviceId=uuid:RINCON_949XXXXXXXX401400_MR&amp;MediaSourceId=8af74aXXXXXXXX014b48aaca68b64bf0&amp;Static=true&amp;PlaySessionId=bcb0deXXXXXXXX748790d9e98cd10575. UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
2021-08-07 09:58:28.508 Info Server: http/1.1 Response 200 to 192.168.1.23. Time: 12143ms. http://192.168.1.23:8096/audio/420/stream.mp3?DeviceId=uuid:RINCON_949F3EXXXXXXXX400_MR&amp;MediaSourceId=8af74aXXXXXXXX014b48aaca68b64bf0&amp;Static=true&amp;PlaySessionId=bcb0deXXXXXXXX748790d9e98cd10575

 

Hier kann man sehen, dass zwischen der Anforderung des Streams und dem Start mehr als 10 Sekunden vergehen. So lange ist die URL http://192.168.1.23:8096/audio/420/stream.mp3 auch noch nicht gültig, d.h. im Verzeichnis transcoding-temp ist noch keine Datei vorhanden. Das merkt wahrscheinlich auch der Sonos und daher schlägt auch der Playbefehl fehl.

Wenn ich ffmpeg direkt aufrufe, funktioniert das auch problemlos:

 .\ffmpeg.exe -loglevel +timing -y -print_graphs_file "C:\Users\XXXXXXXX\Software\programdata\logs\ffmpeg-transcode-4f42c33d-ffa0-4995-a69c-e19e9695e876_1graph.txt" -f mp3 -i "http://192.168.1.12:3000/EXT/S19.2E-133-7-169" -map 0:0 -vn -sn -c:a:0 copy -ar:a:0 48000 -ac:a:0 2 "C:\Users\XXXXXXXX\Software\programdata\transcoding-temp\XEF6E03.mp3"
10:15:56.128 ffmpeg version 4.3.0-emby_2021_02_27-g8f222573e9+634 Copyright (c) 2000-2021 the FFmpeg developers and softworkz for Emby LLC
10:15:56.131   built with gcc 9.2.0 (Rev2, Built by MSYS2 project)
10:15:56.132 Execution Date: 2021-08-07 10:15:56
10:15:58.101 Input #0, mp3, from 'http://192.168.1.12:3000/EXT/S19.2E-133-7-169':
10:15:58.102   Metadata:
10:15:58.102     encoder         : Lavf58.29.100
10:15:58.102     icy-name        : sunshine live
10:15:58.105   Duration: N/A, start: 0.000000, bitrate: 256 kb/s
10:15:58.106     Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 256 kb/s
10:15:58.117 Output #0, mp3, to 'C:\Users\XXXXXXXX\Software\programdata\transcoding-temp\XEF6E03.mp3':
10:15:58.117   Metadata:
10:15:58.117     icy-name        : sunshine live
10:15:58.117     TSSE            : Lavf58.35.100
10:15:58.117     Stream #0:0: Audio: mp3, 48000 Hz, stereo, fltp, 256 kb/s
10:15:58.117 Stream mapping:
10:15:58.117   Stream #0:0 -> #0:0 (copy)
10:15:58.117 Press [q] to stop, [?] for help
10:16:01.905 10:16:01.906 size=     152kB time=00:00:04.82 bitrate= 396.9kbits/s throttle=off speed=0.83x
10:16:01.907 video:0kB audio:152kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.545973%
    Last message repeated 1 times

Ich vermute, dass die Verzögerung von Transcode/Analyzestream/FFprobe kommt - das kann ich aber leider nicht beeinflussen.

Gibt es hier eine Möglichkeit, Internetradio auf Sonos/DLNA-Geräte zu bringen oder habe ich etwas übersehen?

Liebe Grüße

 

 

Link to comment
Share on other sites

Hi, as a test, could you install the IPTV plugin and add this stream to it?
Does this stream play in the web player?
How about to the Sonos?

Link to comment
Share on other sites

DerJens2021

I installed the IPTV plugin and added the sunshinelive stream. I can play this mp3 audiostream in the web player, but i'm not able to stream this to my Sonos device in emby, neither via Sonos nor via DLNA.

 

Link to comment
Share on other sites

  • 2 weeks later...
DerJens2021

Dear Luke,

 

sorry for the delay, I was very busy @work.

Attached you will find some logfiles from my test:

embyserver_playMP3andStrmWeb: Started emby and first play a mp3 file, then two streams via Webbrowser - works fine.

embyserver_playMp3andStrmSonos: Started emby and first play a mp3 file (works fine), then tried to play the two streams - does not work.

 

embyserver_playMp3andStrmSonos.txt embyserver_playMP3andStrmWeb.txt

Link to comment
Share on other sites

Hi, I see an error in your log file there, and I've pushed an update to the Sonos plugin to address it. Please let us know if this helps. Thanks.

Link to comment
Share on other sites

DerJens2021

Dear Luke,

 

I installed Sonos Version 1.0.10 and now I'm able to play my Internet Radio .strm Files on my Sonos devices.

Great job, well done and thanks a lot!

 

Please let me ask another question:

In another post you mentioned that is is possible to rename or disable some Sonos or DLNA devices using profiles. Can you explain this in detail?

 

In my emby setup I can see my Sonos devices and also this devices as DLNA entry. It would be nice if I can disable or rename some of the DLNA devices to avoid confusion because of the double entries.

(I also have two Sonos Bridge devices which should be removed from the device list - because the cannot play anything.)

 

 

Aufnahme12.jpg

Link to comment
Share on other sites

Quote

In another post you mentioned that is is possible to rename or disable some Sonos or DLNA devices using profiles. Can you explain this in detail?

I don't recall this. Can you point me to that?

You could unisntall the Dlna plugin, but of course, you'd lose all Dlna devices. You could also uninstall the Sonos plugin because it can still work with Dlna, but then plain Dlna doesn't support Sonos groups.

I think what we should probably do is either merge the two plugins or have the Dlna plugin detect the presence of the Sonos plugin and then ignore Sonos devices.

Link to comment
Share on other sites

DerJens2021

Yes, of course: Thread Device names,  your comment: Here

I remember that there was another thread. A user wants to assign only selected (dlna-) devices to a certain user in order to avoid, that the children can play music e.g. in parents bedroom. Unfortunately this thread was finished without a solution.

 

In my opinion the option to rename a remote device would be a great feature. This is why I asked you if this could be done using profiles.

For a long term solution I suggest an option to rename devices and an option to enable or disable certain devices for certain users.

 

Feel free to drop me a line if I can assist you with tests or something else.

Link to comment
Share on other sites

OK yes you could do that to rename but not disable, and it will only work with devices imported from Dlna and not from the Sonos plugin. It will also be a hard process. I would suggest using your Sonos apps to change the device names instead.

Link to comment
Share on other sites

DerJens2021

I wasn't able to rename a Dlna device using a custom profile. The logfile shows that my custom profile was assigned to the device but the device name doesn't change. Which setting is responsible for the device name? The profile name?

 

I did another (ugly) hack to tweak the playto-devicelist. This is not applicable for everyone, feel free to remove this if it's undesirable.

Spoiler

            return Promise.all(promises).then(function(responses) {
                for (var targets = [], i = 0; i < responses.length; i++)
                    for (var subTargets = responses[i], j = 0; j < subTargets.length; j++)
                    	{
                    		// Blacklist some devices
                    		if (!(subTargets[j].deviceName.startsWith("192.168."))
                    			&& !(subTargets[j].deviceName.startsWith("BRIDGE")))
                    				targets.push(subTargets[j]);
                    	}
                return targets = targets.sort(sortPlayerTargets)

 

Since the Sonos-devices start with the ip address as Dlna name, they can filtered out. Also I removed the bridges, since they can't play anything.

Link to comment
Share on other sites

DerJens2021

I'm able to rename the Sonos devices but I'm not able to rename their Dlna device names in emby (the first 4 items in the screenshot) They always start with the IP address.

Maybe it would be a good idea to remove the IP from the device name (and also the device type, e.g. Sonos Play:1). In my opinion this would make the device list more handy.

 

Link to comment
Share on other sites

I checked and we are not adding the IP address to the device name ourselves. The Sonos plugin is actually getting the device name directly from the Sonos api, and it's actually using the room name field, in case that may help you at all.

Link to comment
Share on other sites

DerJens2021

Yes, true, the Sonos devices have their IP address included in the DLNA name.

 

 May I ask another question:

When I select some files to play on a Sonos speaker (using the Sonos plugin), the playlist in emby remains empty. Using the Sonos app, I can see the files coming from emby in the playlist queue, but not in emby. In emby I can skip to the next and also previous track, but I'm not able to select a track using the playlist because the list is empty.

Is this a technical limitation when using a Sonos device or can this be fixed?

 

Link to comment
Share on other sites

It's a limitation in Emby. We haven't added support for manipulating the play queue to the Sonos plugin yet. It's on our to do list. Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...