Record "DreamBox dm 500 S" On Linux Over HTTP Stream
Version 1.0
Author: Mohamad Rashad www.mrashad.com
Last edited Sun, 7 Jun 2009
This "short HowTo" shows how to watch, record and convert TV shows on-the-fly from "DreamBox" using the "HTTP" streaming service on a PC runing Linux OS. The "DreamBox" is a satellite receiver that has a NIC and you can access it using a web interface to watch and control it.
1- Preliminary Note
I'm using these tools:
- DreamBox dm 500 s
- Linux machine running "Ojuba 2", Arabic distribution Fedora 10 based
- Linux tools "wget, mplayer, ffmpeg, tee"
2- Preparing
When you attach your DreamBox to your network it will get a IP if you have a DHCP server (or DSL modem on your home network); if not, you can set the IP manually using your OSD (On-Screen-Display). If you are able to ping it you are ready. :)
From now on I'll use the IP 192.168.1.3 as my DreamBox IP.
3- Knowing the basics
DreamBox provides a stream TCP/IP server to access the TV channels, each channel in your DreamBox has its own HTTP address. You can find it out using the DreamBox web interface like this:
1- Open your DreamBox in your web browser:
http://192.168.1.3
2- Go and find your targeted channel.
3- Double-click on it and make sure it is appears on your TV.
4- Find and click the VLC icon in your web interface.
5- Download the m3u file (don't watch it now please).
6- Open the m3u file using any text editor (gedit as an ex.) and it will look like this:
http://192.168.1.3:31339/0,0105,0205,02bc,0085
4 Watch the show
You can copy and paste the channel address into any media player and it should run it, in my case I love to run it using mplayer from the terminal like this:
mplayer "http://192.168.1.3:31339/0,0105,0205,02bc,0085"
5 Record the show
You can record the show using "wget" like this:
wget "http://192.168.1.3:31339/0,0105,0205,02bc,0085" -O file_to_save_record.ts
The "-O" option is to save the output in a file using "file_to_save_record.ts" as its name, the stream comes in "TS" format and in "MPEG2" video codec and "MP3" audio codec.
6 Convert the show
The stream comes in a high quality so it takes much disk space so you may want to convert it on the fly, you can do that like this:
ffmpeg -i "http://192.168.1.3:31339/0,0105,0205,02bc,0085" file_to_save_record.mpg
For sure you can use your own ffmpeg switch to do more jobs if you need to, the command just like this will save you around 80% of the record disk space.
7 Watch, record and convert on-fly
If you like to record the show and watch it at the same time you can do it like this:
wget "http://192.168.1.3:31339/0,0105,0205,02bc,0085" -O - | tee file_to_save_record.ts | mplayer -
The "-O -" tells the "wget" to send the output to the STDOUT instead of a file, and the "tee" command copies the input that comes from the pipe into the file "file_to_save_record.ts" and sends it to STDOUT again, after that "mplayer" takes its input from STDOUT because we used "-" as the file name.
And you can save it in two different formats (the orignal TS and any other) like this:
wget "http://192.168.1.3:31339/0,0105,0205,02bc,0085" -O - | tee file_to_save_record.ts | ffmpeg -i - file_to_save_record.mpg
Again we use "-" as the input file so that "ffmpeg" gets its input from STDOUT.
8 Watch, record and convert on-the-fly (my way)
The previous way is not my favorite, I used to do that like this:
1- Record the show like this:
wget "http://192.168.1.3:31339/0,0105,0205,02bc,0085" -O file_to_save_record.ts
2- Then run another command to watch it, like this:
tail -f file_to_save_record.ts | mplayer -
What that command does is to give you the last recorded part of the show and send it to "mplayer" so you can watch it, it works as much as you record from your DreamBox, this way gives you more options than the previous one, first you can pause the show if you like to get a cup of coffee, second you will be able to forward the show to skip an advertisement or some silly part (just if the live one had passed it).
And you can use the same method for the converted files too, like this:
1- Record and convert the show like this:
ffmpeg -i "http://192.168.1.3:31339/0,0105,0205,02bc,0085" file_to_save_record.mpg
2- Then run another command to watch it, like this:
tail -f file_to_save_record.mpg | mplayer -
9 Thank you.
This is my first "HowTo" at all, so I'll be very happy and thankful if you find any notes and tell me, and this is my first time to play with streaming and media converting, too, so any enhances will be helpful, too.
I do appreciate all suggestions.
Finally I want to thank Mr. Safwat Akl for his help and encouragement.
Have fun!