Author Topic: WDTV and MythTV  (Read 15179 times)

August 10, 2009, 08:17:33 PM
Read 15179 times

qyo001

  • Newbie

  • Offline
  • *

  • 6
Is there any way to stream a ipTV via hacked WDTV? I have a subscription to some number of channels , so I can use my MythTV in my linux box. How to make something like that on WDTV
if its possible at all...

August 11, 2009, 02:58:26 AM
Reply #1

ichalex

  • Newbie

  • Offline
  • *

  • 20
Just wanted to ask the same, but for T-Home Entertain. A German IPTV Service, the most Networks are DRM Coded, but the Public Stations are free. So one can watch them with VLC, with an Playlist like that:

#EXTINF:0,239.35.10.2 ZDF HD
rtp://@239.35.10.2:10000

Possible with WDTV?

August 11, 2009, 04:00:59 AM
Reply #2

3dxr

  • Global Moderator
  • Sr. Member

  • Offline
  • *****

  • 411
currently not this is also missing for me ....

there are some problems -
1) some IPTV streams are coded/protected decoding required
2) some IPTV streams are encoded with unssuported codecs for example my provider using MP42/WMV1/WMV2/WMV3+WMA 9.1pro
3) WDTV doesnt support reading from streams RTMP/RTP/UDP/HTTP :( only some shoutcast audio is working with fuse module

May be WDTV2 with native network support will has more features.

October 16, 2009, 03:42:37 AM
Reply #3

a-bra-ka-da-bra

  • Newbie

  • Offline
  • *

  • 4
I've made a prototype code that plays IPTV streams on WD TV. It is based on the same approach used for YouTube application, that is, TV channels are represented as video files using FUSE. There are several issues with IPTV though:

1. At least my IPTV provider is using multicast UDP streams for video transport, and as there is no multi-cast support compiled in the kernel that runs on WDTV I had to use AF_PACKET level sockets instead. This in turn may leave the video stream flowing should the code crash as kernel will not transmit leave group IGMP packet. I also have to do some experiments to find out what happens if you switch the box off without stopping the player first.

2. The 1. also means that my code only supports video stream in a form of multi-cast UDP traffic, with IGMP V2 used to switch between channels. Of course only non-encrypted streams are playable.

3. You need a playlist of your service provider so that the code knows mapping between TV channels and multi-cast addresses.

4. Your IPTV must use either MPEG2 or MPEG4 transport streams. Those are playable by WD TV player.

5. WD TV's player is optimized for playing files. It does some weird things like reading about 1 megabyte from file (I believe it tries to figure out formats, encoding, etc.), then it starts reading again. It reads the file in chunks of about 130 kB. Altogether this means that there is a delay of up to 10 seconds (depends on a bitrate of the channel) before the channel starts playing. HD TV channels starts playing pretty quick, other with more delay (it also means that player is several seconds behind compared to the same channel being player on STB   ;D

I am not yet ready to publish the code, but this can happen in about a week or so.



October 16, 2009, 03:46:11 AM
Reply #4

a-bra-ka-da-bra

  • Newbie

  • Offline
  • *

  • 4
One more thing I forgot - missing are also EPG and other goodies offered by your service provider via STB. I don't belive there is a uniform standard for those.

October 17, 2009, 10:21:43 AM
Reply #5

a-bra-ka-da-bra

  • Newbie

  • Offline
  • *

  • 4
As it happened I managed to get the code consistent and working sooner than expected. For the time being I've packed the application into 0.5.7 image file of WDLXTV release. This way I don't need any external .bin file. Such packing is probably specific to my needs as I wanted to bring IP TV to my other player I have in "normal" use, and I don't want to have parts of firmware on external disk for the boot.

I've also set up Trac project on my home desktop, so anybody interested in IP TV on  WDTV can check it out at https://something.homelinux.net/trac/wd-tv. I'm using self-signed certificate so you'll have to add a security exception in IE or Firefox.

Note: This is not off-the shelf solution. You will still have to modify wdtv.bin to supply your own list of TV channels (playlist). In the future they should probably go to external disk, but it is not yet so. Instructions on how to modify wdtv.bin are available at above link.

Please note that I still regards this as an experiment. I'll wait to see if there is any general interest in having IP TV (or more general form of stream paying capability) on WD TV at all, or specific interest in including this into any of more prominent frameworks (wdtvtools or similar). At the end it is quite possible that everything simply fades away.

A short summary:

 - it can play unencrypted IP TV streams delivered as multi-cast UDP stream
 - in principle it supports any transport streams playable by WDTV's player. I've tested it with MPEG4 and MPEG2 transport streams, including highdef MPEG4 TV channels
- it uses IGMP V2 to switch between channels
- it does not work over wireless; name 'eth0' is hardcoded in /etc/init.d startup script. You may try to change it to wireless, but personally I did not test it with wireless.

And be patient - it may take considerable time to switch the channel. The time depends on the bit-rate of the TV stream. HD channels start playing much quicker than non-HD ones.



December 12, 2009, 11:05:33 PM
Reply #6

p41

  • Newbie

  • Offline
  • *

  • 5
It would be really great if the WDTV could serve as a mythtv client. I know that would be pretty hard- pretty much either replacing the whole navigation app or at least replacing the video player program. What's worse, wdtv can't even play an NFS-mounted-myth-directory video file currently being recorded, you have to wait for the recording to finish.

However, playing already recorded myth files works more or less. (Caveat: I don't have the most updated mythtv. YMMV) But here is a script that makes that easier. It's set up to run as a job after myth finishes recording everything. A few notes. First, I have other jobs doing other things, so this script actually does TWO things - it encodes some programs into DIVX4/5 (takes a while, but for longer term storage and also gets past recording hiccups that sometimes seems to confuse wdtv), and for other programs makes easier-to-navigate names using hard links. I have specific predictable names of myth recording jobs (%title%) to cause creation of hard links. Also hard links will normally survive mythtv deletion, or if you want myth to control disk usage, set myth to delete files slowly and the hard link will still be there, but it will not be a size that will chew up disk space.

Where the year is stripped off I also show a simple replacement of 2010 to 2010_

Demonstrated is how particular programs can override the screen format, raise the video quality, etc.

So if myth directory is /home/myth, then I have a wdtv directory under that where all the hard links get put, and subdirectories below that for the DIVX4/5 encoded files.

So after everything, wdtv nfs or cifs mounts the 'wdtv' directory and doesn't get into the muck of the raw /home/myth directory, and when myth is done recording (remember, you don't want to try playing while it's still recording anyway) myth runs this, and this either makes it available to wdtv via a hard link, or else runs the encoder and a few hours later its done.



#!/bin/bash

# configure as a myth job using the following options:
# %DIR% %FILE% "%TITLE" %STARTTIME%
# this script licensed under GPLv3

if [ $# == 0 ]; then
  echo
  echo Usage: $0 directory file \"ProgramName\" YYYYMMDDHHMMSS
  exit
elif [ ! $# == 4 ]; then
  echo
  echo Invalid number of arguments
  echo Usage: $0 directory file \"ProgramName\" YYYYMMDDHHMMSS
  exit
fi

directory="$1";
cd ${directory}
file="$2";

logfile=${directory}/mythwdtv.log
outputdir="/home/myth/wdtv"
outputname=`echo ${file} | sed -e "s/.mpg$//"`
#outputdate=`echo $4 | sed -e "s/^2010/2010_/" | sed -e "s/......$//"`
outputdate=`echo $4 | sed -e "s/^20..//" | sed -e "s/......$//"`
outputtime=`echo $4 | sed -e "s/^20......//" | sed -e "s/..$//"`

scale=
# width:height

# standard 4:3 480p
#scale=640:480

# widescreen 480p - TV
scale=854:480

# 720p 4:3
#scale=960,720

# 720p widescreen
#scale=1280:720

# 1280p widescreen
#scale=1920:1080


# if interlacing problems come up, one of these might work
#scale=1920:1080:0  #may de-interlace
deinterlace=
#deinterlace=,kerndeint
#deinterlace=,pp=lb
#deinterlace=,pp=ci

expand=
#expand=,expand=854:480   # add horizontal bars to 480 to make 16:9
#expand=,expand=1440:1080 # add horizontal bars to 720 to make 4:3
#expand=,expand=1280:720  # add vertical bars to 4:3 to make widescreen
#expand=,expand=1920:1080 # add vertical bars to 4:3 to make widescreen

crop=
#crop=,crop=640:480       # crop 480p to 4:3
#crop=,crop=960:720       # crop 720p to 4:3
#crop=,crop=1440:1080     # crop 1080p to 4:3

#vbitrate=1000 # 480p
vbitrate=1200  # 720p
#vbitrate=1800 # 1080p

#echo About to do $3 / ${outputdate} ${outputtime} >> ${logfile}

if [ "$3" == "Program One" ]; then
  # do an mencoder job but don't make a linked file
  outputdir="/home/myth/wdtv/wherever"
  outputname="ProgOne${outputdate}"
  #ln ${directory}/${file} ${directory}/wdtv/${outputname}.mpg
elif [ "$3" == "Program Two" ]; then
  outputdir="/home/myth/wdtv/wherever"
  outputname="ProgTwo${outputdate}"
  #ln ${directory}/${file} ${directory}/wdtv/${outputname}.mpg
elif [ "$3" == "Program Three" ]; then
  outputdir="/home/myth/wdtv/wherever"
  outputname="ProgThree${outputdate}"
  #ln ${directory}/${file} ${directory}/wdtv/${outputname}.mpg
  vbitrate=1000
  crop=,crop=640:480
elif [ "$3" == "Program Four" ]; then
  # don't do mencoder job, just make a linked file
  ln ${directory}/${file} ${directory}/wdtv/ProgFour${outputdate}_${outputtime}.mpg
  exit
elif [ "$3" == "Program Five" ]; then
  ln ${directory}/${file} ${directory}/wdtv/ProgFive${outputdate}_${outputtime}.mpg
  exit
elif [ "$3" == "Program Six" ]; then
  exit
else
  echo Unknown job $3 >> ${logfile}
  exit
fi

# Just in case - try not to stomp over another mencoder
while [ -f ${directory}/divx2pass.log ]; do
  echo $3 waiting for divx2pass.log file to disappear >> ${logfile}
  sleep 600
done

echo ${directory} ${file} br=${vbitrate},scale=${scale}${expand}${crop} `date` ${outputname} >> ${logfile}

nice -n 19 mencoder -lavcopts vpass=1:vbitrate=${vbitrate}:turbo -ovc lavc -oac mp3lame -vf scale=${scale}${expand}${crop},harddup -o /dev/null ${directory}/${file}
nice -n 19 mencoder -lavcopts vpass=2:vbitrate=${vbitrate} -ovc lavc -oac mp3lame -vf scale=${scale}${expand}${crop},harddup${deinterlace} -o ${outputdir}/${outputname}.divx ${directory}/${file}
rm divx2pass.log

December 14, 2009, 12:21:17 PM
Reply #7

jayallan

  • Administrator
  • Hero Member

  • Offline
  • *****

  • 1174
    • Jay Allan Photo
As it happened I managed to get the code consistent and working sooner than expected. ...
A short summary:

 - it can play unencrypted IP TV streams delivered as multi-cast UDP stream
 - in principle it supports any transport streams playable by WDTV's player. I've tested it with MPEG4 and MPEG2 transport streams, including highdef MPEG4 TV channels
- it uses IGMP V2 to switch between channels
- it does not work over wireless; name 'eth0' is hardcoded in /etc/init.d startup script. You may try to change it to wireless, but personally I did not test it with wireless.

And be patient - it may take considerable time to switch the channel. The time depends on the bit-rate of the TV stream. HD channels start playing much quicker than non-HD ones.





You should start a new thread for this mod if you have not already :)
WDTV LIVE with current official FW > HDMI > DVDO > Sony CRT Projector 150" 16/9 screen.  Toslink audio to Yamaha DTS receiver. No Network set up yet.

December 15, 2009, 04:04:48 AM
Reply #8

gescom

  • Newbie

  • Offline
  • *

  • 2
A short summary:

 - it can play unencrypted IP TV streams delivered as multi-cast UDP stream
 - in principle it supports any transport streams playable by WDTV's player. I've tested it with MPEG4 and MPEG2 transport streams, including highdef MPEG4 TV channels
- it uses IGMP V2 to switch between channels
- it does not work over wireless; name 'eth0' is hardcoded in /etc/init.d startup script. You may try to change it to wireless, but personally I did not test it with wireless.

And be patient - it may take considerable time to switch the channel. The time depends on the bit-rate of the TV stream. HD channels start playing much quicker than non-HD ones.


A-bra-ka-da-bra, your original wdtv.bin is not recognized by wdtv as a new firmware (am i doing something wrong?), so any further modifications - playlist, etc - are useless. Please, help :). Thank you very much.
Regards, g. 

February 26, 2010, 04:01:47 AM
Reply #9

dam72

  • Newbie

  • Offline
  • *

  • 11
Hi guys,

I own a WDTV Live, I know wrong section, but urgently need an option to use free h.264 multicast streams on my WDTV live player.
@a-bra-ka-da-bra, I found your trac site, where you offer a IPTV solution for WDTV. I also wrote you an email, but no response.. :(
The big question I have is, is there a possibility to use your solution on WDTV live? Knowing there are some differences between WDTv and WDTV live.

@all: Does anyone of you guys had successful expierances to implement a-bra-ka-da-bra´s solution into WDTV live!?

Thank you in advance!!!

P.S: I would like to use the streams of german t-com, public broadcasters...

regards
dam72