PeteManchester / MediaPlayer

61 stars 20 forks source link

bitrate issue / UPnP / DIDL #88

Closed ik666 closed 3 years ago

ik666 commented 3 years ago

Hi Pete,

I've checked back with two content delivery server, how they encode and deliver the DIDL-Lite metadata to the control point:

<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sec="http://www.sec.co.kr/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
    <item id="-1" parentID="-1" restricted="1">
        <dc:title>
            Don't It Make My Brown Eyes Blue
        </dc:title>
        <dc:creator>
            Lisa Fredrik
        </dc:creator>
        <upnp:class>
            object.item.audioItem.musicTrack
        </upnp:class>
        <upnp:genre>
            Jazz
        </upnp:genre>
        <upnp:album>
            Best Of Jazz Audiophile Voices
        </upnp:album>
        <upnp:artist>
            Lisa Fredrik
        </upnp:artist>
        <upnp:originalTrackNumber>
            19
        </upnp:originalTrackNumber>
        <dc:date>
            2011-01-01
        </dc:date>
        <res bitrate="176400" bitsPerSample="16" duration="0:03:35.013" nrAudioChannels="2" protocolInfo="http-get:*:audio/x-flac:DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000" sampleFrequency="44100" size="22397117">
            http://10.0.9.140:9790/minimserver/*/music/Jazz/Best*20of*20Jazz*20Audiophile*20Voices/CD2/04*20-*20Lisa*20Fredrik*20-*20Don*27t*20It*20Make*20My*20Brown*20Eyes*20Blue.flac
        </res>
    </item>
</DIDL-Lite>

the bitrate is 176400 : This is the maximum bitrate of the song in [bytes/s] -> 1.411,2 kbit/s = CD

<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sec="http://www.sec.co.kr/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
    <item id="-1" parentID="-1" restricted="1">
        <dc:title>
            Don't It Make My Brown Eyes Blue
        </dc:title>
        <dc:creator>
            Lisa Fredrik
        </dc:creator>
        <upnp:class>
            object.item.audioItem.musicTrack
        </upnp:class>
        <upnp:originalTrackNumber>
            4
        </upnp:originalTrackNumber>
        <upnp:album>
            Best Of Jazz Audiophile Voices
        </upnp:album>
        <upnp:genre>
            Jazz
        </upnp:genre>
        <upnp:artist>
            Lisa Fredrik
        </upnp:artist>
        <dc:date>
            2011-01-01
        </dc:date>
        <res bitrate="104000" duration="0:03:35.000" nrAudioChannels="2" protocolInfo="http-get:*:audio/flac:DLNA.ORG_PN=FLAC;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000" sampleFrequency="44100" size="22397117">
            http://10.0.9.140:8895/resource/707/MEDIA_ITEM/FLAC-0/ORIGINAL
        </res>
    </item>
</DIDL-Lite>

the bitrate is 104000 : I encoded the FLAC file with enabled compression. Serviio seems to read and post the average bitrate of the song in [bytes/s] -> 832 kbit/s = it's still CD, but lossless compressed.

I believe most media server will implement the DIDL protocol according to the official documentation and encode the bitrate in [bytes/s].

If MediaPlayer wouldn't update the bitrate attribute with the instancious bitrate reported by MPD, MediaPlayer would first deliver to the control point a DIDL-Lite element the bitrate raw value meaning [bytes/s], after the update by MPD the unit changes to [kbit/s]. This is actually actually already the case (i.e. the first UPnP event has a reported bitrate of 176400, the following ones 1411.2). I think this behaviour is very counter intuitive.

Therefore I would suggest to report the UPnP bitrate in bytes/s and optionally file a bug report to LINN? What do you think?

Cheers

Igor

PeteManchester commented 3 years ago

Hi Igor,

I don't think we will get very far with a but report to LINN, their contorl points seem to work ok with their streamers, so they are unlikely to change.

It also seems to work ok with my setup.

How about if I add a config option, the default value is to calculate the bitrate as it is now, if the option is set to true the bit rate is calculated by multiplying by 125?

The option could be called something like 'BitRateCalculated'.

Cheers,

Pete.

ik666 commented 3 years ago

Good idea, this seems to be the most flexible solution.

'BitRateCalculated' is fine, ... maybe 'ReportBitrateInBytesSec' would be more verbose ...

PeteManchester commented 3 years ago

Hi Igor, I pushed a new version with the added option 'ReportBitrateInBytesSec'

Cheers,

Pete.

ik666 commented 3 years ago

got it ... works as expected :) Thanks.