Friday, April 19, 2013

Mediatomb UPnP Server on Debian Wheezy and Panasonic Viera TX-L42ETW5W

Here's how my QNAP TS-419P II running Debian Wheezy is configured to host a Mediatomb UPnP server in order to be accessed by a Panasonic Viera TX-L42ETW5W.

The idea is taken from here:

http://sourceforge.net/projects/mediatomb/forums/forum/440751/topic/3943634


Start with installing Mediatomb:

sudo apt-get install mediatomb mencoder


Edit Mediatomb configuration files:

sudo nano /etc/mediatomb/config.xml


and replace the content with this one:


  
    eth0
    50000
    
    
      
        
      
    
    MyMediatomb
    uuid:0c61a209-4618-4fcc-beba-a4e06ba678b0
    /var/lib/mediatomb
    /usr/share/mediatomb/web
    
      
        sqlite3.db
      
      
        localhost
        mediatomb
        mediatomb
      
    
    
    
      
        128
        5
        yes
        no
        8
      
      
        *
        
          video
        
      
    
  
  
    UTF-8
    ISO-8859-15
    
    
    
      
        
        
        
        
        
        
        
        
        
        
        
      
      
        

        
        
      
      
        
        
        
      
    
    
      
        
        
        
        
        
      
    
  
  
    
      
      
      
      
      
      
    
    
      
        video/mpeg
        yes
        yes
        yes
        
        
      
      
        video/mpeg
        yes
        yes
        yes
        
        
      
      
        video/mpeg
        yes
        yes
        yes
                
      
      
        video/mpeg
        yes
        yes
        yes
        
        
      
    
  

To enable subtitles create the following file:


sudo nano /usr/bin/mediatomb-mencoder-sub



with the following content:

#!/bin/bash 
srt="$1"
output="$2"
# filename must be of the form "movie name.XX[X].srt" or "movie name.srt" 
base_name="$(echo $srt | sed 's/\..\{2,3\}\.srt$//' | sed 's/\.srt$//')"

extensions="avi mp4 mpg mov"
for ext in $extensions ; do
   input=$base_name.$ext;
   if [[ -e $input ]]; then break; fi
done

exec mencoder "$input" \
-oac lavc -ovc lavc -of mpeg \
# Frames Option in MPEG
-ofps 24000/1001 \
-lavcopts vcodec=mpeg2video:keyint=1:vbitrate=200000:vrc_maxrate=9000:vrc_buf_size=1835 \
-vf harddup -mpegopts muxrate=12000 \
-sub "$srt" -font "/usr/share/fonts/dejavu/DejaVuSans.ttf" -subfont-autoscale 2 \
-o "$output"
Make it executable:

sudo chmod +x /usr/bin/mediatomb-mencoder-sub

To enable .iso reading create the following file:



sudo nano /usr/bin/mediatomb-mencoder-iso


with the following content:
#!/bin/bash
CHAPTER=`lsdvd "$1" | grep Longest | sed 's/.* //'`

exec mencoder -dvd-device "$1" \
dvd://$CHAPTER -slang nl,en -oac copy -ovc lavc -of mpeg \
-lavcopts vcodec=mpeg2video:keyint=1:vbitrate=200000:vrc_maxrate=12000:vrc_buf_size=1835 \
-mpegopts muxrate=12000 -vf harddup,scale=720:-2 \
-o "$2" &>/dev/null


Make it executable:

sudo chmod +x /usr/bin/mediatomb-mencoder-iso

Restart Mediatomb:

sudo service mediatomb restart
If restart fails check Mediatomb log:

sudo less /var/log/mediatomb.log

In the log you should also find a line with the server link similar to tjis one:

INFO: MediaTomb Web UI can be reached by following this link:
INFO: http://ip_address:port/

If you go on a browser and enter  http://ip_address:port/ you will reach teh Mediatomb server which will ask you for the username and password you set in /etc/mediatomb/config.xml.
You can now add the folder(s) you are interested in by selecting Filesystem, navigating to your folder of interest  selecting add as autoscan dir with Scnamode = Inotify, Initial Scan = full and if needed Recursive ticked.

The Mediatomb server should appear now on your Media Server menuo on the TV.

Select the type of file you want to view/listen and enjoy.

I think the same configuration should work with other Panasonic Viera TV but I only tested on TX-L42ETW5W.












2 comments:

  1. thanks dude by the tuto, the transcode quality with mkv files it's very low, could you help me?

    ReplyDelete
  2. The problem with transcode is mainly how powerful yous server is. Unfortunately there is not much you can do about it.

    ReplyDelete