Llink:Live TV

From Lundman Wiki
Jump to: navigation, search

There are various ways to view Live TV via llink.

This guide was made by user Lasoul over at networkedmediatank.com who uses a dvb-c card in a linux box to transmit the stream. In principle, this could work for other external streaming setups too, such as DVB-T cards, or DVB-S from a Dreambox via VLC, SopCast etc. If you have experience to share, please add to the wiki!

llink and LiveTV - mini HOWTO

Written 02-25-2008, 11:57 AM by Lasoul

I spend several days trying to get LiveTV to work with my PCH. I wrote this mini-howto to share my knowledge gained. My current setup is a kubuntu server with a dvb-c card and a PCH so that's what I will be using in this example.

You need the following:

      Popcorn hour (ofcourse)
      Linux or Windows machine with a DVB/TV card (I am using DVB-C as example)
      DVBStream or Mencoder

1: Download and install llink Download, unzip or untar, configure and make

2: Edit the llink.conf file so that can handle the ltf extension Add the following line to llink.conf

# Live TV

This tells llink that when it encounters a file with the ltf extension it shall execute the script /usr/local/bin/dvbtv.sh

3: Make a ltv file Somewhere in the directory structure shared by llink you should put a file with a ltv extension. In my case I use the name of the channel I would like to view as naming convention. Under linux you can use the command touch to generate the file: touch "Film 1.1.ltf"

4: Get the name of the fifo We specified the script /usr/local/bin/dvbtv.sh as being the external command for llink that has to be executed when it encounters a ltv file. This is the first time we are going to run into some trouble. llink uses a fifo to communicate with the external program. This fifo is created before the script is executed but is not provided as a parameter (it does not work correctly for me at least, in code llink provides the as first parameter the name of the file and as second parameter the name of the fifo). We can take two separate routes here.

4a: Search for newest fifo The following code searches for the newest fifo in the current directory. This approach has as drawback that we have no way of knowing which file is selected. We want to know that when we want the script to be able to handle multiple channels. Code:

outputfifo=`find llink-external-fifo.* -maxdepth 1 -type p -printf '%T@\t%p\n' |
sort -k1,1n | tail -n1 | cut -f2-`
echo "Using fifo: " $outputfifo

4b: Provide name of fifo as parameter to dvbtv.sh This patch was included with llink since 2.1.0. It should no longer be required, but please inform lundman if there are still issues. In this case we have to alter the file external.c so that it provides the filename and fifo as parameters to the script. We have to find the routine external_launch and change the following lines: Code:

size = strlen(skin->args) + 2 + strlen(node->disk_path) + 3 + strlen(tmpname) + 1 + 1;


snprintf(args, size, "%s \"%s\" \"%s\"", skin->args, node->disk_path, tmpname);

Make sure to build llink after the changes. In this example I am taking this route because it makes the dvbtv.sh script easier

5: Make dvbtv.sh The following dvbtv.sh uses dvbstream to stream files to the Popcorn Hour. You could also you mencoder but that leads to another problem because mencoder uses some environment variables which are not standard provided by llink (not without changing code, change in the file fifo.c in de lion/src directory the call to execvp to execv and remove the argv parameter. This calls the external process with the environment of the calling process). The script looks at the file selected and starts the stream accordingly. I made a ltv for each channel I would like to stream to the Popcorn Hour.


echo "File: " $1
echo "Using fifo: " $2
#exec mencoder dvb://2@"Film 1.1" -oac copy -ovc copy -really-quiet -o /dev/stdout > $2

filename=`echo $1|rev|awk -F \/ '{print $1}'|rev`
echo "Filename: " $filename
case $filename in
  "Film1 HD.ltv")
     echo "Streaming Film1 HD"
     exec dvbstream -c 1 -f 235000 -s 6875 -qam 64 -v 0 -a 160 -o > $2
  "Film 1+1.ltv")
     echo "Streaming Film 1+1"
     exec dvbstream -c 1 -f 305000 -s 6875 -qam 64 -v 251 -a 260 -ps -o > $2
  "Film 1.1.ltv")
     echo "Streaming Film 1.1"
     exec dvbstream -c 1 -f 305000 -s 6875 -qam 64 -v 101 -a 110 -ps -o > $2
  "Film 1.2.ltv")
     echo "Streaming Film 1.2"
     exec dvbstream -c 1 -f 305000 -s 6875 -qam 64 -v 151 -a 160 -ps -o > $2
  "Film 1.3.ltv")
     echo "Streaming Film 1.3"
     exec dvbstream -c 1 -f 305000 -s 6875 -qam 64 -v 201 -a 210 -ps -o > $2
     echo "Unknown channel: " $1

6: Enjoy watching TV! Via the llink GUI on the Popcorn Hour: select the listed ltv file and hopefully enjoy watching streaming Live TV. When it does not work make sure that llink is started in debug mode so that you can look at what is happening (llink -v 125 -d)

Have fun!