A friend of mine, who helps running a very small TV network in my city, asked me if I could help finding a affordable solution to a problem he had. He needed to connect two studios using a ~20Km wireless bridge, in order to make it possible for a studio to stream live video to the other. The receiver was required to have an analog output (example: SCART), so that it could coexist with other equipment. Since I love Dreambox I gave it a try 😉
Let’s start with some ingredients for our recipe:
- A Dreambox (I’m using a DM600PVR with no HDD, but any Dreambox with an ethernet adapter should work)
- Gemini Firmware Image for your Dreambox version
- VLC Media Player for Windows (>= v 0.8.5)
- A FTP client (example: FileZilla)
- Windows Media Encoder (WME) for Windows (well, I guess there’s no Linux version for that 🙂 )
- VLCF-Final plugin for Gemini firmware
- A camera and the related hardware to connect it to your PC (Firewire HUB, etc.)
A little bit of… background
It took me some time to figure out how to make my camera stream to the Dreambox. I tried many things, including directly streaming from VLC, without using Windows Media Encoder. It didn’t work. If only I had access to VLCF-Final source code, I could find out how to make it work without wasting resources with the WME step. But why it does work when using WME?
VLCF-Final simply acts as a front-end for the VLC instance on your computer (back-end). It tells the back-end to open the file you choose and to stream it to the Dreambox, transcoding it if needed. The file WME is creating is a .WMV file (like old .ASF files): because of the structure of this file, you can start playing it even if it is getting written on, because it was designed to be used on internet web pages, where you don’t have to wait for it to download completely before playing.
Windows Media Encoder basically keeps writing to the end of the file encoded data received from the camera, while VLC reads it (transcodes it) and sends it on the fly to your box.
Now (1), the very first thing you need to do is to flash the Gemini image on your Dreambox. The net is full of tutorials and how-to about that, so I wont go into details. Just use latest DreamUP. When you’re done, (2) you need to configure network settings for your dreambox to connect to Internet. Simply find “Network Settings” menu and fill your stuff in there (yes, that’s a pretty easy operation, I’m not going to get you lost in details now.. if you need help, you can ask here in comments 🙂 ). Once you’re done, reboot the box (3), then press the blue button on your remote and go to Plugins menu. Download the plugin list (4) and look for VLCF-Final plugin. Download it (5). Install the FTP client software on your PC and connect to the dreambox using the IP you assigned to it (username: root password: dreambox), browse to /var/tuxbox/config folder and download vlcf_original.xml to your computer (6). Open it with a text editor (do not use windows notepad, instead use something like PSPad), and change it as follows:
– Pick the first line which contains <server> tag (7): it should look like the one below. Change the ip field to match your PC IP (the one which will stream camera feed)
<pre class="xml:nocontrols:firstline"><server name="set1" ip="192.168.128.12" webif-port="8080" stream-port="9090" user="admin" pass="admin" />
– Pick the first line which contains a <config> tag (8) with the same name field of the <server> line you just modified. Fill in the startdir parameter, which tells VLCF-Final where to find the stream file. It should look like that:
<pre class="xml:nocontrols:firstline"><config name="set1" startdir="g:/" cddrive="f:" />
Upload the file back to dreambox (9), overwriting the one in /var/tuxbox/config (feel free to backup old file) and reboot the box again.
Download and install Windows Media Encoder and VLC for Windows (10). Open VLC and go to Preferences->Interfaces->Main Interfaces and enable (tick) “HTTP remote control interface” (11). Save settings and close VLC.
Test 1: video streaming to dreambox
Run VLC on the PC, and leave it opened. Turn on your Dreambox, press the Blue button, and go to Plugins menu. Run VLCF-Final. Press the Red button (should be bound to “File” action) and a list of files will appear. Yes, that’s the files in the folder you wrote in vlcf_original.xml file! Just select any file, press OK, and it should play 🙂 If it doesn’t display any file, you’ve probably forgot to configure or start VLC on your PC, or messed up with steps (7) or (8). Double check that VLC can open and play the file you’re trying to play as well.
Test 2: camera streaming to Dreambox
Connect your camera to the PC and, if your speakers are ON, you should hear a “din dong” sound. That’s good, camera is connected. Now run WME and go to “File->New” and then, in the Wizards panel, choose “Broadcast a live event” (12). When asked for input devices, select your camera from both video and audio dropdown menus. In broadcast method, be sure to select “Pull from the encoder” method. Next page will prompt for session settings (port to stream on, etc.); we won’t be using this stuff, so just skip it until you reach the bitrates page. In this page, depending on your PC horsepower, choose the desired bitrate. Keep in mind: the lower, the faster! We’re almost done. It will now ask if you want to archive a copy of the broadcast on your hard drive. That’s what you want to do. Be sure to make it create the file in the path you specified in vlcf_final.xml file. Click on “Finish”, and it should start the show. Get to your Dreambox, open VLCF-Final plugin, browse to the broadcast file and play it. Enjoy the show!
This method isn’t exactly perfect or elegant. To tell the truth, it is a real mess 🙂 That’s what can be done to get it working better:
- Tweak WME bitrates to lower latency
- Avoid the use of WME and direct stream from camera using VLC
- Modify VLCF-Final plugin to enable a “Listen” mode, where it just listens for streams without having to manually browse for the stream file
I really hope this stuff will help. If you have any suggestion, problem or you just found a grammar error in my italenglish, don’t forget to leave me a comment down there 😉