Posted by: ben | August 24, 2008

Why do I hate DLNA protocol so much ?

A few years ago, I had to work on UPnP A/V protocol for work. This is a service from the UPnP specifications that is used by many so-called audio/video players/servers (mostly set-top-boxes) to provide an easy way to share and stream multimedia content. Having worked on it, I’ve decided to write a small UPnP A/V media server, with embedded constraints in mind and there came uShare (pronounce you-share). Surprisingly uShare quickly became one of the most used UPnP A/V Media Server on UNIX. It is indeed now part of Ubuntu distribution, and included in many micro-distributions such as OpenWRT or FreeNAS, which are used on some routers or NAS.

The UPnP A/V protocol never was really well defined (broadcast messages, making massive usage of SOAP requests over HTTP to send info under XML form) but it could have been worse. That probably also was industry engineers way of thinking when they designed DLNA specifications. UPnP A/V relies on UPnP protocol to exchanged session information. It also requires up to 3 services to dialog between a client/player and a server: the Content Directory Service (CDS) which exports your shares, a Connection Manager Service (CMS) which handles connections between both end-points, and an optional AV Transport Service (AVTS) which only god knows the use of. Finally, all that it does, is the server providing an HTTP URL to the client to know where to stream from … yeah, this seems to be over-complicated just to do a so simple thing, but so is life.

But, so far, it was working not that bad and uShare became more and more famous and used. Ironically, although being uShare‘s author, I didn’t myself had any use on this protocol, having no UPnP A/V compatible device. This doesn’t help much with testing, that’s for sure 😉 But then came Microsoft Xbox 360. As usual with MS, they did their lot of crap and decided to add an extra UPnP service, just to became not compatible with the norm they’ve created themselves (UPnP was designed by Microsoft in early 2000’s). Let’s call this new service Microsoft Registrar (MSR). In fact, it has been designed so that only Windows Media Connect (WMC) can be used as a server to XboX 360. As a result, uShare had to mimics WMC to server XboX 360. Also, they’ve decided not to have a regular implementation of CDS, which, again, is just one more thing used to drive me crazy. The fact that I have no interest in XboX 360, nor access to any of those beast (and I still don’t have) wasn’t the best way to have it supported. Though, thanks to the help of many testers over the years, I managed to make it work. And it seems to be used massively around the world, mostly with XboX. I still don’t understand why, but I even had to reply to some interview about my plans with uShare and XboX 360 support. This was extremely funny 🙂

But let’s come back to DLNA. DLNA stands for Digital Living Network Alliance. It’s a consortium of industrials that are focusing on the embedded and set-top-box market and that wanted to define a protocol to share media content among various devices (NAS, Televisions, A/V Players and so on …). They decided to use UPnP A/V protocol but, judging it way too versatile, it was better to harden it quite a bit so that it just sounds more professional. In simple words, DLNA can be defined as “UPnP A/V with restrictions“. Using plain UPnP A/V, a server can share any kind of file (being binary, audio file, video file, text file like subtitle, or even a Word or PowerPoint presentation, whatever …). All it does after all, is sharing a file through HTTP with its associated MIME type, just like any HTTP server (Apache …) would do. It was then up to the client/player to determine whether or not it can handle the stream. This was quite too simple for DLNA folks. They have decided that only a numerous number of files are worth being shared. As a result, they’ve decided to restrict the protocol so that only some specific file extensions, but also containers and audio/video codecs combination can be used. This just sounds like a very good idea. Even a 16-year-old drunk cheerleader could have understood it was pure crap !!

You’ll find below the only supported stream characteristics:

  • Image Codecs: JPEG, PNG
  • Audio Codecs: AC3, AMR, ATRAC3, LPCM, MP3, MPEG4, WMA
  • Video Codecs: MPEG 1, MPEG 2, MPEG 4 Part 2 (a.k.a DivX), MPEG 4 Part 10 (a.k.a H.264), WMV9.
  • Containers: MPEG PS/TS, MP4, ASF for video files …

As you can see, many media formats are purely and simply dropped because no one use them in industry, that’s quite simple to understand. As you may have seen, no free audio codec is supported (Ogg/Vorbis, FLAC …), nor is WMV10 (a.k.a VC-1), which tends to replace WMV9 more and more but, more interestingly, neither AVI nor Matroska (MKV) containers are supported. This just means that 99% of video files are not DLNA compliant and thus, can’t be streamed as it. This is simply brilliant ! But if it just ended up here, the protocol could have been just “bad”. Let’s see the tricky part. Supposing you have a multimedia file that fulfill these constraints (let’s say you’ve downloaded some HDTV trailer on Apple.com, which is H.264 video based, with AAC audio, encapsulated within a MOV/MP4 container). That’s looks like a supported media. Unfortunately it isn’t 🙂 Yeah, I forget to tell you about DLNA profiles. DLNA specifications defines quite a lot of A/V profiles (something like 250-300 I’d say) and a file, to be compliant with DLNA, has to comply with one of these profiles. As said, it depends on audio/video codec and container but also on resolution, bitrates and stuff like that. If we use the previous example, the file could have match because both A/V codecs and container are valid. Though, when resolution exceeds 720×576, MP4 container is judged inadequate and thus, only content within MPEG TS container can be streamed. This is the worse one could have imagined.

The very good thing with this broken design is that nearly 99% of video files are not DLNA compliant (it’s a bit easier with audio files, MP3 and AAC being OK for example). How to stream your file then ? This is quite simple in theory: you have to make them compliant with the protocol, that’s all 😉 How to do that then ? Well, for each file, the DLNA server has to first demux it, in order to retrieve its A/V and container information, so that it knows whether or not it complies with an existing profile. If it does not and you still want it to be streamed, than the server has to either remux it (best case ever) if it’s enough, or remux and re-encode it on the fly (worst case ever) to a valid profile so that player can read it. Of course, doing so on-the-fly consumes a lot of CPU power, which is, by definition, not available, making it impossible to do on embedded devices, which were the target of DLNA inventors. Also, each file, once demuxed, has to be given a DLNA profile id. The good thing is that, supposing the file _IS_ DLNA compliant and could be decoded by the player but the server has announced it with a faulty ID, then you won’t be able to have it played.

As we’ve seen, DLNA is truly broken by design. Though, it is industry standards and more and more devices will be DLNA compliant only and won’t support UPnP A/V any longer. The first one to do so was Sony Playstation 3 console (yeah, they manage to do worse than Microsoft …). Luckily for me, I’ve been granted a PS3 to make uShare work with it. I’ve also been sponsored by Consumer Embedded Linux Forum (CELF) which provided me the DLNA specifications for free (otherwise, the stupidity explained before still costs $5000 …) which helped me design the first and unique C implementation of DLNA specifications for Linux through libdlna. libdlna implements all DLNA profile discovery and now allows you to build a fully compliant DLNA (or UPnP A/V) Media Server with a few lines of code. Next goal will be to provide Media Player capabilities too and also to support the on-the-fly remuxing/re-encoding thing for server, which is requested by users for quite too long time. Also, development version of uShare now completely relies on libdlna and is no more than a command-line frontend to it.

At present time, I have no date for next libdlna and uShare release. Many things still need to be fixed in both, especially now that they are tightly binded. All of uShare UPnP CDS/CMS code now has moved to libdlna and Xbox 360 support is broken one more time. If someone want to sponsor me one, you know where to find me. That’s all for today, more libdlna/uShare news to come within next weeks if I manage to find the time and motivation for it 😉


Responses

  1. […] […]

  2. […] Tags: dlna, HTPC, media center, xbmc Carrying on from my previous post, this blog post https://gxben.wordpress.com/2008/08/24/why-do-i-hate-dlna-protocol-so-much sums up my experiance with DLNA quite […]

  3. thanks ben for this article.

    indeed, dlna is a bullshit ! It’s only a marketing idea to make money instead of using upnp-av standard.

    long life to upnp-av !

  4. […] Why do I hate DLNA protocol so much ? « Ben’s Lost World – Diary of a… a few seconds ago from cort.as […]

  5. […] […]

  6. Has there been any development regarding all these flaws in the DLNA protocol?

    • how could there be ? that’s part of the specification itself. The only way to bypass these issues is transcode files which uShare might eventually do in some future.

      • Pity.
        As I see it I currently have two problems with using the PlayTo feature of WMP12:

        1. It doesn’t play flac music. I can add codecs to make WMP play it locally, but I can’t send it to my WDTVLive, because of the limitations you mention and it doesn’t transcode anything, so I end up with nothing being played.

        2. I can’t use PlayTo to send music located on a networked drive, since the library function of WMP complains it can’t share files located “on another computer” 😦

  7. […] got the backing of many hardware manufacturers. My guess? DLNA has received some major hate, and not without reason. Apple might want to sidestep that debate altogether, and at the same time retain tight control […]

  8. […] ERROR Finally, media serving via uPnP from other sources over a network is still borked, with Microsoft still sticking to it's nonstandard version of uPnP – meaning devices that are detectable on the PS3 and numerous other supporting devices – still fail […]

  9. […] There is of course the DLNA web site – but I have not found that site so useful to date.  This article (“why do I hate the DLNA protocol so much”) I personally found interesting from someone who has […]

  10. […] Re: Supporting DLNA btw, this is an interresting read: Why do I hate DLNA protocol so much ? Ben’s Lost World – Diary of a GeeXboX developer […]

  11. Hello,

    First thanks for the explanation, I bought a PS3 quite recently and didn’t understood how a device with that kind of hardware refused to play a damn movie with some subtitle.
    I did some research about format and cotainer and even study the code of PS3 media server to discover that it needs to be transcoded on the fly just as you said it.

    Since then I was looking for a software to do just that but which able to run on a small NAS.

    Do you thank ushare will be able to be embded onto a NAS device and perform on the fly transocding ? If not do you think such a software is possible to make ?

    Thanks again for your post.

  12. […] av. Det är bara en del av begränsningarna. Den andra delen är att DLNA endast innefattar ett klart begränsat antal filformat. Till exempel stöds inte .avi, .mkv eller .flac vilket gör att DLNA servrar måste konvertera […]

  13. […] https://gxben.wordpress.com/2008/08/24/why-do-i-hate-dlna-protocol-so-much/ […]

  14. As the developer/maintainer of GUPnP/Rygel, I have been dealing with DLNA for some years now and I must say I fully agree with everything you said here. Actually, I was thinking of writing up a post like this but I guess you saved me time by writing it for me. 🙂

  15. Can someone share the dlna specification? I don’t want to pay 500 USD

    I’m trying to use Mediatomb as a media server to play videos in my ps3 but at this point I can’t discover the media server.
    If I use uShare I can discover the media server but I can’t see any content on the directories and I know the files are there. I think it has to be related to the issue about the correct format.

    The funny thing is when I use windows media player, because with the same files I’m able to play those in my ps3, but only if I use media player.

    Thanks

  16. I don’t know if the DLNA spec has changed, but my new Samsung 7000-series TV is playing raw (not re-encoded) .MKV container files very happily.

    Perhaps newer tellys are just regarding these format rules as minimum requirements and are playing all files sent on a best-endeavours basis?

    Would make sense…

  17. […] En dan nu de praktijk: hmmm… veel films en series zijn niet te zien op de TV… Nu was DLNA tot nu toe een vier-letterige afkorting voor mij waarvan ik de betekenis wel kende (Digital Living Network Alliance), maar wat het nu precies was, wist ik niet. Praktisch gezien blijkt het een standaard te zijn die vooral veel beperkingen kent… DLNA ondersteunt namelijk slechts een zeer beperkt aantal videoformaten. Hoewel je moet betalen om de DLNA standaarden in te kunnen zien, is er op internet wel iets over te vinden. De standaard ondersteunt slechts het volgende (bron: https://gxben.wordpress.com/2008/08/24/why-do-i-hate-dlna-protocol-so-much/): […]

  18. […] “Why do I hate DLNA protocol so much ? ” Ben’s Lost World – Diary of a GeeX…. Retrieved […]

  19. […] J’utiliserai ustream (qui fait partie de la distribution ubuntu visiblement) et je vous recommande cet article par l’auteur de ustream: Why do I hate DLNA protocol so much ? […]

  20. […] I am using uShare, an outstanding piece of software that is actually compatible with Microsoft’s horrible DLNA specification. (That’s also the reason why I am so passionate about 973295 and […]

  21. […] I am using uShare, an outstanding piece of software that is actually compatible with Microsoft’s horrible DLNA specification. (That’s also the reason why I am so passionate about 973295 and […]

  22. I have a couple of DLNA compatible devices and they play avi’s fine. Does that mean that most/some devices regard dlna as the minimum standard?

  23. Never knew the DLNA stuff was so messed up.

  24. […] is a crippled sad thing… Why do I hate DLNA protocol so much ? | Ben's Lost World – Diary of a GeeXboX developer Reply With […]

  25. […] Why do I hate DLNA protocol so much ? >> Ben’s Lost World […]

  26. If one thinks about it from non-techie perspective, DLNA was designed to save people from this A/V coded&format hell -which those users could not care less…they rather hate it. If things had gone well, a consumer could by DLNA certified devices and be 100% sure that they really work together. That’s the whole point in stardards and specs anyway. If DLNA would have left those formats&resolutions unspecified&open – it would not provide a standard but it would provide the same holy jargon&mess that actually seems to be out there on the market now: each device trying to lists 10s&100s of container names and _still_ probably not supporting all the formats that can be wrapped inside those containers. That container/codec/resolution jargon might provide some perverted satisfaction for techies…but not the consumers.

  27. […] towards this idea? Geeeeeeezzz. Here is but a sample of the indictments against UPnP/DLNA: Why do I hate DLNA protocol so much ? | Ben's Lost World – Diary of a GeeXboX developer Written by the developer of uShare, a UNIX DLNA server that became so popular it is now part of […]

  28. […] And from the s/w side, the architecture sucks as well (for just one developer's screed see: Why do I hate DLNA protocol so much ? | Ben's Lost World – Diary of a GeeXboX developer). Sorry, but to me, DLNA and purist audio are like oil and water. UpTone Audio LLC […]


Leave a reply to Kim Cancel reply

Categories