Author Topic: UPnP 2025 - Continuation of the original UPnP/DLNA plugin  (Read 35297 times)

hiccup

  • Hero Member
  • *****
  • Posts: 9107
Here's an odd one.

Using UPnP2025's default settings,
My regular opus files play fine.

But, I have created a set of test files that include some very short opus tracks.
And those will not play.
MusicBee's progressbar won't move either.
(MusicBee itself will play them fine using my soundcard as output)

I've PM'ed you a link to the test files I am using.
There are 8 'discs' in it. Each disc contains a short song split in three parts.  (handy for testing gapless playback)
Each disc is in a different audio format.
So the opus disc that won't play is disc #3

the log file:
Code
30865; 16 Listen - denied 82.169.192.127
30866; 17 Listen - denied 82.169.192.127
30966; 18 Profile - Generic Device, useragent=LINUX UPnP/1.0 Denon-Heos/89d5d44801a9e1f13ce455537f775120edf47a88
0; 1 Initialise - 4/4/2025 14:29:40
33; 2 GetNetworkAddresses - 192.168.2.1,dns=True,name=Ethernet 2,speed=1000000000
34; 3 GetNetworkAddresses - 127.0.0.1,dns=False,name=Loopback Pseudo-Interface 1,speed=1073741824
34; 4 GetNetworkAddresses - http://192.168.2.1:49382
56; 5 ProcessMessage 192.168.2.111 - device 'uuid:6e52c5d4-d3c1-1894-0080-0005cdf71792:Marantz NR1509',valid=True
988; 6 ProcessMessage 192.168.2.1 - device 'uuid:3B9596A5-0FAC-3FD9-F599-8A25E8F10962:Squeezebox Classic',valid=True
990; 7 Profile - Generic Device, useragent=|Lyrion Music Server (9.1.0 - 1743612904)
991; 8 Profile - Generic Device, useragent=|Lyrion Music Server (9.1.0 - 1743612904)
1004; 9 Activate - Squeezebox Classic:http-get:*:audio/mpeg:*,http-get:*:audio/L16;rate=8000;channels=1:*,http-get:*:audio/L16;rate=8000;channels=2:*,http-get:*:audio/L16;rate=11025;channels=1:*,http-get:*:audio/L16;rate=11025;channels=2:*,http-get:*:audio/L16;rate=12000;channels=1:*,http-get:*:audio/L16;rate=12000;channels=2:*,http-get:*:audio/L16;rate=16000;channels=1:*,http-get:*:audio/L16;rate=16000;channels=2:*,http-get:*:audio/L16;rate=22050;channels=1:*,http-get:*:audio/L16;rate=22050;channels=2:*,http-get:*:audio/L16;rate=24000;channels=1:*,http-get:*:audio/L16;rate=24000;channels=2:*,http-get:*:audio/L16;rate=32000;channels=1:*,http-get:*:audio/L16;rate=32000;channels=2:*,http-get:*:audio/L16;rate=44100;channels=1:*,http-get:*:audio/L16;rate=44100;channels=2:*,http-get:*:audio/L16;rate=48000;channels=1:*,http-get:*:audio/L16;rate=48000;channels=2:*,http-get:*:audio/vnd.dlna.adts:*,http-get:*:audio/vnd.dlna.adts:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4:*,http-get:*:audio/mp4:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/x-ms-wma:*,http-get:*:application/ogg:*,http-get:*:audio/flac:*,http-get:*:audio/wav:*,http-get:*:audio/opus:*
1354; 10 Listen - denied 82.169.192.127
1457; 11 Profile - Generic Device, useragent=LINUX UPnP/1.0 Denon-Heos/89d5d44801a9e1f13ce455537f775120edf47a88
5464; 12 Play - Input - K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-1.flac Output - (http://192.168.2.1:49382/files/0E7E3DA01C34082Ep.flac)
5599; 13 StateTimer - Playing,old=Stopped
5621; 14 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
5629; 15 GetFile[1] 192.168.2.1 - GET K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-1.flac to 192.168.2.120
5629; 16 GetFile - range=bytes 0-355816/355817
5629; 17 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
6120; 18 GetFile[1] - exit=0, playtime=490
6255; 19 SetNextAVTransportURI - Success - http://192.168.2.1:49382/files/DCA260A21775818Dp.flac:K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-2.flac
7943; 20 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
7943; 21 GetFile[2] 192.168.2.1 - GET K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-2.flac to 192.168.2.120
7943; 22 GetFile - range=bytes 0-407106/407107
7943; 23 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
8024; 24 GetFile[2] - exit=0, playtime=81
11509; 25 SetNextAVTransportURI - Success - http://192.168.2.1:49382/files/E37D9943109A49ECp.flac:K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-3.flac
11513; 26 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
11513; 27 GetFile[3] 192.168.2.1 - GET K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-3.flac to 192.168.2.120
11513; 28 GetFile - range=bytes 0-371066/371067
11513; 29 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
11863; 30 GetFile[3] - exit=0, playtime=350
16432; 31 SetNextAVTransportURI - Cleared
16537; 32 Listen - denied 82.169.192.127
21509; 33 Listen - denied 82.169.192.127
22122; 34 StateTimer - Stopped,old=Playing
27059; 35 Play - Input - K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-1.opus Output - (http://192.168.2.1:49382/files/0E7DF7070C38F6DFp.opus)
27072; 36 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
27072; 37 GetFile[4] 192.168.2.1 - GET K:\_MusicBee test library\UPnP test\short album\Bach cantata split in three\1-1.opus to 192.168.2.1
27072; 38 GetFile - range=bytes 0-174726/174727
27072; 39 Profile - LMS (Lyrion/Logitech Media Server), useragent=iTunes/4.7.1 (Windows; N; Windows 10 (64-bit); 8664; EN; cp1252) SqueezeCenter, Squeezebox Server, Lyrion Music Server/9.1.0/1743612904
27073; 40 GetFile[4] - exit=0, playtime=0
34693; 41 Listen - denied 82.169.192.127
Last Edit: April 04, 2025, 01:32:04 PM by hiccup

BoringName

  • Sr. Member
  • ****
  • Posts: 916
But one issue I planned to report is related to the audio pitch changing depending on the 'output sample rate'.

I'll check it out, It might be including the wrong sample rate metadata.

Will the streams to the device be in their original audio format, or are they converted to a pcm stream, depending on settings on the right side of the settings panel?
-  If in their original format, is all metadata supposed to be included and relayed to the receiving device?
-  If they are streamed as pcm, is the original metadata preserved and relayed to the receiving device somehow?
(PS, I assume MusicBee's volume slider does not affect (transcoding) the stream itself, but adjusts the volume on the playing device?)

They will be in their original format unless they are outside the criteria listed in the right side of the panel. eg) if you have a samplerate range of 48000-92000 and the track is
44100 it will get encoded. Or if stereo only is checked and you play a 5.1 track.
Metadata is sent separately in XML format, it's not part of the audio stream. Most of the metadata is included but some things are not part of the UPnP standard. eg) replaygain isn't.
Yes, the volume slider just changes the volume on the target device.

I have been wrecking my brain over the 'output sample rate' setting.

The plugin will set the output sample rate to whatever value you have set in this field unless it is outside the sample rate range.You might have the sample rate range set to 48000-96000 so anything in that range plays natively but when something falls outside that range and gets encoded, if you want that to be 88200 you would put that value in the output sample rate. I'd expect most people would just leave it at "same as source".

edit: just to add to this. If you had the output ranges set to 48000-96000 and the output sample rate to 22050. the output sample rate will be ignored because it's outside of the range. The range is supposed to reflect the devices capabilities which is why it won't attempt 22050 in this scenario. Tracks below 48000 will get encoded to 48000, tracks above 96000 will get encoded to 96000. Anything inbetween will not get encoded.

Could you elaborate on what settings are stored for device profiles exactly?
The following settings are global
force little endian for PCM streams - I should make this profile specific.
force transcoding
force native stream
Last Edit: April 05, 2025, 01:34:13 AM by BoringName

BoringName

  • Sr. Member
  • ****
  • Posts: 916
But, I have created a set of test files that include some very short opus tracks.
And those will not play.
MusicBee's progressbar won't move either.

Lyrion is trying to encode them to flac and failing for some reason. And I've just realised the OPUS files I have previously been testing and thought worked natively are just getting encoded to flac. But it's reporting to SqueezePlay that it's playing OPUS.... that's frustrating as I made a post on the SqueezePlay github stating it supports OPUS when it doesn't.

One problem is the file is 44.1k but musicbee was listing it as 48k. I re-encoded them with ffmpeg  
Code
ffmpeg -i "1-1.opus" "1-1 output.opus"
This fixed the mismatch but it still didn't work.

It might be an issue because they are so short. I'm not sure. Now I need to go explain why I'm dumb on the SqueezePlay github....

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974
The musicbee API doesn't support Ape. The fact I only first heard of it today and it's 25 years old might be why....
I am not planning to add encoder support for APE, so i think you are free to add your own enumeration to FileCodec and build play support without the ability to convert other formats to APE
Ape = 19

i will reserve it on the MB side so that enum value is not used in the future on the MB side

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I am not planning to add encoder support for APE, so i think you are free to add your own enumeration to FileCodec and build play support without the ability to convert other formats to APE
Ape = 19
i will reserve it on the MB side so that enum value is not used in the future on the MB side

I see what you did there. Who am I supposed to blame now if I just didn't want to do the testing for it  :P

I'll add it in while I'm looking into the Opus issues.

hiccup

  • Hero Member
  • *****
  • Posts: 9107
One problem is the file is 44.1k but musicbee was listing it as 48k.
Are you sure about that?
I always thought it was technically impossible for opus to be 44.1 kHz.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Are you sure about that?
I always thought it was technically impossible for opus to be 44.1 kHz.

I was sure because MediaInfo reported it as 44.1 but I just used ffprobe and that reports it as 48 so I don't know now. That 44.1 must have come from somewhere and it reports 48k after I encode it with ffmpeg.

Anyway, it wasn't the cause of the problem because neither version worked.

hiccup

  • Hero Member
  • *****
  • Posts: 9107
I was sure because MediaInfo reported it as 44.1 but I just used ffprobe and that reports it as 48 so I don't know now.
It looks like the guys at MediaInfo are aware of this flaw, but they don't care much about Opus and won't fix it.
What it probably shows for the sample rate is the sample rate of the originating file.

I encoded a 22.050 kHz flac to Opus to test this.
The Opus file is now 48 kHz but MediaInfo says it is 22.05 kHz.
foobar2000 shows it the best:

Last Edit: April 05, 2025, 09:46:06 AM by hiccup

hiccup

  • Hero Member
  • *****
  • Posts: 9107
Metadata is sent separately in XML format, it's not part of the audio stream. Most of the metadata is included but some things are not part of the UPnP standard. eg) replaygain isn't.
I see.
So that means that if you want to play your music making use of ReplayGain, it can only be done at MusicBee's side.
Which means that files will then always be transcoded to what is set in the plugin's preferences.
Ah well, I don't think that is really a problem. If you have it set to output as flac or pcm, there will be no audible degradation.

BTW, for Opus files ReplayGain does work at the side of the rendering device.
That will be because Opus stores RG information in the header of the file itself and not as metadata.



Quote
If you had the output ranges set to 48000-96000 and the output sample rate to 22050. the output sample rate will be ignored because it's outside of the range. The range is supposed to reflect the devices capabilities which is why it won't attempt 22050 in this scenario.
So does this mean the sample rate will be increased when set below the defined range, but it will also get decreased when set above the defined range?
If so, the current infotool text is not accurate?:
'If this is set lower than the minimum sample rate for this device the stream will be upsampled to match the minimum setting.'

Something like this would then be better?:
'if the value is set outside the range of what is defined under 'output sample rate', the nearest value of that range will be used'

Also, there are currently two 'output sample rate' fields.
Perhaps change the first one to: 'output sample rate range:' ?


Suggestion/request #1

Could a preset for LMS be added?
After some testing and investigation, it seems something like this should work well for the majority of LMS /Squeezebox users.




Suggestion/request #2

There is one setting field that is white, but all others are grey:


Suggestion:
- make them all white
- make them al grey (greyed out and inactive) when 'force native stream' is selected.
  (assuming I understand correctly how things work)


'sound bug'

Every time a pcm stream or a wav file plays, it starts with a rather loud click and it ends with a click.
They sound like a vinyl record that has some very serious dust particles on it, on the verge of pushing the needle out of the groove. (an aspect of vinyl that I don't miss at all ;-)

Here is a gif.
Pretty much useless since there is no sound, but imagine pretty loud clicks at every start and end of a track.


(It's 'album #5' from the test files that I send you earlier)

Also I notice that the progressbar behaves a bit weird. It starts moving at first, but then skips back a little bit.
Maybe there is some clue in that?


Just a thought

Perhaps add the option to convert to Opus?
Considering it is better than MP3, both in sound quality and streaming optimalisations.


PS
Big brains over at LMS are working on trying to fix the APE issue for the x64 version of Lyrion.
Nice.
Last Edit: April 05, 2025, 07:03:42 PM by hiccup

hiccup

  • Hero Member
  • *****
  • Posts: 9107
I would suggest that everyone for whom that plugin works to post the setup or devices that are used so there could be a database of supported devices. My interest would be which audio streamers (like WIIM mini) work with this plugin.
What have you done to try and test this yourself?
Do you have any recommendations for a possible WIIM preset that works, and other MusicBee/WIIM users may benefit from?
Last Edit: April 05, 2025, 06:51:29 PM by hiccup

Moodymann

  • Jr. Member
  • **
  • Posts: 29
Guys, describe your experience of streaming Soundcloud in BubbleUPnP for Android using the plugin? What specific plugin settings are needed for this? If it is even possible? I have BubbleUPnP selected as the sound output in the settings, but the track does not play and this message pops up:

https://imgur.com/Kj0AdSf

I also provide the settings window, maybe you will immediately understand what is wrong:

https://imgur.com/yxnzNJ3

hiccup

  • Hero Member
  • *****
  • Posts: 9107
I also provide the settings window, maybe you will immediately understand what is wrong:
I know close to nothing about BubbleUPnP.
But I notice that you have changed the default preset for it.
Does it work using the original default settings?

BoringName

  • Sr. Member
  • ****
  • Posts: 916
So that means that if you want to play your music making use of ReplayGain, it can only be done at MusicBee's side.

Correct.

Quote
Something like this would then be better?:
'if the value is set outside the range of what is defined under 'output sample rate', the nearest value of that range will be used'

Yes.

Quote
Also, there are currently two 'output sample rate' fields.
Perhaps change the first one to: 'output sample rate range:' ?

They are under different sub headings. If I change it to what you suggested it would encroach on the min field and I would have to re-align a bunch of elements. This form is just in raw code format, there is no designer UI where I can drag around the elements, I have to manually change all the location values.

Quote
Could a preset for LMS be added?
After some testing and investigation, it seems something like this should work well for the majority of LMS /Squeezebox users.

I could but I would suggest having force native stream ticked will work just as well. Especially when LMS just encodes anything the device doesn't support anyway.

Quote
There is one setting field that is white, but all others are grey:

This is to indicate it's a value that can be manually entered. Due to the reason mentioned above I'm not going to change this.

Quote
- make them all grey (greyed out and inactive) when 'force native stream' is selected.

I'll think about it. I'll be honest I'm not that motivated to perfect the options page. It's something 99% of users will play around with once and never look at again once things are working. The return on investment is low....

Quote
Every time a pcm stream or a wav file plays, it starts with a rather loud click and it ends with a click.
They sound like a vinyl record that has some very serious dust particles on it, on the verge of pushing the needle out of the groove. (an aspect of vinyl that I don't miss at all ;-)

I get this as well. Some other users were not reporting it as an issue so I figured it was hardware specific.

Quote
Also I notice that the progressbar behaves a bit weird. It starts moving at first, but then skips back a little bit.

When a track first starts playing the plugin will attempt to sync the progress bars at the 1 second mark. The UPnP standard only allows for the device to report playback position in seconds, not milliseconds. So I try and capture the moment where it changes from 0 to 1 second and set the Musicbee progress bar to 1 second at this moment. This can cause the progress bar in musicbee to jump a little bit but it doesn't effect the playback at all. Earlier attempts at this did actually seek the playing track which caused some clicks. This was solved. I don't think I'll be able to solve this particular issue.

Quote
Perhaps add the option to convert to Opus?
Considering it is better than MP3, both in sound quality and streaming optimalisations.

Is there actually a streaming device that supports Opus? Keep in mind it's only working on your squeezebox because LMS is converting it to flac.

What's wrong with just using flac?

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Guys, describe your experience of streaming Soundcloud in BubbleUPnP for Android using the plugin? What specific plugin settings are needed for this? If it is even possible? I have BubbleUPnP selected as the sound output in the settings, but the track does not play and this message pops up:

If you're streaming from the net like a radio station or soundcloud, I expect you will need to tick "output as continuous stream" at the top of the settings page. There is no getting around that. Make sure to read the little note there about not being able to display track information.

Also untick "enable remote control of musicbee via UPnP". That option is only needed if you are using Musicbee as a renderer for a control point which is very unlikely.


hiccup

  • Hero Member
  • *****
  • Posts: 9107
Thanks.
I will (literally) sleep on what you explained and your standpoints on things.
Most of it I can sympathise with and understand why it may not be worth the effort of making changes.
I'll probably be back later about things that I think I  don't agree with.