Sunday, June 28, 2009

Mediatomb uPNP Streaming to Samsung 7 series LCD TV

Installed mediatomb on ubuntu Jaunty to make my pictures, music and video available to my Samsung 7 series (2008 model) LCD TV.

First problem:
The TV recognized the mediatomb uPNP server and listed all the available folders and files; however, trying to play anything resulted in a "unrecognized file format" error. I found this fix googling: you have to add a couple of elements to the custom-http-headers section in mediatomb's config.xml. Audio and pictures works after this fix.
<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=017000 00000000000000000000000000">
</custom-http-headers>
Reference link

Second problem:
When I got mediatomb to automatically scan my disk for media files and make them available, most AVI files were tagged with the mime-type of 'video/x-msvideo.' The TV doens't like this mime-type, so I added this element:
<map from="avi" to="video/mpeg">
in the import/mappings/extension-mimetype section. After rescanning the disk, AVI files now have a mime-type of 'video/mpeg' which the TV likes and most divx-encoded files play perfectly.

Third problem:
Some video resulted in 'unsupported video/audio codec' errors. I had already enabled mediatomb's transcoding feature and set mkv files to be transcoded using MPlayer's mencoder (google 'mediatomb samsung config.xml'). So I figured why not just transcode files that don't play nice on the TV directly. I configed files that are tagged with the mime-type of video/x-msvideo to be transcoded by mencoder as well. Then when I run across a file that won't play nice on the TV directly, I use mediatomb to set it's mime-type to video/x-msvideo. BTW, I did try transcoding using VLC but it didn't work for me; kept getting the 'unsported format' error even though VLC was doing something.

Forth problem:
Transcoding works very well except that when playing large, 720p or 1080p video, my computer couldn't transcode fast enough and you get pauses (every second or two) in the playback. But if I pause the playback, the buffer gets a chance to fill up and I get smoother video on resume. The longer the pause the more the buffer fills up and more more smooth video I get.

17 comments:

  1. First and Second issue - ok - nice explanation.
    Third problem (the one that I have having issues with) - any chance you can expand on it?

    ReplyDelete
  2. Can you pause or fast forward playback on videos?

    Stefan

    ReplyDelete
  3. No pause, rewind or fforward for playback via uPNP/DLNA from the Samsung. I've been waiting for a firmware update to fix this but it seems they are heading in a new direction with their firmware for the 2009+ TVs; so probably no more firmware update for my TV.

    ReplyDelete
  4. Expanding on the third problem: when you open the mediatomb web interface, you can add/remove files to the mediatomb database--you can also set the media-type for each file. In my mediatomb config file, I have set that all media types of ms-video be transcoded (like mkv files); then, when I come across a file that the TV doesn't support, I set its media type to ms-video (instead of the default type that is automatically set when you add files to the database). Hope that helps.

    ReplyDelete
  5. I'm using mediatomb v0.11 on Ubuntu9.04 with Samsung LCD 46B750. mediatomb is working very well except 1080p mkv files. All points are true.
    But did you try mediatomb v0.12 on Ubuntu9.10 family?
    I can't run the v0.12. doesn't work similiar config.xml. There are some changing in config.xml.
    Additionaly the pause and rewind are working in samsung' DLNA prg on the Windows. I think, the problem isn't firmware upgrade of Samsung.
    Ali

    ReplyDelete
  6. For the first issue is not related to the Samsung DTV, but instead the MediaTomb server. These headers are DLNA defined and required by the DTV.

    For the AVI issue it will depend. AVI is a container and so depends on what codec is inside. Video/mpeg will only work for AVI files with MPEG content. Other types of AVI will not play with this MIME type, and many codecs found inside AVC files will not play because they aren't supported by the DTV/DLNA.

    ReplyDelete
  7. A better idea would be to use a different set of DLNA flags:

    DLNA.ORG_FLAGS=025000 00000000000000000000000000">

    This would enable mediatomb to advertise the fact that it supports seeking (i.e. rewind and fast forward). However this will not work on all movies, probably depending on the codec/format.

    A better approach would be to get rid of DLNA alltogether and use SammyGO.

    ReplyDelete
  8. Err, typo, the project's name is "SamyGO", not "SammyGO".

    ReplyDelete
  9. This post was incredibly Useful! Only the point on mencoder is not clear. I have the same television and thanks to this post I am starting to get it to work, but I do not manage to get ffmpeg transcoding working. Could you give an example of the config.xml text fro automatically transcoding flv files to a format the Samsung can display?

    ReplyDelete
  10. this article saved me so much time. I used same technique with Serviio server from serviio.org. Video on my A850 is working great.

    Thanks a ton.

    ReplyDelete
  11. Thank you very very much.

    I've been looking for solution for a while. I was about to give up playing movies from the network!

    Thanks, you've saved my TV!

    ReplyDelete
  12. FYI - your "<add..." tags are missing the trailing "/"

    ReplyDelete
  13. Fourth problem:

    How do you pause transcoding videos on your samsung TV? For me, the pause button only works with non-transcoding videos.

    ReplyDelete
  14. Heinrich, I've never tried or needed to pause the actual transcoding process. When I press pause on the TV, the video pauses but the transcoding continues and buffers. I purposely pause HD video so that the buffer fills enough to give me a period of stutter-free video.

    ReplyDelete
  15. Have not looked further into this issue since getting a Popcorn Hour device for watching video.

    ReplyDelete
  16. Thanks for your post, it helped me a lot. FYI, I googled for the pause/rewind stuff and found something working. I put the flags to 025000 and changed "protocolInfo extend="no"" to "yes".

    Moreover, it would be nice to tell people to uncomment the "custom-http-headers" section. 'cause I looked a lot trying to understand wshy there was no change before I figured out the section was commmented

    ReplyDelete
  17. what about video_ts folders? (ie vob files, but hopefully can play the whole folder).

    ReplyDelete