Sign up here and you can log into the forum!

Freeview: IPTV Live TV Streams

UMSP Plugin Depot, the place for sharing plugins & info about them. No requests, just plugins/code.

Freeview: IPTV Live TV Streams   

Postby extremedigital » Tue May 11, 2010 5:42 am

Hi all, i have been experimenting with iptv using vlc and my azbox (stb)

i currently have a number of http live tv streams (H.264) that are fully working in both my azboz set top box and vlc on the pc.

My question to the more able out there...is it possible to stream directly from the wdtv live...

brad / rezmus etc i can pm you with the list of streams to test out to see if anything is possible...
extremedigital
Global Moderator
 
Posts: 218
Joined: Thu Apr 08, 2010 7:48 am

Re: IPTV Live TV Streams   

Postby Parnas » Wed May 12, 2010 3:20 pm

extremedigital wrote:My question to the more able out there...is it possible to stream directly from the wdtv live...


Hi! It's my first post, and I'm really just starting to experiment with the WD player, anyway I'll share my experience... I also have a bunch of H.264 streaming tv channels that I'd like to see on UMSP (for instance, this one: http://cctv.ws/7/BBC1).
So, I took inspiration from the apple-trailers example, and I coded a small php plug-in that populates a list of the channels (about 50) I'm interested in. I also had to code a small proxy, since the server sends the video as a generic application/octet-stream, so I had to change Content-type on the fly to video/h264 to let the wdtv be happy. :)

In the end, it's working... the only problem being, the streaming takes really long to start. I mean, since clicking the "play" button I have to wait about 3 minutes before I can see the video on the tv screen. Thereafter the video plays quite fine. This delay is not an issue related to the streaming server, as on a standard PC equipped with VLC the same streaming channel starts almost immediately.
I'm not sure, but I think this issue is related to absence of metadata information in the video stream, so the wdtv has to buffer a lot in order to be sure about how to decode it.

Anyway, if you're interested, I can post the code I've written for UMSP plug-in and proxy.

Greetings, Parnas
Parnas
n00b
 
Posts: 16
Joined: Thu Apr 22, 2010 3:25 pm
Location: Como (Italy)

Re: IPTV Live TV Streams   

Postby extremedigital » Wed May 12, 2010 4:55 pm

Hi Parnas, this is exactly the kind of thing i am looking for.

i too have a list of around 50 that i am personally interested in, and i'm looking for a way to play them directly from the wdtv.

As you said i can get them working in vlc and my azbox, but using the wdtv would be the cream on the cake so to speak.
extremedigital
Global Moderator
 
Posts: 218
Joined: Thu Apr 08, 2010 7:48 am

Re: IPTV Live TV Streams   

Postby b-rad.cc » Wed May 12, 2010 5:28 pm

I've said this before but I think by default you should be posting your work and letting others decide if they're interested based off that. At the minimum you're helping stimulate other developments and furthering the community. ;)
PM's are for private matters only, please post public matters on the forum to help others who might have the same issue.
:mrgreen:
User avatar
b-rad.cc
WDLXTV Team
 
Posts: 3003
Joined: Sat Apr 03, 2010 9:35 am
Location: New York

Re: IPTV Live TV Streams   

Postby Parnas » Thu May 13, 2010 12:10 pm

extremedigital wrote:Hi Parnas, this is exactly the kind of thing i am looking for.

All right, here is the code I've managed to write so far.

This is the proxy script; it's much similar in structure to other proxies you can find in the UMSP plugins directory: I've added support for HTTP redirection (Location header) and modification of MIME types (Content-type header). I called it freeview-proxy.php, since my main purpose was to watch channels from the UK FreeView platform.
Code: Select all
<?php

$rawURL = $_GET['itemurl'];
$parsedURL = parse_url($rawURL);
$itemHost = $parsedURL['host'];
$itemPath = $parsedURL['path'];
$itemPort = $parsedURL['port'];
_freeviewGet($itemHost, ($itemPath ? $itemPath : "/"), ($itemPort ? $itemPort : 80));

function _freeviewGet($prmHost, $prmPath, $prmPort) {
   # print "host: ".$prmHost."\n";
   # print "port: ".$prmPort."\n";
   # print "path: ".$prmPath."\n";
   
   $fp = fsockopen($prmHost, $prmPort, $errno, $errstr, 30);
   if (!$fp) {
      echo "$errstr ($errno)<br />\n";
   } else {
      $out  = "GET ". $prmPath ." HTTP/1.1" ."\r\n";
      $out .= "User-Agent: Wget/1.12 (elf)" ."\r\n";
      $out .= "Host: " . $prmHost . "\r\n";
      $out .= "Cache-Control: no-cache" ."\r\n";
      $out .= "Connection: Close"."\r\n"."\r\n";
      fwrite($fp, $out);     
      $headerpassed = false;
      while ($headerpassed == false) {
         $line = fgets( $fp);
         list($tag, $value) = explode(": ", $line, 2);
         
         if (stristr($tag, 'Location')) {
            $target_url = trim($value);
            $url_data_string = http_build_query(array('itemurl' => $target_url));
            header("Location: http://127.0.0.1/umsp/plugins/freeview-proxy.php?".$url_data_string."\r\n");
            continue;
         }
         if (stristr($tag, 'Content-Type'))
         {
            if (strstr($value, '/octet-stream'))
                 header("Content-Type: video/h264"."\r\n");
            else header($line);
            continue;
         }
         
         header($line);
         if ($line == "\r\n") {
            $headerpassed = true;
         }
      }

      fpassthru($fp);
      fclose($fp);
   }
}

?>


This is the main plug-in script; it's called freeview.php and it's very simple: essentially what it does is populate an array of channels to be shown on screen.
Code: Select all
<?php

function _pluginMain($prmQuery) {
  $items = _pluginCreateChannelList();
  return $items;
}

function _pluginCreateChannelList() {
  $videoItems = array (
     'BBC1' => 'http://cctv.ws/7/BBC1',
     'BBC2' => 'http://cctv.ws/7/BBC2',
     'ITV1' => 'http://cctv.ws/2/ITV1',
     'Channel Four' => 'http://cctv.ws/5/ChannelFour',
     'Five' => 'http://cctv.ws/0/s3byz/Five',
     'BBC3' => 'http://cctv.ws/9/BBC3',
     'BBC4' => 'http://cctv.ws/7/CBeebies/BBC4',
     'ITV2' => 'http://cctv.ws/0/NhYpi4/ITV2',
     'ITV3' => 'http://cctv.ws/0/ITV3',
     'ITV4' => 'http://cctv.ws/3/rrU5j/ITV4',
     'E4' => 'http://cctv.ws/5/E4Channel',
     'More4' => 'http://cctv.ws/3/More4',
     'CBS Reality' => 'http://cctv.ws/6/CBSReality',
     '4Music' => 'http://cctv.ws/3/4Music',
     'Zone Horror' => 'http://cctv.ws/1/ZoneHorror',
     'Film4' => 'http://cctv.ws/1/3eZ1R1/Film4',
     'Classic Movies2' => 'http://cctv.ws/4/classicmovies2',
     'James Bond TV' => 'http://cctv.ws/2/JamesBondTV',
     'QVC' => 'http://cctv.ws/2/qvcuk',
     'Fashion TV' => 'http://cctv.ws/0/FashionTV',
     'ClassicFM TV' => 'http://cctv.ws/6/cfmtv',
     'History' => 'http://cctv.ws/9/1wbeA4/History',
     'Discovery' => 'http://cctv.ws/9/DiscoveryChannel',
     'Movies 1' => 'http://cctv.ws/7/somethingmovies1',
     'Movies 2' => 'http://cctv.ws/9/somethingmovies2',
     'Movies 3' => 'http://cctv.ws/1/somethingmovies3',
     'Movies 4' => 'http://cctv.ws/2/ovies3',
     'Eurosport' => 'http://cctv.ws/1/BritishEurosport',
     'BBC News24' => 'http://cctv.ws/8/BBCNews',
     'Sky News' => 'http://cctv.ws/2/SkyNews',
     'BBC Parliament' => 'http://cctv.ws/5/bbcpar',
     'Bloomberg TV' => 'http://cctv.ws/6/BloombergUK',
     'Russia Today' => 'http://cctv.ws/9/RussiaToday',
     'Scuzz' => 'http://cctv.ws/1/Scuzz',
     'Flaunt' => 'http://cctv.ws/3/Flaunt',
     'France 24' => 'http://cctv.ws/6/France24En',
     'BBC1 (LQ)' => 'http://cctv.ws/6/BBC1LQ',
     'BBC2 (LQ)' => 'http://cctv.ws/1/BBC2LQ',
     'BBC3 (LQ)' => 'http://cctv.ws/5/BBC3lq',
     'Channel Four (LQ)' => 'http://cctv.ws/3/C4LQ',
     'E4 (LQ)' => 'http://cctv.ws/1/e4lQ',
     'Five (LQ)' => 'http://cctv.ws/1/FivelQ',
     'ITV1 (LQ)' => 'http://cctv.ws/3/ITV1LQ',
     'ITV2 (LQ)' => 'http://cctv.ws/8/TV2lq/ITV2LQ',
     'ITV3 (LQ)' => 'http://cctv.ws/4/ITV3LQ',
     'CBS Reality (LQ)' => 'http://cctv.ws/4/CBSRealityLQ',
     'BBC News24 (LQ)' => 'http://cctv.ws/3/BBCnewsLQ',
     'Bloomberg (LQ)' => 'http://cctv.ws/8/BloombergLQ',
     'CNN International' => 'http://cctv.ws/7/CNNint',
     'CNN International (LQ)' => 'http://cctv.ws/5/xvtmX3/CNNlq',
  );

  foreach ($videoItems as $name => $url) {
    $url_data = array('itemurl' => $url);
    $url_data_string = http_build_query($url_data);

    $retMediaItems[] = array (
      'id' => 'umsp://plugins/freeview?' . $url,
      'dc:title' => $name,
      'upnp:class' => 'object.item.videoitem',
      'res' => 'http://127.0.0.1/umsp/plugins/freeview-proxy.php?'.$url_data_string,
      'protocolInfo' => 'http-get:*:*:*',
    );
  }
  return $retMediaItems;
}

?>


Both of these must be put in the /etc/umsp/plugins directory, that is read-only in the WDLXTV firmware. I get around this limitation using the "mount -o bind" command, to make that path temporarily point to a work area on the /tmp writable file system.

Of course you also have to add a suitable entry in /conf/umsp.php:
Code: Select all
$myMediaItems[] = array(
   'id' => 'umsp://plugins/freeview',
   'parentID' => '0',
   'restricted' => '1',
   'dc:title' => 'FreeView UK',
   'dc:creator' => 'myCreator',
   'dc:date'   => '2009-12-30',
   'upnp:author' => 'myAuthor',
   'upnp:artist' => 'myArtist',
   'upnp:album' => 'myAlbum',
   'upnp:genre' => 'myGenre',
   'upnp:length'   => '2:10:20',
   'desc' => 'myDesc',
   'upnp:class' => 'object.container',
   'upnp:album_art'=> '',
   'duration' => 'myDur3',
   'size' => 'mySize3',
   'bitrate' => 'myBitr',
   'protocolInfo' => '*:*:*:*',
   'resolution' => 'myReso',
   'colorDepth' => 'myColor',
);


I've just found out an interesting behavior, anyway: if I stream a channel to a file on the USB storage using
Code: Select all
wget -O <file>.ts http://xyz/

then I can watch the streaming in almost real-time on the WDTV just reading the file, without using UMSP, and without the infamous initial "3 minutes" delay. So the delay is not caused by the video data itself, but somehow by the way it's served to the WDTV video decoding engine ... I have to experiment a bit more with this.

Hope this is useful!

Greetings, Parnas
Parnas
n00b
 
Posts: 16
Joined: Thu Apr 22, 2010 3:25 pm
Location: Como (Italy)

Re: IPTV Live TV Streams   

Postby extremedigital » Thu May 13, 2010 1:11 pm

great work Parnas, thank you for your post.

Now i just have to figure how to do this or wait until perhaps b-rad or zoster can add directly into umsp. :D

i am a total noob when it comes to linux unfortunately... :oops:

your list is virtually identical to mine ie uk freeview channels....once this is done, hopefully i have one more thing up my sleeve for usa tv channels which i have just got working via pc.
extremedigital
Global Moderator
 
Posts: 218
Joined: Thu Apr 08, 2010 7:48 am

Re: IPTV Live TV Streams   

Postby absorber123 » Thu May 13, 2010 1:38 pm

Please help me for how to use "mount -o bind" specific to this case.

Please do the needful
absorber123
n00b
 
Posts: 14
Joined: Sun May 09, 2010 12:00 pm

Re: IPTV Live TV Streams   

Postby g_krassa » Fri May 14, 2010 4:29 am

@Parnas

Hey nice job. I will try your new plugin tonight. Do all of those streams work for you?

also I tried this technique wget -O <file>.ts http://xyz/ but still couldn't get it to work properly. The video starts after about 15 sec, shows a few frames and then pauses. I am doing the wget when in the usb directory. Any idea?

Thanks
g_krassa
n00b
 
Posts: 8
Joined: Fri Apr 16, 2010 4:04 pm

Re: IPTV Live TV Streams   

Postby topdon » Fri May 14, 2010 6:35 pm

absorber123 wrote:Please help me for how to use "mount -o bind" specific to this case.


I too would like to know how to use the mount -o bind command to make that path temporarily point to a work area on the /tmp writable file system.

This is some great work Parnas! :P

EDIT: I've tried using the below code via telnet:

Code: Select all
mount -o rw 192.168.1.4:/etc/umsp/plugins


but i get the message:

Code: Select all
mount: can't find 192.168.1.4:/etc/umsp/plugins in etc/fstab


What am i doing wrong?
topdon
n00b
 
Posts: 1
Joined: Fri May 14, 2010 6:32 pm

Re: IPTV Live TV Streams   

Postby mmikel » Fri May 14, 2010 8:39 pm

Hi!

I was try to adapt your scripts to play channels from my home VDR ( http://www.tvdr.de/ ), It Works! )) But, delay between pressing "OK" and starting playing is about 1.5-2 minutes, its very annoying.

Another annoying "feature", is message between starting "..... 'cancel' for starting from beginning, 'OK' to resuming", of course it doesn't work on Live channels....

Is any ideas, how to solve this two problems.....
mmikel
n00b
 
Posts: 8
Joined: Thu May 13, 2010 7:59 pm

Next

Return to UMSP Plugins

Who is online

Users browsing this forum: No registered users and 2 guests

cron