Saturday, May 30, 2009

Now, the latest thing I've been looking into, and spending way too much time on: TV

As mentioned below, I'll be using the Pinnacle Dazzle (or to be specific, PCTV 71e)
There ware not much info on this online so I just worked with info on similar cards and a bunch of trial and error.

Firstly, what I wanted was of course to A- get it working to watch TV, B-find a way to record and C- stream it over the network (in order of importance)

So, you'll be happy to know that it does in fact work out the box... you will of course not believe me if you tried any of the media apps available (MythTV, TVTime, etc.) as they can't work it themselves... I might look into sorting that out later, but for now, let me show what I've done myself.

First, some programs to install:
DVBstream - this includes the tools you'll use to, as the name suggests, stream video from the device.
w-scan - scan the frequencies for active channels
ffmpeg - to convert the transport stream(ts) file
mplayer - can read a ts file raw and read a stream without much fuss
Gstreamer and the like should be installed by default.

Lastly, you shouldn't need it, but if you do want to manually install all the win32 codecs, get whichever file you want from here and extract the files to the correct folder:
wget ftp://ftp1.mplayerhq.hu/MPlayer/releases/codecs/
tar jxvf
sudo cp /* /usr/lib/win32/

easy as that.
Back to the important stuff...

A- Let's scan for channels now. We'll prepare a file for Totem to use with Gstreamer:
w_scan -X > ~/.gstreamer-0.10/dvb-channels.conf
This will create a file for gstreamer to use when accessing the divice.
You can now open the Totem player and open Move -> Watch TV on....
From there it's pretty self explanetory.

B - Now you may notice, that's great, but there's no way to pause or record... so lets look at DVBstreamer now.
Here is the command to start streaming to a file on disc:
dvbstream -f 538000 101 102 -o > test.ts
Don't worry, it's simple: dvbstream -f -o >
Read the man pages (man dvbstream) to find out more... there as far more that just this available to you.
To find the frequence and PID's for teh channel you want to watch, just open the file we created before while scanning for channels:
nano ~/.gstreamer-0.10/dvb-channels.conf

Great, it's streaming to disk now, good as recording. you can open the ts file in mplayer to watch it while streaming. Now you can play, pause and search.

Now this is recording, but you may want it in a format that other players can use.. this is where ffmpeg comes in.
ffmpeg -i test.ts -target dvd test.mpg will convert the file to a DVD formatted mpg file... look into ffmpeg's man pages for more options here.

C- After B, this is quite easy... using the same tools, this will stream the device from a computer elswhere on the network:
dvbstream -f 538000 -i 192.168.1.2 101 102
where 192.168.1.2 is the IP of the computer you want to watch on.
Now on the client box, run 'dumprtp 192.168.1.2 5004 | ts_filter 101 102 > test.ts' to stream it to a file, or 'dumprtp 192.168.1.2 5004 | ts_filter 101 102 | mplayer -' to stream it directly to a player. If your network's not the most stable you can cache the stream with 'dumprtp 192.168.1.2 5004 | ts_filter 101 102 | mplayer -cache 2048 -'

You can also stop the stream on the server side and start a new channel without stopping the player... just remmember to forward the PIDs to those already being used like this:
dvbstream -f 578000 -i 192.168.1.2 501:101 502:102

You can also let the stream run for any pc to use but I have a feeling you need a powerfull network, better than wireless which mine's on, but the command is simple:
dvbstream -f 538000 101 102 to stream and
dumprtp | ts_filter 101 102 | mplayer -cache 2048 - to watch.

(just in case you need to know, the port used by default here is 5004)

OK, that's it for now... some time I'll look into scripts to streamline this or maybe getting one of the media centre apps working, but this is very stable and looks pretty cool so I'm not bothered right now.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home