Preamble
Probably, each of us has a lot of digital media devices at home, communicating via WiFi or connected to the network using a normal twisted pair. For example, I have a PDA, a netbook, a couple of laptops, a couple of computers, and a couple more smartphones. The latter (a couple of Nokia 5800 Xpress Music), due to the fact that even in the bathroom or in bed are always at hand, turned out to be the most frequently used devices. Benefit and surfing, and chat through GTalk / Skype, and simple toys, time killers - everything is available. That's just the memory of devices with only 8 GB each, so you don’t get movies there, and convert, and then upload each movie to your smartphone - it takes time, and there’s still such a thing as laziness! In a word, I wanted to be able to somehow view the media content (and first of all - video) from the home server at any time, without converting and without making any extra movements.
Plot
In principle, if it were not for the Nokia 5800XM that I came across, I would have solved this problem a long time ago - the ASUS WL-500g router supports UPnP, so it would be enough just to plug in the USB flash drive. The trouble is that despite the sometimes encountered specifications in online stores, but the Nokia 5800XM does not support UPnP / DLNA and the third-party client implementation does not exist either. So what, I ask, to do? Put a fat cross on the idea of ​​viewing remote content?
The first attempt to break the deadlock was streaming video. Judging by the specification of the RTSP protocol (
RFC 2326 ), it should support playback control during broadcasting: PLAY, PAUSE, and TEARDOWN. Unfortunately, after VLC was configured to stream, it turned out that the pause request is either not processed by this server and works only from the server side, or is not sent by the smartphone client. Moreover, in any case, only the video file selected on the server for broadcasting was available, and not the whole media library.
But the first disappointment did not cool the heat, the search continued.
')
Next in line is the Home Media Server, better known as
Home Media Server - a program that provides media resources (photos, audio and video files) of your computer to other UPnP (DLNA) devices on your home network. After installation, it pleased me with a wealth of options, ease of setup, but ... completely disappointed because UPnP / DLNA, as mentioned above, did not support the Nokia 5800, and through HTTP the video completely refused to play ...
I needed a working alternative. It was here that the
TVersity media server caught my eye — the name slipped into someone's comments when discussing DLNA media servers.
So...
TVersity Media Server (free edition) is an even easier to learn media server, again offering us UPnP, DLNA and HTTP. If everything is clear with the first two protocols, then HTTP, as it turned out, is not so simple - access to the media library was realized in two ways: classical and flash. But first things first.
To begin with - the interface. Friendly, and I would even say rather simplistic. The first thing immediately got into the settings. Hints for each option (albeit in English) simplify server configuration "by itself".

The most important thing for me, of course, was the video transcoding. Server settings, unfortunately, are aimed at an ordinary user, so playing with fine configuration of codecs will not work, but at least something is better than nothing at all, isn't it?

Setting up a media library is also quite simple (and unlike the aforementioned Home Media Server does not require a lengthy restart when updating), when adding a source using special checkboxes, you can specify the type of its content: audio, video, and / or images. I say “source”, not “folders”, because this way you can add external content: for example, Video RSS or Internet Radio, as well as some services like Youtube and Flickr. By the way, pay attention - when selecting a folder using the “Browse ...” button instead of Cyrillic names, you will get cracks, so it’s better to enter the name manually or copy it from the file manager.

Well, with how to configure the library figured out. Now - how to work with her. And let's start with what it was all about: watching videos from a smartphone. The lucky owners of the Nokia 5800 know that a smartphone is fundamentally unable to open an AVI container, and this was initially a big problem, because local viewing of the film required to convert video to MP4, but then there were still third-party players with support for this container. In this case, it does not matter - you only need FLV support, which is not a problem for him. So, as mentioned earlier, access to the media library is implemented in two ways. To view HTML pages, you must specify
http : // server-address: port / lib in the address bar, and
http : // server-address: port / flashlib to load an interactive flash application. In this case, the last option is just what you need, so a bookmark with the address is created in the smartphone browser
http : //192.168.1.33:41952/flashlib . Well, now you can check what happens.

And this is the following picture: after a brief download of a flash application, the library catalog appears on the screen with quite convenient navigation:


For smooth video playback, I had to play around with the settings of the recoder, but in the end I managed to achieve an acceptable picture. True, positioning significantly slows down, but this is not a significant misfortune - it can be tolerated.

In the media server itself, you can view the status of the broadcast, a list of addresses of devices connected to it, the status of video transcoding, as well as a log of work and connections.

DLNA / UPNP
It would seem that everything. But still not: after all, the media server is a convenient thing, and, of course, I want to use it in full, which means not only via HTTP. In addition to smartphones, a laptop with Windows 7 and a netbook is also available - lubuntu is installed there. With the first one, everything turned out to be easier - when launching Windows Media Player 12, he immediately found the DLNA media server library and began to view it without any problems.

With Linux, everything was a bit more complicated. From the list of cross-platform UPnP / DLNA XBMC media clients I simply could not be installed - it did not have binaries for Ubuntu 11.04 Natty Narwhal in the repository, and it still supports UPnP under Linux - although I did not always find the server, although Wonderfully logged into it through the browser. As a result, it was decided to look for another way.
As a result, one wonderful thing was found called
djmount , a
FUSE -based utility for mounting UPnP server resources. Since the program was already in the repository, the installation did not take much time. Now it was necessary only to create a mount point and register automounting. After a brief study and attack on a rake, it was still possible to carry out. All the following commands are executed exclusively from under the root, so do not forget to execute:
sudo -s<br>
First you need to create a folder that will be the mount point:
cd /media
mkdir upnp
chmod 777 upnp
Now, in fact, the launch of FUSE and the mount itself:
modprobe fuse
djmount -o iocharset=UTF-8,allow_other /media/upnp
After that, you can already enter the library as a regular folder and open its contents in any convenient program as ordinary files.
By the way, nowhere did I find references to the most unpleasant rakes I found in working with djmount, which are expressed in the wrong encoding of files. According to the DLNA specification, file names must be exclusively in the UTF-8 format, therefore the TVersity Media Server does not even have a file name encoding setting. Judging by the message when mounting djmount, it also uses this encoding by default - UTF-8. But the file manager, as well as the console, stubbornly refused to display the usual letters in the file names, replacing them everywhere with question marks. Attempts to specify the CP1251 or IBM-866 encoding did not lead to complete success, although now you could even look into the Cyrillic folders. To my complete surprise, the way out of the situation was a direct indication of the use of UTF-8 encoding - I don’t know why I decided to try it, but it worked!

Autostart also turned out to be not a simple matter, but Google came to the rescue, and as it turned out, the problem with the impossibility of automounting from fstab was already solved. As a result, the mount occurs every time the network is raised. This is done as follows. Create a script:
cd /etc/network/if-up.d
nano djmount<br>
Script content:
#!/bin/sh
# Not for loopback!
[ "$IFACE" != "lo" ] || exit 0
modprobe fuse
fusermount -u /media/upnp
djmount -o iocharset=UTF-8,allow_other /media/upnp<br>
We expose attributes to him:
chmod 755 djmount
chown root djmount
chgrp root djmount
Now really everything. The media library is accessible from any device in any way possible / convenient for it.
Links
UPnP ,
DLNA ,
UPnP client under Ubuntu: djmount