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

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 are you suggesting/asking for exactly?
If the idea is to have a repository or some database that may benefit other users, why not create it yourself?
If you are only interested in the experiences of other users using the exact same device as you, just say so.

BoringName

  • Sr. Member
  • ****
  • Posts: 916

I had several profiles, I kept Marantz and generic (I can't delete it), I added AvegaMedia with the same values as Marantz
I have only checked "enabled musicbee to play on an upnp device"
I only get noise but the song goes on

8466; 10 Profile - Generic Device, useragent=AvegaMediaServer/2.0 Linux/2.6


The AvegaMediaServer is still using the generic profile. You need to check your spelling for the User agent field or restart Musicbee to make sure it's applied correctly.

8559; 13 GetEncodedFile[1] 192.168.1.11 - GET E:\Musique\Chanson Française\Alain Bashung\Alain Bashung - Bleu Petrole\1 - Alain Bashung - Je T'Ai Manque.mp3 to 192.168.1.12; mime=audio/L16;rate=44100;channels=2,rate=44100,channels=2
55969; 25 GetEncodedFile[3] 192.168.1.11 - GET E:\Musique\Chanson Française\Blondino\Blondino - Un paradis pour moi\01 - Faire.flac to 192.168.1.12; mime=audio/L16;rate=96000;channels=2,rate=96000,channels=2

These two are still getting transcoded to PCM,

if I put MP3 and checked "force transcoding"
The track doesn't advance, nothing

275839; 29 Play - E:\Musique\Chanson Française\Alain Bashung\Alain Bashung - Bleu Petrole\1 - Alain Bashung - Je T'Ai Manque.mp3 (http://192.168.1.11:49382/encode/8A82C7FE69A90BEC-2147483622.L24)
296275; 32 Play - E:\Musique\Chanson Française\Alain Bashung\Alain Bashung - Bleu Petrole\2 - Alain Bashung - Residents de la Republique.mp3 (http://192.168.1.11:49382/encode/EC64A3B7A44B6A25-2147483620.L24)

Again, these are getting transcoded to PCM. L24 is 24 bit PCM.

You need to fix the AvegaMediaServer profile and try again. There is a chance if you get flac to play natively it will actually work.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
New version mb_Upnp2025_1.4

Changes
- Re-orientated the settings panel and added a section for problem device settings.
- New option "content length". This adjusts what Musicbee will send in the HTTP headers for the content length. default: leave at this setting unless your device is having problems. None: the content length is never added. PCM Only: The content length header will only be added for PCM files. Fixed: The content length will always be set to Uint32.MaxValue - 8192. I have no idea why the -8192 is there, it's just what LMS use. This setting is profile specific.
- Do not use raw pcm is now profile specific. Leave this unchecked unless you have problems with your device. If you currently have this enabled you will need to re-check it for the each profile.
- Fixed an issue with the profile list that could cause an error when saving.

Force transcoding has been moved under the problem devices section but it's still a global setting for now.

No idea if any of these things will make a difference, I have no way to test them. If you have a device not working properly, all I can suggest is to go through each setting one by one and see if it improves things. Make sure to click save each time, this restarts the UPnP services. You may have to restart your device so it re-broadcasts it's available. Just closing everything and restarting between settings changes is probably a good idea.

It would be good to get some feedback on any of this, especially for Marantz devices as the only person giving any info seems to have gone AWOL.

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
BoringName, first of all, many thanks for your efforts! MusicBee is by far the best software for Windows, and it needed this for a long time.

I've been doing hi-fi reviews for the past two years, mainly streamers - and there's not many good free solutions for Windows and UPNP.  Foobar works, but because of the continuous stream thing, you loose all metadata... and MusicBee library is so much better.

I'm currently using MusicBee on a laptop and all my library files are on a NAS. Right now I have a Eversolo streamer here, bu my regular Cambridge Audio should be back soon, which has a better UPNP protocol.

The plugin works great, the only complaint I have is gapless is not activated and you have a weird 3 seconds pause between tracks... Apparently the trick is to activate the setNextURI, link below from the Wiim forum.

https://forum.wiimhome.com/threads/gapless-mode-setnexturi-issues-for-upnp-interface.478/

If you could fix this, it would be brilliant - gapless is mandatory for a lot of genres.

Many thanks!

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I've been doing hi-fi reviews for the past two years, mainly streamers - and there's not many good free solutions for Windows and UPNP.  Foobar works, but because of the continuous stream thing, you loose all metadata... and MusicBee library is so much better.

Selecting continuous stream with this plugin also removes metadata, I don't think there is a solution for that.

The plugin works great, the only complaint I have is gapless is not activated and you have a weird 3 seconds pause between tracks... Apparently the trick is to activate the setNextURI, link below from the Wiim forum.

Does this happen with continuous stream ticked?

I don't think you can have gapless with that option unticked. That being said, the setnextURI is not currently implemented, the original code does contain some elements of it but most of it is commented out, Steven either didn't finish implementing it or decided to remove it for some reason. I'll see what I can do there, I don't think it will provide gapless playback but I expect it should reduce the delay between tracks.

jean.valjean

  • Jr. Member
  • **
  • Posts: 29
Good evening,

With the new plug'in, the four settings in the “content length” menu don't change anything. The song starts but all I get is noise.
Same if I select “do not use RAW PCM” or “force transcoding”.

It still works in stream (but PCM) or with the device remote control or HEOS software on smartphone.

On the other hand, I'm having problems launching MusicBee.
I don't know if this is due to the plug'in or not, as it's random.

Translated with DeepL.com (free version)

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
I've been doing hi-fi reviews for the past two years, mainly streamers - and there's not many good free solutions for Windows and UPNP.  Foobar works, but because of the continuous stream thing, you loose all metadata... and MusicBee library is so much better.

Selecting continuous stream with this plugin also removes metadata, I don't think there is a solution for that.

The plugin works great, the only complaint I have is gapless is not activated and you have a weird 3 seconds pause between tracks... Apparently the trick is to activate the setNextURI, link below from the Wiim forum.

Does this happen with continuous stream ticked?

I don't think you can have gapless with that option unticked. That being said, the setnextURI is not currently implemented, the original code does contain some elements of it but most of it is commented out, Steven either didn't finish implementing it or decided to remove it for some reason. I'll see what I can do there, I don't think it will provide gapless playback but I expect it should reduce the delay between tracks.

For some reason, I can't get continuous stream to start playback... at least with the Eversolo, I need to try it with the Cambridge MXN10. But it should solve the gapless issue!

Too bad setnextURI can't be implemented.. Let's hope I can make the continous stream work.

Many thanks for the reply!

BoringName

  • Sr. Member
  • ****
  • Posts: 916
With the new plug'in, the four settings in the “content length” menu don't change anything. The song starts but all I get is noise.
Same if I select “do not use RAW PCM” or “force transcoding”.

Have you properly configured the AvegaMediaServer profile yet? I'd be interested to know if you can get a flac file to play natively and whether that plays the same noise.

For some reason, I can't get continuous stream to start playback... at least with the Eversolo, I need to try it with the Cambridge MXN10. But it should solve the gapless issue!

I've just been playing around with continuous stream using BubbleUPnP and it doesn't really work. Very, very rarely it will start playing but most of the time BubbleUPnP will use ffprobe to query the stream first, close it and then try and grab the stream again, for normal track streaming the plugin just creates another stream for it to use but continuous streaming doesn't have an ID in the requested URL so the plugin doesn't know what track to use to reopen the stream. If your eversolo device does a similar thing with ffprobe (or equivalent) that will be the cause of it not playing. You will see a 404 error in the debug log if that is the case. Not sure on a solution for this just yet....

Too bad setnextURI can't be implemented.. Let's hope I can make the continous stream work.

I didn't say that. I just said the metadata issue probably can't be solved for continuous streaming. For normal streaming I should be able to work something out.

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
Yeah, what you say about the continuous stream makes sense, I don't think it will work even with the Cambridge.. I think I already tried it before and it didn't. The one on Foobar is great, and it has solved the gapless issue for me on quite a few streamers.

Oh, I misunderstood you. There's nothing to be done about metadata and continuous streaming, it's just the nature of it,  but if there's an implementation possibility for setNextURI and gapless playback could be possible in normal playback (not continuous streaming), that would be great :)

BoringName

  • Sr. Member
  • ****
  • Posts: 916
but if there's an implementation possibility for setNextURI and gapless playback could be possible in normal playback (not continuous streaming), that would be great :)

Yes, that's what I meant. I don't know if it will be gapless but I would imagine it should at least reduce the gap between tracks. If the device supports SetNextAVTransportURI

As for the issue with BubbleUPnP and continuous streams, the plugin isn't provided with enough info to be able to fix that. It might be device specific though, the BubbleUPnP log shows a warning for "force xiaomi support" and tries to get ffmpeg to re-encode the stream which is why it closes it and then requests it again via ffmpeg. But once it's closed it's gone and I can't get it back. I guess it thinks my phone can't play 44100 16bit pcm which is pretty nuts. There are no options to disable whatever "force xiaomi support" is.

There are options for ffmpeg encoding in BubbleUPnP but none of those options are - "disable ffmpeg encoding". It's annoying.

Tested continuous streaming to foobar and that works fine.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
So using "NextUri" seems like a no go. While the code is there, I can't find a renderer that actually supports it so I have no way of testing how it works. BubbleUPnP supports literally everything except NextUri. Foobar doesn't support NextUri. Also Lyrion Music Server doesn't support it and has notes in their upnp plugin code detailing how using NextUri is a total shitshow because of the varied methods used by devices to implement it.

So it's probably not going to happen. Going by the WiiM post you linked, the WiiM device supports it but that doesn't mean the Eversolo does (it probably doesn't) so it won't solve your issue anyway.

If you look back a few pages you will see steps to setup your device profiles correctly and link the log here. The delay might be caused by unnecessary encoding. In my testing with BubbleUPnP and Foobar I don't get a 3 second delay so it could just be your setup. Actually I do... I'll see if I can improve on that but I don't like my chances.

edit: I think I need to create a setup/troubleshooting guide I can link to.

edit2: looks like foobar has issues getting the next track when not in continuous mode, i'll see what I can find there, it could be related to your issue.

edit3: Foobar's issue is it requests the stream multiple times with different ranges, which it shouldn't be doing unless a seek is being performed, which it isn't. This results in multiple streams being opened and it's not closing them so the plugin is hitting the semaphore limit. Same issue I had with bubbleUPnP except a lot worse. It's 100% a foobar issue.

If only there was some standard everyone could follow instead of implementing their own B.S....
Last Edit: February 21, 2025, 09:29:38 AM by BoringName

BoringName

  • Sr. Member
  • ****
  • Posts: 916
edit3: Foobar's issue is it requests the stream multiple times with different ranges, which it shouldn't be doing unless a seek is being performed, which it isn't. This results in multiple streams being opened and it's not closing them so the plugin is hitting the semaphore limit. Same issue I had with bubbleUPnP except a lot worse. It's 100% a foobar issue.

After a bit of mucking around, If the profile is configured correctly so it doesn't transcode to PCM, foobar works perfectly when streaming MP3 tracks to it. So there is an issue with PCM (or how the plugin streams PCM) that makes foobar go a bit nuts.

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
Hi!

I can guarantee you, if the receiving device has SetNextAVTransportURI activated, it will be gapless, not just reduce the gap between tracks.

The thing with UPNP is, both the software and the device need to have that protocol activated... Open Home (a variation of UPNP developed by Linn) is different, only the receiving device needs to be gapless, because the playlist is managed there, not on the sending software.

For Windows, the only device I know it's gapless is Emby - you install the Server and then use either the Windows app, or the Android app or Symfonium to manage it (Symfonium is a great remote for Android, works with a lot of servers). It's been a long time, but maybe Plex and Jelly fin are gapless too, and I believe former Logitech Media Server, now Lyrion Music Server is too (but now I see in your post it's not). One other option is MinimServer and Bubble UPNP for Android, works great too.

Without installing a server, the only other solutions I know are Aurdirvana and jRiver, which have free trials I believe.

Foobar's only properly working UPNP plugin is the continuous stream one (which works great). As you found out, the other one (which is quite old and not developed for a while) is not working glitch-free. Media Monkey is also not gapless.

As for the receiver, most these days have the protocol activated. Eversolo has, gapless works, but it behaves a little weirdly (it loops the last ack). But the Eversolo is here for test, my day to day streamer is a Cambridge Audio, and that is perfect gapless.

Using either Symfonium + Emby or MinimServer + Bubble UPNP I can guarantee you these ones are gapless:

Eversolo (with a few issues not related to actually being gapless)
Cambridge Audio
Wiim
Heos based streamers (Marantz, Denon)
Lumin based streamers (Lumin, Audiolab 9000N, Luxman)
JBL
Matrix Audio
iFi Audio Neo Stream
Volumio

I have not tried it, but know Moode Audio for Linux is gapless too.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I can guarantee you, if the receiving device has SetNextAVTransportURI activated, it will be gapless, not just reduce the gap between tracks.

I use Emby on my NAS, I'll see if I can do something there with testing.

Really the only thing I'm not sure about with NextURI is how the next track is triggered. Without NextURI, Musicbee (via the plugin) sends a SetAVTransportURI command and tells the device to play it. When the track ends Musicbee repeats that process. If NextURI is set, does the device automatically try and "GET" play the next URI when the first track ends or does it have to be told to do it with a "next" command? Based on the LMS documentation it seems that process varies a lot depending on the device. I really just need a software based renderer that supports nextURI so I can test it, otherwise I'm flying blind.

I have found a discrepancy between the headers set for continuous streaming vs not. If someone with a Marantz device that works for continuous streaming but plays white noise with continuous streaming unchecked could test out this Version, that would help me out. The desired result is continuous streaming plays the white noise issue like what usually happens with continuous streaming is unchecked. DO NOT INSTALL THIS VERSION if everything is working for you.

Also, from everything I have read, a white noise issue is directly related to a PCM stream. The continuous stream is a PCM stream so obviously the problem devices can play PCM but for whatever reason I'm trying to work out, PCM is having issues if continuous isn't checked. The point is, if you configure the profile correctly so you stream flac or MP3 directly to the device, there is a good chance you will bypass the white noise issue. Not saying you won't face some other issue but I'm fairly confident it will solve the white noise issue.

Anyway, hopefully someone can test the version above, if it results in white noise with a continuous stream then I know what the problem is..... I don't like the chances though.

edit: Just edited the post as I know it doesn't try and "GET" the next track when the other ends. The whole idea of NextURI is it caches some of the next track while the first track is playing. So the question is, does it automatically switch to playing the next track or do I need to tell it to.

edit2: And just to confirm what you have already said. It is clear that NextURI support is the requirement for true "Gapless" playback. The "continuous stream" option is obviously a workaround for devices that do not support NextURI. BubbleUPnP is supposed to support NextURI so I need to do some research there. I've enabled "gapless playback" with the local renderer but "GetMediaInfo" is still reporting "NOT_IMPLEMENTED" for NextURI.
Last Edit: February 21, 2025, 12:19:54 PM by BoringName

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
I can guarantee you, if the receiving device has SetNextAVTransportURI activated, it will be gapless, not just reduce the gap between tracks.

I use Emby on my NAS, I'll see if I can do something there with testing.

Really the only thing I'm not sure about with NextURI is how the next track is triggered. Without NextURI, Musicbee (via the plugin) sends a SetAVTransportURI command and tells the device to play it. When the track ends Musicbee repeats that process. If NextURI is set, does the device automatically try and "GET" play the next URI when the first track ends or does it have to be told to do it with a "next" command? Based on the LMS documentation it seems that process varies a lot depending on the device. I really just need a software based renderer that supports nextURI so I can test it, otherwise I'm flying blind.

I have found a discrepancy between the headers set for continuous streaming vs not. If someone with a Marantz device that works for continuous streaming but plays white noise with continuous streaming unchecked could test out this Version, that would help me out. The desired result is continuous streaming plays the white noise issue like what usually happens with continuous streaming is unchecked. DO NOT INSTALL THIS VERSION if everything is working for you.

Also, from everything I have read, a white noise issue is directly related to a PCM stream. The continuous stream is a PCM stream so obviously the problem devices can play PCM but for whatever reason I'm trying to work out, PCM is having issues if continuous isn't checked. The point is, if you configure the profile correctly so you stream flac or MP3 directly to the device, there is a good chance you will bypass the white noise issue. Not saying you won't face some other issue but I'm fairly confident it will solve the white noise issue.

Anyway, hopefully someone can test the version above, if it results in white noise with a continuous stream then I know what the problem is..... I don't like the chances though.

edit: Just edited the post as I know it doesn't try and "GET" the next track when the other ends. The whole idea of NextURI is it caches some of the next track while the first track is playing. So the question is, does it automatically switch to playing the next track or do I need to tell it to.

Oh, that's great - Emby is definitely gapless with all the streamers mentioned above! I understand it's hard for you to test without a software renderer, don't you know anyone with a Wiim or a Cambridge? They have very small products, it would be very easy to lend.

I can't help you very much with the software side of things, as I don't have any code chops, just user experience. What I can tell you is when gapless is activated, the hi-fi streamer gets two tracks at a time - if you're playing a record, the server will send the first two tracks and that's the only thing you'll see on the queue - this is easy to see if, for example, you're using Emby and sending to a Cambridge MXN10 streamer. On the Emby app you'll see the whole playlist, but if you open the Cambridge app, the MXN10 only has track 1 and track 2 at the beginning of the record. When tracks 1 moves gaplessly to track 2, you'll see track 1 disappear from the queue and track 3 arrives, meaning the queue has track 2 and track 3 at this point. Then track 2 moves to track 3, track 2 disappears and you see track 3 and track 4 on the queue. And so on and so on.... This is what you have explained on your "edit" above.