UPnP for VDR’s Live Streams

I recently realized, that I just have to announce streams by UPnP to access them using my Asus O!Play device.

VDR provides URLs like http://VDR_HOST:3000/EXT/ChannelNo for access to the live channels. So, I started using MediaTomb to publish the URLs by UPnP.

Installation Summary

  • Installation of Ubuntu’s MediaTomb: apt-get install mediatomb
  • Call http://VDR_HOST:49152/ for configuration.
  • Add a new container with a name like Live-TV to your database.
  • I changed the name of my MediaTomb in /etc/mediatomb/config.xml to something unique.
  • The sqlite3 command (apt-get install sqlite3) will now help to access the MediaTomb database directly.
  • I opened the MediaTomb database: sqlite3 /var/lib/mediatomb/mediatomb.db
  • I queried the ID (in my case 2) of the new container: select id from mt_cds_object where dc_title like '%Live%TV%';
  • I queried the maximum ID (in my case also 2): select max(id) from mt_cds_object;
  • Before the following statements write into the database, we have to stop MediaTomb: /etc/init.d/mediatomb stop
  • The following lines for the shell will fill the first 20 channels as references into the container:
    container=2; max=2
    for i in $(seq 1 20); do
      ii="$(printf "%02d" "$i")"; id="$(($max + $i))"
      echo "
        insert into mt_cds_object values(
          $id,NULL,$container,10,'object.item.videoItem','Ch$ii',
          'http://MyVDRHostname:3000/EXT/$i',NULL,
          'dc%3Adescription=VDR%2AChannel%2A$ii',NULL,
          '0~protocolInfo=http-get%3A%2A%3Avideo%2Fmpeg%3A%2A~~',0,
          'video/mpeg',1,NULL,NULL
        );"
    done | sqlite3 /var/lib/mediatomb/mediatomb.db
  • Start MediaTomb afterwards: /etc/init.d/mediatomb start
  • Reloading the container I can now see the 20 channel references. Each provides an external Link of class object.item.videoItem and mime type video/mpeg.

Finally the O!Play will show the list of channels in the UPnP section.