TV Station!

Got a suggestion for future Synology products? Suggest it here!
We'll forward your idea to our RD department.

Re: TV Station!

Postby mafiltenborg » Tue Mar 01, 2011 3:34 pm

eversteegt wrote:I managed to get "tvheadend" running on the DS209+II. It was an awful PITA to get it compiled for the PowerPC e500v2 cpu because the standard x-compile toolchain Synology delivers for this platform is too old (Tvheadend needs at least GCC 4.1 to be able to compile for all C-macros the program uses).


This appears to be PowerPC specific. Looking at http://download.synology.com/download/d ... 0Guide.pdf (thanx, Christian_IA) I see that the crosscompiler toolchain for both DS209 and DS110j (which are both ARM devices) appears to be gcc4.21. Which would mean that tvheadend should compile more easily, not being such a PITA.

Hmmm...

If time permits, I think i might give it a go. That would take me first half of the way.

Next; anyone who knows about kernel 2.6.32 support for USB devices and -tuners? Built-in, as modules or absent altogether? I imagine that the Synology people did a thorough job of scraping everything unneccessary off of the kernel, libs etc. I'll just need the afatech 9015 module x-compiled and a firmware blob in place to get my cheapo-system going.

Or so it seems...
You only live once - but if you do it right, once is enough.
mafiltenborg
Rookie
Rookie
 
Posts: 33
Joined: Sun Aug 02, 2009 8:55 pm
Location: Denmark

Re: TV Station!

Postby eversteegt » Tue Mar 01, 2011 3:49 pm

@mafiltenborg: Check. On every few different Synology models, the procedure will be different. DS209+II is my NAS so my experience will be pased on the PPC with SPE platform.

Unfortunately, cross-compile toolchains with GCC 4.x from Synology will also be no guarantee for success. In order to 'de-pita-ify' my setup, i once considered to upgrade to DS211+ (with an ARM cpu). Trying to do some homework first, I tried to compile TVHeadend with such a GCC 4.x toolchain from the Synology manual. Unfortunately, that also didn't work (yet another GCC macro missing).

Please do feel free to give it a try. Maybe someone with more C skills (and specifically combined with inline assembly, because all problems boil down to the atomic_add or atomic_add2 functions) can work around the problems.

Regarding the modules: I have not been able to discover any TV- or DVB-related kernel module support in the default module tree on the Synology's. That is why the "3rd party integration guide" also mentions how to compile kernel modules yourself.

The device I use (Sundtek.de dvb-t and dvb-c device) is independent of the default modules. The driver is kind of user-space and creates the necessary /dev/dvb/* nodes.
eversteegt
Novice
Novice
 
Posts: 48
Joined: Tue Sep 23, 2008 9:55 pm

Re: TV Station!

Postby 321liftoff » Fri May 27, 2011 10:29 am

Have any of you heard of NASDVR? Since there hasn't seemed to be much luck getting the Synology to work with tvheadend here or mythtv backend, maybe NASDVR would have better success? It looks to be a much simpler interface but the developer is using it on his NAS. I'm looking to get a NAS for the purpose of a PVR/DVR, so I don't own one yet. Could someone give it a try on a Synology, maybe make the necessary improvements to the project and report results?

Below is from an e-mail from the developer:
NASDVR is basically a set of perl scripts that are kicked off by cron jobs that store/retrieve data from a mysql database and use the hdhomerun_config application to set channels, start and stop recording. So if your box can run perl, mysql and hdhomerun_config then you are good to go.


Does the Synology come with the packages mentioned above, or can they be installed? Thanks!
321liftoff
I'm New!
I'm New!
 
Posts: 3
Joined: Tue May 17, 2011 6:58 pm

Re: TV Station!

Postby eversteegt » Sat May 28, 2011 11:20 pm

NasDVR looks good but it looks very limited regarding hardware it can work with.

Since yesterday, I own a Synology DS 710+ (2-bay nas with Intel Atom processor / x86 architecture). Fantastic buy! It is much more quiet than my DS209+II I owned previously, despite being more powerful.

But the best part: It is somewhat more straightforward to get TVHeadend running :). Still not as easy as one would want, but at least doable for anyone with decent knowledge of Linux. And in contrast to my former Synology model, it has no problems with recording 3 channels (on the same transponder) at a time and also streaming them simultaneously to my Ubuntu desktop with VLC.

Unfortunately, a 100% covering howto is difficult to write because there can be differences between the different architectures. But I will try to sum up the major points:

The hardware and driver:
* I bought a "MediaTV pro" stick at http://www.sundtek.de
* The drivers also linked there consist of 1 .sh file with hybrid binary and shell scripting code.
* The driver will install on >= 8 different system architectures that are known to run Linux.
* After the driver is installed, a daemon called "mediasrv" will be running. This one communicates with the hardware and offers the major known devices in /dev (eg. /dev/dvb/* ).
* With "mediaclient -e", you can sum up all devices that are made available
* With "mediaclient -m DVBC -D DVBC", I explicitly told the DVB frontend to be DVB-C

So far, the hardware and getting it to run on almost any Synology NAS is fairly easy.

The major challenge is getting "tvheadend" running, as I stated before. On none of the platforms (even including x86), cross-compiling it proved to give any success. For x86, the compilation process actually succeeds and gives a (at first glance) running binary, but with 2 major problems:

* On a TERM signal, it will not shut itself down probably. All "tvheadend" processes need a KILL signal.
* Performance is downright dramatic. When opening a stream from tvheadend to VLC, the stream is distorted and full of artefacts.

When calling a "uname -a" on the shell of my Synology, I discovered that Synology is running a 64 bit (!) kernel.

Now comes the key part of this whole adventure:
* On my PC, I fired up a VirtualBox, installed a 64 bit version (amd64) of Debian Squeeze.
* Inside that virtual machine installation, I installed "build-essential" and "debootstrap"
* With the latter, I 'bootstrapped' yet another fresh debian installation with architecture type "AMD64". What "debootstrap" does, is take a directory and put a complete (as if just installed from CD) debian installation in it.
* I put the whole directory in a TAR ball (compressed with gzip of bzip) and copied the archive to my Synology.

* Extract the fresh chroot'ed image to a directory on your Synology (I choose "/volume1/@debian"
* In the directory, you should see /bin, /etc, /usr, etc. as If you would see the root of a Linux installation

Now for some configuration:
* In you synology web interface, create a user called "hts". On the Synology part, it does not really need to have access to anything, but on the Linux part, it is good to have a system user that, for example, you can give filesystem permissions for writing in a specific directory for storing recordings.
* In /etc/passwd on your Synology filesystem, lookup the user and copy-paste the line to the /etc/password in your Debian directory. Be especially careful that the UID of the user will not conflict with a UID already in /etc/password of the Debian setup.
* In the debian directory, create a file named "debian_chroot" in the "etc" directory. Put a small identifying text in there. Later on, you can see more easily if you are performing steps inside the chroot jail, or on your synology.

Now the 'black magic' is going to happen:
Code: Select all
#!/bin/sh

export CHROOTDIR=/volume1/@debian

 mount -o bind /dev ${CHROOTDIR}/dev
 mount -o gid=4,mode=620 -t devpts none ${CHROOTDIR}/dev/pts
 mount -t proc none ${CHROOTDIR}/proc
 mount -t usbfs ${CHROOTDIR}/proc/bus/usb ${CHROOTDIR}/proc/bus/usb
 mount -t sysfs ${CHROOTDIR}/sys ${CHROOTDIR}/sys
 
 mount -o bind /volume2/video/recording /volume1/@debian/home/hts/recording


This is a shell script that exports/re-directs some essential virtual system directory's to your Debian 'chroot'. Especially /proc and /dev are important, because everythin you are going to run from inside the 'chroot' will need to be able to access the TV stick.
I put the script in /opt/etc/init.d, so the 'Optware' addon I also installed on my Synology will also prepare the chroot at startup of the NAS.
The last command will take the directory I choose to store recordings in and exported it to a directory inside the -to be- chroot. /volume2/video/recording is owned by the "hts" user I created in the steps before and, because the UID in both passwd files is the same, tvheadend should have no problems writing to it.

* Now, execute the following: "chroot /volume1/@debian /bin/bash". Of course, replace the path with whatever path you choose to extract the Debian installation to.

And be amazed: You see whatever string you enterd in /etc/debian_chroot and from now on (for this session), it will seem that you are not on you Synology box anymore but on a Debian system!

Run an "apt-get update" to update package repositories and install whatever you like. I installed "build-essential", "usbutils". Talking about USB, the "lsusb" command contained in the usbutils package should show your list of USB devices connected to the NAS. This way, you also will know that proc is working right.

Now, the most important things to do:
* Install the driver from Sundtek, as I already described above. On my previous Synology, I ran the driver from inside the normal Synology environment, but on the new NAS, I choose to let the Sundtek driver also run from the chroot jail. The "mediasrv" daemons should start and it should be able to communicate with the TV stick
* From http://www.lonelycoder.com, download "tvheadend". As you will see, the auther offers Debian packages. When you choose to use these and you are running an Intel-based NAS, be sure to pick the AMD64 one! If your Synology kernel is running 64 bit and you run the 32 bit version of TVheadend, it will probably show the same behavior as I described.

When you don't have an Intel-based Synology, you will have to do some work. From inside the chroot-jailed shell, just compile from the tvheadend sources.

When installed, run tvheadend as the "hts" user and be sure to have a home for him (/home/hts). All configuration and tvheadend databases will be under $HOME/.hts .

PHEW... it's a long story, I know. I also hope people will not be too disappointed to see it involves a lot more than just following some simple steps. But unfortunately with all that ARM, Powerpc, X86 and X86-64bit, it is what we have to deal with. So bottom line, the summary:

* Cross-compiling tvheadend to run directly from Synology shell has proven to be a no go. Because of binary problems library trouble, etc.
* Setting up a chroot with Debian (or any favourite linux distribution) is the least intruding way to create an environment within your Synology NAS to experiment to your liking
* But be SURE to have a Linux that consists of binary's and library's that are binary 100% compatible with the architecture of your nas! Especially PowerPC NAS'es with the E500v2-SPE extensions are a PITA, because there are almost no or only few Debian chroot's built for that (see http://wiki.debian.org/PowerPCSPEPort and http://download.breakpoint.cc/debian/li ... ny-gnuspe/.

* The sundtek driver can be ran from the chroot jail of the Synology environment. The one or the other may work better for you. If you run it from the Synology environment, you could get trouble with tvheadend accessing /dev/dvb/* from the chroot'ed /dev.

* I still have not created scripts to also automatically start tvheadend and the mediasrv daemon automatically. But it should be as simple as executing "chroot <normal commandline to startup the software>", called from a shellscript :).

Hope this can help some people. I will keep subscribed to this topic so if you run in to any specific problems, feel free to ask. But remember, it is not for the faint of heart and I will not teach people basic Linux skills ;)
eversteegt
Novice
Novice
 
Posts: 48
Joined: Tue Sep 23, 2008 9:55 pm

Re: TV Station!

Postby UggaBugga » Sun May 29, 2011 1:54 am

+1
I would really like to see such a feature in a future software/firmware upgrade.
Smart move to blow the competition out of the way, for sure!
User avatar
UggaBugga
Beginner
Beginner
 
Posts: 29
Joined: Wed Jun 25, 2008 12:08 pm

Re: TV Station!

Postby akilleuz » Mon Jun 06, 2011 2:19 pm

Hi,

I would like to try this on my Synology 109j but i dont know if it would be worth it due to the power use of tvheadend and streaming a channel to a HTPC?

But anywahy, it is a loong time since i worked with linux, but i think i no what to do or more or less due to your cookbook :)

My 109j have MPC8241 CPU, should i also just create a chroot in debian and run tvheadend, usb tuner from?
akilleuz
Trainee
Trainee
 
Posts: 19
Joined: Sat Jan 02, 2010 8:33 pm

Re: TV Station!

Postby eversteegt » Mon Jun 06, 2011 2:52 pm

Judging from the info on http://forum.synology.com/wiki/index.ph ... y_NAS_have , running 109j would be a severe challenge :D.

Maybe if you don't need any decryption of paytv channels and have 1,5 mbit DVB-T streams, it could work but hey, you can always try :).

Just find a debian chroot (or build one yourself) that is binary compatible with your CPU and try. But only if you already have hardware that will work with the Synology and has a driver for it.
eversteegt
Novice
Novice
 
Posts: 48
Joined: Tue Sep 23, 2008 9:55 pm

Re: TV Station!

Postby mafiltenborg » Tue Jun 07, 2011 10:15 am

Some time back, someone suggested I look at the HDhomerun solution. Coincidentally, a colleague of mine bought one and introduced me to the device.

Smart!

If you look in previous posts, you see that one of the big obstacles to overcome when shoehorning a PVR into a smallish device like a NAS is getting the tuner working. USB, device drivers and binary blobs all present their own little challenges. Not to mention crosscompiling whatever PVR code one fancies.

HDhomerun is a network DVB-C tuner. It doesn't require USB or binary blobs, but uses standard network connection both for control and streaming of AV to clients. Ideal for our use.

I'll have to dig into this... Only problem is that fiddling with PVR on my DS209 is constantly preempted by all those little things life throws at me; car repairs, work, mowing the lawn - you know...
You only live once - but if you do it right, once is enough.
mafiltenborg
Rookie
Rookie
 
Posts: 33
Joined: Sun Aug 02, 2009 8:55 pm
Location: Denmark

Re: TV Station!

Postby eversteegt » Tue Jun 07, 2011 10:22 am

Yeah, it seems that, as you grow older, priorities automatically shift to other non-tech stuff ;). And I even don't have kids :P

Anyway, hdhomerun seems like a fantastic solution. Unfortunately, it is not that widely available in Europe. But it would be cool to test "tvheadend" in combination with the hdhomerun. Tvheadend also supports IPTV streams (and probably also the HDhomerun) as a source for recording and re-streaming.

But to be honest, I still am glad that Sundtek has made their MediaTV sticks with drivers that will install on almost anything able to run Linux, wihout messing with kernel modules and sources :)

The solution I have running on my 710+ now is running great.
eversteegt
Novice
Novice
 
Posts: 48
Joined: Tue Sep 23, 2008 9:55 pm

Re: TV Station!

Postby homolka » Mon Jul 11, 2011 6:00 pm

Two questions:

1) when I want a recording device only, can I use the IPKG package for Kaffeine and and Sundtek USB stick and write to my video dir?
2) can we make use of the already built in feature Surveilllance station for recordings?

Please advise

Daniel
homolka
I'm New!
I'm New!
 
Posts: 2
Joined: Thu Jun 16, 2011 10:20 am

Re: TV Station!

Postby eversteegt » Tue Jul 12, 2011 10:21 am

1) If you can manage to get a complete KDE environment and Kafeine running on your Synology, sure, I don't see why not. The question is why you want to use a program that needs an X display to run on a device that is mainly running headless while there are so many other DVB recording solutions.

2) Surveillance station does not even support USB webcams, let alone other locally-attached devices. Furthermore, recorindg streams from IP cams is something completely different to scheduled recording of TV streams for longer periods.
eversteegt
Novice
Novice
 
Posts: 48
Joined: Tue Sep 23, 2008 9:55 pm

Re: TV Station!

Postby beckos » Wed Nov 02, 2011 3:46 pm

I am not familiar with Linux, but I am very tempted to transform my DS into a PVR. Just a few short questions:

- do you think it will run on DS211+? (how well?)
- will I be able to use WDTV Live or Boxee Box to see the channels in real time on my TV? Is it enough to switch channels from the remote of Sundtek Media Pro?
- can the TVheadend be packed as an .spk for an easy install, maybe? hopefully?

Thank you!
DS712+ DSM 4.0 2228 2x Seagate ST2000DL003 / SHR
beckos
Experienced
Experienced
 
Posts: 142
Joined: Fri Jan 28, 2011 12:05 pm

Re: TV Station!

Postby sundtek » Sat Nov 05, 2011 3:28 am

We are currently working on a virtual windows client so the Sundtek MediaTV Sticks can be attached to the synology and be used with Windows Mediacenter via Network or Wifi (the ETA shouldn't be too long anymore).

So far it's already possible to use the Stick with Linux via Network from the Synology NAS.

A PVR Frontend for the driver on embedded boards is on our list although this is a mid-long term project.
tvheadend should work on it but as some people figured out the dependencies can be somewhat horrible, we kept the dependencies of the driver extremely low profile in order to basically work everywhere.
sundtek
Trainee
Trainee
 
Posts: 12
Joined: Sat Nov 05, 2011 3:22 am

Re: TV Station!

Postby beckos » Wed Nov 09, 2011 2:52 pm

sundtek wrote:We are currently working on a virtual windows client so the Sundtek MediaTV Sticks can be attached to the synology and be used with Windows Mediacenter via Network or Wifi (the ETA shouldn't be too long anymore).


That is good news... could you you provide such sort of a client to be used in conjunction with Boxee Box as well? Boxee Box runs a slimmed down version of Linux, pretty much the same as Synology...
DS712+ DSM 4.0 2228 2x Seagate ST2000DL003 / SHR
beckos
Experienced
Experienced
 
Posts: 142
Joined: Fri Jan 28, 2011 12:05 pm

Re: TV Station!

Postby sundtek » Wed Nov 09, 2011 11:00 pm

beckos wrote:
That is good news... could you you provide such sort of a client to be used in conjunction with Boxee Box as well? Boxee Box runs a slimmed down version of Linux, pretty much the same as Synology...


if you have a boxes box and are able to give us some remote login just contact us we can have a look.
The driver has network support you can connect it to the has and stream it from the nas to any other linux or mac PC/embedded board.
I don't think it should be a problem.
sundtek
Trainee
Trainee
 
Posts: 12
Joined: Sat Nov 05, 2011 3:22 am

PreviousNext

Return to Feature Requests & Product Improvement Suggestions

Who is online

Users browsing this forum: No registered users and 3 guests