пятница, 9 декабря 2011 г.

Samsung TV + Freenas 0.7 + Mediatomb. The DLNA Success story.

May be this story will be helpful for you, if you want to configure DLNA media streaming to your Samsung TV.

First of all, what I have at the beginning:
  • Samsung UE32D5000 LED TV, which supports DLNA media streaming
  • Freenas 0.7.2 (Full installation) with Transmission BitTorrent client
What I want: Media streaming from Freenas to Samsung TV without any transcoding.

1. How to install MediaTomb (works only for  Full installation of FreeNAS).
FreeNAS already have UPnP client (Fuppes), but a have not success with this Media Server. And I decided to use MediaTomb.
Unfortunately Mediatomb aren't installs through the:
pkg_add -r mediatomb
But you can install it, through:
pkg_add -r http://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/mediatomb.tbz
Note: Mediatomb requires a lot of additional packages, so you should have about 400 Mb of free space!
It takes a few minutes. 



2. Add required libs.
If you try to start mediatomb, you can see such error message:

Shared object "libmysqlclient_r.so.15" not found, required by "mediatomb"
You should add this library to usr/lib directory. If you have MySQL you can create simlink to file :
/usr/local/lib/mysql/libmysqlclient_r.so.15
Or you can get my version of file by link.
Also, you should add to usr/lib the libmagic.so.3 , you can download here.
After that mediatomb should start correctly.

3. Configure MediaTomb.
Few recommendations for Mediatomb configuration  for Samsung TV. For that open config.xml file in .mediatomb directory.
1. Change value to "yes":
 <protocolInfo extend="yes"/>
2.  Add custom headers:
<custom-http-headers>
<add header="transferMode.dlna.org: Streaming"/>
<add header="contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000"/>
</custom-http-headers>
Note: you should uncomment custom headers section for correct work!

3. If you want to add support of Russian symbols in filename, add this to import section (optional):
<import hidden-files="no">
<filesystem-charset>UTF-8</filesystem-charset>
<metadata-charset>UTF-8</metadata-charset>
<playlist-charset>UTF-8</playlist-charset>
<scripting script-charset="UTF-8">
 4. Check mimetype section, for *.avi & *.mkv support:
<map from="avi" to="video/x-msvideo"/>
 <map from="mkv" to="video/x-mkv"/>
That's all, now your mediatomb should work with your Samsung TV correctly.
Also you can get my config file by link.


4. Configure Mediatomb autostart and logging to file.
For autostart we will use mediatomb in daemon mode, for that use this option:
mediatomb -d
But much better add logging if you want to find any errors if they appears.
Now we add PostInit command, for that in FreeNAS Web Panel go to: System/Advanced open Command Scripts tab, and add new command with parameters:
command:  mediatomb -d -l /var/log/mediatomb.log
type:          PostInit


 5. Configure Freenas log viewer to Mediatomb log file (optional).
For that you should navigate to: /usr/local/www , and edit file: diag_log.inc .
In this file find text:
array(
"visible" => TRUE,
"desc" => gettext("UPnP"),
"logfile" => $fuppes_logfile,
"filename" => "upnp.log",
"type" => "plain",
"pattern" => "/^(.*)$/",
"columns" => array(
array("title" => gettext("Event"), "class" => "listlr", "param" => "", "pmid" => 1)
)),
And add below that section:
  array(
"visible" => TRUE,
"desc" => gettext("Mediatomb"),
"logfile" => $mediatomb_logfile,
"filename" => "mediatomb.log",
"type" => "plain",
"pattern" => "/^(.*)$/",
"columns" => array(
array("title" => gettext("Event"), "class" => "listlr", "param" => "", "pmid" => 1)
)),


6. Add link for Mediatomb web GUI to Freenas (optional).
For that you should navigate to: /usr/local/www , and edit file: fbegin.inc
In this file find text:
$menu['advanced']['menuitem'][] = array("desc" => gettext("Command"), "link" => "exec.php", "visible" => Session::isAdmin());
And add below this:
$menu['advanced']['menuitem'][] = array("type" => "separator", "visible" => Session::isAdmin());
$menu['advanced']['menuitem'][] = array("desc" => gettext("MediaTomb"), "link" => "http://
<your_IP_address>:49152/", "visible" => TRUE, "target" => "_blank"); 
It will add a separator and a new Submenu item called Mediatomb to Advanced menu.

7 комментариев:

  1. Нужна помощь! Купил телек samsung ue40d6510ws столкнулся с такой же проблемой, что описана в топике.
    Телевизор не хочет работать с FreeNAS, установил mediatomb по описанному выше мануалу.
    Телек mediatomb видит, заходит на сервер видит папки, но видео файлов в них нет, он их не отображает. Музыку видит, но не воспроизводит - пишет "не поддерживаемый форма"
    Подскажите, может в чем ошибся?

    ОтветитьУдалить
  2. Пытался выйти в личку в ICQ - не вышло. Давай найдем средство коммуникации и обсудим чего у тебя там не вышло =).

    ОтветитьУдалить
  3. http://dl.dropbox.com/u/3546829/config.xml - волею судеб этот конфиг заработал, отобразилось видео и музыка, фото нет, но оно мне нафиг не нужно. Но появилась другая проблема, MediaTomb где-то раз в сутки перестает отображаться толи из-за добавления файлов виснет, то ли "засыпает"

    ОтветитьУдалить
  4. thanks a lot friend, and can you give me tutorial for Samsung TV DoS vulnerability ?
    thx

    ОтветитьУдалить
  5. Glad that this note was helpful to you. But actually I not sure that I can understand you ask.

    ОтветитьУдалить