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

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Did you get Upmpdcli to work with your plugin?

No. I don't have linux machine. I could setup in an instance in windows I suppose but the last time I did that caused nothing but problems. I have a raspberry pi but it's performing some important functions and I don't want to mess with it.
Among my family we've got 5 raspberry pis (from 1 to 3B)

Just be aware this plugin will only play to one device at a time. I have no plans to make it stream to multiple devices at the same time.

I'll gladly send you logs if that would help.
I've listed in the previous post which file I need to check the logs. 501 means the server does not support the functionality required.

Casual Tea

  • Jr. Member
  • **
  • Posts: 23
Just be aware this plugin will only play to one device at a time. I have no plans to make it stream to multiple devices at the same time.
No worries. That's all handled on the side of the upnp renderer via Snapserver and Snapclient. You cast to a Snapserver instance and that coordinates the synchronous playback of any Snapclients that have it configured as the server. You can even run server and client on the same pi so you don't "lose" a playback device.

I have 3 upnp targets for my living room + bedroom.
pi 3B in living room with upmpdcli + snapclient
pi zero 2 W in bedroom with upmpdcli + snapclient
proxmox lxc debian container with upmpdcli + snapserver

If I cast to one of the pi targets, it plays directly via upmpdcli (without transcoding).
If I cast to the proxmox lxc debian container, both pis play the same in sync (with transcoding to retain the sync).
It's an elegant solution with synchronous gapless multi-room audio and completely FOSS. It's also cheap, as you can get a pi zero 2 W + Hifiberry DAC, power supply, micro sd card and case for 50-70€.
Another benefit is that since these are all plain upnp targets, anyone in the same network can cast to any of them with any software that supports upnp. Not like that plexamp garbage.

I've sent you the logs per direct message.

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
Sorry, I've been very busy with my Auralic test. I'll send you the log file via PM but ) could find anything there.

I need the plugin log file not the musicbee log file. It should be located in Musicbee\AppData\UpnpErrorLog.dat
Of if you run the installed version, something like
C:\Users\<username>\AppData\Roaming\MusicBee\UpnpErrorLog.dat

But the musicbee error log does show some problems with your install.
20/02 it was reporting no sound card detected.
27/02 shows you're trying to play files from a NAS but it errors because Interop.PortableDeviceApiLib is missing. Have you setup your NAS in musicbee as a portable device?
27/02 could not load the bass.dll because it looks like your trying to run musicbee from the unzipped patch folder?
27/02 could not load "MusicBeeIpod"

I don't know what you are doing but I don't think your issues are related to this plugin. You need to make sure you have installed Musicbee correctly.

OK, I sent you the right log file this time.

Yeah, since I copied those files, something went wrong with MusicBee - I need a fresh install!

simbun

  • Jr. Member
  • **
  • Posts: 39
I have a second machine here, I'll load up foobar on it and see how the track transitions are over the network. I think the fact it's instant on the same machine means the process is probably setup correctly, it's just network variables might cause a delay when it's not on the same machine. Also different devices may implement a different process.

edit: Tested foobar over the network and it's gapless. So I think I've set it up correctly. Any delays will either be issues with the profile, device or network setup. You should also make sure your Antivirus and/or firewall programs are not interfering in any way.
It's definitely not network related as I don't see this problem with any other control point, and that's with playing tracks down to 3 seconds in length using the same PC as source.

I tried to use other control points with MusicBee as a source, but BubbleUPnP, Hi-Fi Cast and mconnect all threw invalid mime-type errors when trying to cast to the WiiM. The only thing I can see from the DIDL is that MusicBee uses a .x-flac extension for flac files, which is strange, although shouldn't cause it to fail. Is there any way to test that, as I don't think I have a server that will index .x-flac files.

When using upplay it worked (no idea how), but playback always started with the previously played track no matter what I did, so that avenue was a dead end too.

I will test the updates, but because nothing works reliably I'm struggling to come up with a plan to assist.

EDIT: I converted the flac files to WAV and now BubbleUPnP, Hi-Fi Cast and mconnect all play gaplessly to the WiiM, so I assume it is the .x-flac extension. The conversion didn't help the MusicBee control point though.
Last Edit: March 02, 2025, 11:23:36 AM by simbun

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I tried to use other control points with MusicBee as a source, but BubbleUPnP, Hi-Fi Cast and mconnect all threw invalid mime-type errors when trying to cast to the WiiM. The only thing I can see from the DIDL is that MusicBee uses a .x-flac extension for flac files, which is strange, although shouldn't cause it to fail. Is there any way to test that, as I don't think I have a server that will index .x-flac files.

x-flac is the mime type. It would only be using that if your device advertises that it supports that mime type.

Could the problem be related to this post you made regarding a extra dots in the filename a couple of years ago? minimserver forum

I haven't gone through the logs others have PM'd me, I'll get to that later today.

edit: I can see how the x-flac is being added as an extension. A lot of the mimetypes are listed as audio/aac, audio/x-aac and it just returns the first one that matches a supported mimetype for the codec being used. For flac, the audio/x-flac is listed first so that's what it uses if the device supports it. A lot of the other codecs have the x- version listed second. I could switch those around so it's more likely to use .flac instead of .x-flac but not sure it will really change anything.
Last Edit: March 02, 2025, 10:11:04 PM by BoringName

simbun

  • Jr. Member
  • **
  • Posts: 39
I tried to use other control points with MusicBee as a source, but BubbleUPnP, Hi-Fi Cast and mconnect all threw invalid mime-type errors when trying to cast to the WiiM. The only thing I can see from the DIDL is that MusicBee uses a .x-flac extension for flac files, which is strange, although shouldn't cause it to fail. Is there any way to test that, as I don't think I have a server that will index .x-flac files.

x-flac is the mime type. It would only be using that if your device advertises that it supports that mime type.

With MusicBee in server mode (used with a third party control point) an x-flac file extension is served:
Code
<res protocolInfo="http-get:*:audio/x-flac:DLNA.ORG_OP=11;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000" size="4283689" duration="0:00:55" bitrate="77750" sampleFrequency="44100" nrAudioChannels="2">http://192.168.0.12:49382/files/C50AB82914AE234D.x-flac</res>
I know it shouldn't matter as WiiM should be looking at the mime type, but it seems a strange decision, especially knowing how fragile most UPnP implementations are.
I seem to remember that Logitech Media Server used .flc which WiiM had to address  - clearly just by adding it to the list of accepted extensions!


Could the problem be related to this post you made regarding a extra dots in the filename a couple of years ago? minimserver forum
In the early days the UPnP implementation was riddled with bugs but it's been pretty stable for a while now.

simbun

  • Jr. Member
  • **
  • Posts: 39
edit: I can see how the x-flac is being added as an extension. A lot of the mimetypes are listed as audio/aac, audio/x-aac and it just returns the first one that matches a supported mimetype for the codec being used. For flac, the audio/x-flac is listed first so that's what it uses if the device supports it. A lot of the other codecs have the x- version listed second. I could switch those around so it's more likely to use .flac instead of .x-flac but not sure it will really change anything.
I'm sure that will fix the WiiM issue, at least when being used from third party control points.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
OK, I sent you the right log file this time.

Yeah, since I copied those files, something went wrong with MusicBee - I need a fresh install!

You're killing me. Your log is a mess, it looks like you have 3 different devices all creating log entries. None of them are matching to a profile. View the log, hit control+A so it highlights everything and hit the delete key to clear it out and click save.

Remove the other UPnP devices from the network, turn them off or whatever and just use the device you are having issues with.

And remind me what the problem is again?

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
OK, I sent you the right log file this time.

Yeah, since I copied those files, something went wrong with MusicBee - I need a fresh install!

You're killing me. Your log is a mess, it looks like you have 3 different devices all creating log entries. None of them are matching to a profile. View the log, hit control+A so it highlights everything and hit the delete key to clear it out and click save.

Remove the other UPnP devices from the network, turn them off or whatever and just use the device you are having issues with.

And remind me what the problem is again?

Sorry, I didn't mean to give you any trouble - as I said, I'm not code savy, I just sent the file you asked. it's big because I've done several experiments with two different streamers.

The new log is much shorter, done playing two songs trough a Cambridge Audio MXN10. My problem is it's not gapless, there's a half-a-second glitch between the two tracks.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I've sent you the logs per direct message.

That sounds like a cool setup. I'm just going to post replies in here as it's easier for me to keep track of everything plus I think it might help others troubleshoot their own problems in future.

So the 501 error was a red herring, it's trying to send a pause command but the device has already crashed with a 500 error so it's reporting the command was unsupported because it didn't get a response (I think....). Actually, looking at it again, I believe the stream is crashing the device and stopping playback and the plugin is then attempting to send the pause command in an attempt to sync playstates which I'm not 100% sure why yet but because it's already crashed it's reporting this error. I need to go over this but the issue is the stream is crashing the device.

For the most part it seems to be working, it's connecting, starting the stream and successfully setting the NextURI. So it's probably related to the WAV file. Its currently getting encoded to apply DSP/replaygain settings.

If you haven't already I would try the following
1. Make sure your firewall is not blocking anything.
2. check "Do not use raw PCM" and see how that goes, you should see L16 or L24 as the extension in the log instead of .WAV
3. If option 2 doesn't work, try and get it to play a native stream. Remove DSP/replaygain settings and adjust the profile to make sure it won't encode the file and see if that will stream ok.

You want the log to have "GetFile" entries, not "GetEncodedFile".

The more I look at that "Do not use Raw option" I feel like Lyrion had it backwards. Wouldn't L16/L24 be classed as RAW as it's just PCM? WAV is PCM with a 44 byte header although from what I've read it can contain other things, I don't know.

edit: Also I believe you can set upmpdcli to log to a file. That might give you a better idea of what's causing it to fail. The plugin error log isn't that great for solving problems as it doesn't know why the device did or didn't play something. The device log should give you more info in this regard.
Last Edit: March 02, 2025, 11:47:13 PM by BoringName

BoringName

  • Sr. Member
  • ****
  • Posts: 916
The new log is much shorter, done playing two songs trough a Cambridge Audio MXN10. My problem is it's not gapless, there's a half-a-second glitch between the two tracks.

Sorry I replied to your PM before I saw this post.

Yeah, I don't think I can do anything about that. I'm fairly sure that is a device problem. The NextURI is getting set successfully I have no control over how long a device takes to switch to it when the first track ends.

edit: I don't think this will help but you do appear to have a lot of UPnP devices on your network. That all creates traffic the plugin (and other devices) have to process. It probably won't make a noticeable difference but it might be worth just removing some of them while your testing to make sure they are not causing problems.
Last Edit: March 02, 2025, 11:17:04 PM by BoringName

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31
The new log is much shorter, done playing two songs trough a Cambridge Audio MXN10. My problem is it's not gapless, there's a half-a-second glitch between the two tracks.

Sorry I replied to your PM before I saw this post.

Yeah, I don't think I can do anything about that. I'm fairly sure that is a device problem. The NextURI is getting set successfully I have no control over how long a device takes to switch to it when the first track ends.

edit: I don't think this will help but you do appear to have a lot of UPnP devices on your network. That all creates traffic the plugin (and other devices) have to process. It probably won't make a noticeable difference but it might be worth just removing some of them while your testing to make sure they are not causing problems.

No worries!

It may be a device problem, but I have used this device (MXN10) since December 2023 with an Emby Server + Simfonium app or MinimServer + Bubble UPNP (plus others, but mainly these two), always gapless, no issues...

For different reasons, I cannot turn off the other UPNP devices, but those are always on and have not been a problem, ever, with the MXN10 and many other products i have tested in the last year and a half.

Anyway, thanks for all your efforts, it would be great if it could be gapless, but it's great as it is already.

BoringName

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

It may be a device problem, but I have used this device (MXN10) since December 2023 with an Emby Server + Simfonium app or MinimServer + Bubble UPNP (plus others, but mainly these two), always gapless, no issues...


Hmm. Where is that other software running from?

Could it be a network thing? If that other software is running off your NAS vs musicbee running off your PC, it could just be it's taking longer to access the files for whatever reason.

jorgemg1984

  • Jr. Member
  • **
  • Posts: 31

It may be a device problem, but I have used this device (MXN10) since December 2023 with an Emby Server + Simfonium app or MinimServer + Bubble UPNP (plus others, but mainly these two), always gapless, no issues...


Hmm. Where is that other software running from?

Could it be a network thing? If that other software is running off your NAS vs musicbee running off your PC, it could just be it's taking longer to access the files for whatever reason.

With MusicBee, there's no server - it's running on a laptop but the files are indeed on a NAS. I will try with files on the laptop tomorrow. but I don't think it will matter - I'll report back,

BoringName

  • Sr. Member
  • ****
  • Posts: 916
We can test if it's a network issue with foobar.

Download 32 bit - Foobar
download this - upnp plugin

Create  foobar folder somewhere.
Run the foobar installer and select portable install and set it to the foobar folder you created.
Run foobar
Goto File->Preferences
Components should be selected by default. Click install in the bottom right corner and selected the Upnp file you downloaded earlier and click apply.
Probably worth restarting foobar at this point.

Open musicbee and set foobar as the output device. Play a few tracks and see if it's gapless, if it isn't that points to an issue with the network more than the plugin, if it is gapless we are probably back to square one but at least it rules one possible problem out.

When you're done with foobar you can just delete the foobar folder.