Thursday, June 5, 2014

Turning my old Intel Atom 330 PC into a Dreambox transcoding server

A few weeks ago I booked my holiday to France. This takes place during the World Cup Soccer Tournament in Brazil. Because I'm a huge soccer fan and I don't know if there are TV's with the right (sports) channels in the accommodations where I'm staying ( this happened before! :-( ) I investigated the possibility to use my Dreambox at home to serve a stream over the internet and watch it on my Tablet or Smartphone.

After doing some research on Google I came across some commercial Windows applications that do transcoding and are manageable on other devices. But since I don't run Windows these applications aren't useful for me. For Linux I found out that VLC and FFmpeg are capable to do the transcoding task. I tested these applications directly with the Dreambox streams over http and this worked like a charm. The only benefits of VLC is that it has a http streaming server in it and FFmpeg requires an extra setup to act like a http streaming server. So the VLC option is, in my case, the easiest.

Another challenge was to get the transcoding process stable and usable on my old Intel Atom 330 PC (my Dreambox doesn't have a transcoding chip so this can't be done on my Dreambox directly) which is always running and act as a home server. Because transcoding is a very CPU intensive process this can be an issue. After a lot of tweaking of the VLC transcoding parameters I finally managed to get a poor quality, but usable over low bandwidth!, stream which is acceptable to watch on my Tablet and Smartphone. I also tested this on my Cubietruck which has a dual-core ARM Cortex-A7 CPU, but without success. The ARM CPU is to slow to produce the poor quality stream with the same VLC parameters. Maybe the Radxa Rock Quad board does (it has a ARM Cortex-A9 Quad Core CPU), but I don't own it so I can't test it (please let me know if it does).



So having the stream running it's time to find a way to easily change channels and launch VLC to do the transcoding process. Then the idea came up to start the OpenETV (Open Enigma TV) project. The basic design of OpenETV is to talk to the Dreambox Enigma2 webinterface and control VLC. This all needs to be tied through a webinterface so it can be controlled on every device with a webbrowser on it.

I decided to write the project code in Python because of time issues (I only have a couple of evenings) and portability to easily use it cross-platform (there are many Dreambox owners who use Windows so they also can benefit of this project). By now all the basics mentioned above are implemented in OpenETV and I already use it on my Smartphone and Tablet over a VPN to my home network. It can be controlled with the build-in web interface and it's possible to watch the streams with, for example, VLC.

So bottom line: I'm now ready for my vacation! ;-)

For those who want to try/use it, I made it Open Source (GPL2/3 licensed) and it's free downloadable on GitHub:

The project page is located at:

Below is a simple setup description on how to install and use OpenETV on CentOS 6 or Fedora 20. This is also covered in the project README. If you want to run it on other distro's the steps below are similar except for the package installation part.

Because of time issues OpenETV does not support the following important features:
  • Enigma username/password authentication
  • OpenETV web authentication

I will add them later or feel free to do it yourself and send me a patch :-)


Setup and run OpenETV on CentOS 6 or Fedora 20

To install the VLC packages on CentOS 6 you need to add the rpmfusion repo:
$ sudo yum localinstall --nogpgcheck \
http://download1.rpmfusion.org/free/el/updates/6/x86_64\
/rpmfusion-free-release-6-1.noarch.rpm

If you are running Fedora 20 do the following to add the rpmfusion repo:
$ sudo yum localinstall http://download1.rpmfusion.org/free\
/fedora/rpmfusion-free-release-20.noarch.rpm

Install the VLC rpms:
$ sudo yum install -y vlc

Install the required Python libs:
$ sudo yum install -y libxml2-python

Get the OpenETV application:
$ git clone https://github.com/joeyloman/openetv.git

Configure OpenETV:
$ cd openetv

Edit openetv.py with your favorite editor and configure the following options:

Transcoding options:
As mentioned above, transcoding is a heavy CPU intensive process so you need a PC with enough power to suit your needs. In the source code header there are 2 transcoding options in the VLC stream section, named vlc_stream_options:
  1. Poor quality (this one I use on my old Intel Atom 330 fileserver and stream it over a 3G network to my Smartphone)
  2. Good quality (this one I tested on my Macbook Pro Core i7)

Choose one of them by comment/uncomment the selected option. Or if you have other needs you can configure the VLC stream options by yourself.

Enigma host:
Make sure the Enigma WebIf is enabled on your Dreambox or clone. If so, configure the ip address and the tcp port of your device in the following options, for example:

enigma2_host     = "192.168.0.5"
enigma2_port     = 80

Start OpenETV:
$ ./openetv.py start

Note: it's not recommended to start openetv as root. Instead create a service account and run openetv with reduced privileges.

Launch your browser and go to:
http://<openetv-host>:8081

Select your bouquet and channel, and click on the "start stream" button. Then launch, for example, VLC on your client device and connect it to:
http://<openetv-host>:8080

If something went wrong you can check the openetv.log file for errors. If it doesn't have enough information you can set the debug flag in openetv.py to 1 and restart it. Then repeat the browser steps and recheck the logfile for more details.

Note: OpenETV does not support Enigma user authentication at the moment. If it's enabled on your device it cannot get the bouquets.

1 comment:

  1. Hi, nice to meet you, I am studying some information about Enigma2. And I found you blog. May I learn several questions?

    I use ubuntu 14.04 to run your OpenETV.
    1. The openetv-host means the current PC who runs the OpenETV tool?
    2.Could I launch my browser on another PC, not current PC who is running the OpenETV tool?
    3. Is the VLC treated as streaming server which send the stream data to your mobile phone or tablet?
    4.I don't understand where the VLC get stream? from STB or ?
    (Sorry , I still don't know how do you watch the TV via your tablet or mobile phone. why do you need to use VPN? )
    5.Should I modiy some settings in the config.ini. likes
    bind_host=192.168.1.219
    vlc_http_stream_bind_addr=192.168.1.219

    current the IP of my ubuntu is 192.168.1.219 and openETV is running on it.

    ReplyDelete