In this tutorial I explain how you can use Mythtv (a free Media Center software for Linux) with A1 TV (an Austrian IPTV service), formerly known as aonTV). Why do you want to do this when you already have a working Settop Box sitting under your TV? Mythtv turns your PC into a digital recorder with the following features:
The tutorial basically shows how I configured my system and does not claim to be the only or most elegant solution. It still is your own risk to follow my example. The tutorial covers different aspects, which may or may not be relevant for your own setup. The provided link literature should in any case point you towards the right directions for problem solving. You should definitely check it if some of my comments are not so clear to you.
For the operating system, I now use Mythbuntu 11.10 (get it here). Mythbuntu gives you the advantage of installing a lightweight Mythtv installation right away - lightweight because it is using Xfce instead of Gnome.
The basic installation of Mythbuntu is easy. The only thing which requires your brain is the partitioning. Since 1 hour of recorded video is approximately 1.3 gigabyte you should have enough space. My filesystem consists of a 10gb system partition on / (ext4), 1gb swap space, the rest (ext4) for /home. The larger harddrive sdb1 250gb is mounted at /home/mythtv and also formatted to ext4. This is the place where I want Mythtv to store its recordings.
During the installation of Mythbuntu the basic settings for Mythtv are configured. Choose primary backend with frontend when asked. You may already enable the propietary driver for your graphics card if available. Most parameter can be defined later on in the Control Center, so I suggest skipping them for the moment.
For best results connect your PC to the TV using a HDMI cable. check if your display is configured correctly. I needed to change my resolution manually to 1920×1080 using Nvidias system tool by choosing the correct resolution and writing it to the X Conf File. Additionally, make sure you installed all system updates. This may take some time…
For a standard Ubuntu installation I recommend to use the Mythbuntu Control Centre, which makes the various options easily accessible. Install the package mythbuntu-control-centre by opening a terminal and running sudo apt-get install mythbuntu-control-centre.
First of all, you should check if you can watch A1 TV with your machine. Connect it to the router via LAN cable, download this http://download.alitility.com/vlc_aontv_livetv_0911.m3u ??file and try to open it with vlc. It takes some time until the stream opens! if you can watch TV this way we can move on.
A static IP will make your life easier, because your mythbox can always reached with the same address in the network.
screenshot ??
Before we start with configuring Mythtv, two more items need to be dealt with. First, a channel list for A1 TV programs is required - here is mine http://download.alitility.com/mythtv_a1tv_channels_1112.m3u (alternative with HD channels http://www.h0552473.net/a1tv/a1tv-mythtv.m3u by Hannes). Customize it to your needs. For explanation, the @ sign is not needed for mythtv but for vlc. In addition, the XMLTVIDs I use in my file are only relevant for people who want to use the xmltv grabber for the Electronic Program Guide.
Second, it is a good idea to create directories, where Mythtv stores its recordings. Create the directories on a larger partition: one directory for livetv and one for recordings. In my case I created /home/mythtv/livetv & /home/mythtv/recordings.
sudo mkdir /home/mythtv/livetv; sudo mkdir /home/mythtv/recordings
Please keep in mind that the Mythtv Backend is run by the user mythtv and not by your own user account. As a result, the user mythtv needs read and write permissions for these directories:
sudo chown -R mythtv /home/mythtv/livetv; sudo chgrp -R mythtv /home/mythtv/livetv;
sudo chown -R mythtv /home/mythtv/recordings; sudo chgrp -R mythtv /home/mythtv/recordings
sudo chmod 775 /home/mythtv/recordings; sudo chmod 775 /home/mythtv/livetv
Adjust the path and the user to your situation! The result should be owner and group: mythtv, allowed to create and delete files.
http://download.alitility.com/mythtv_a1tv_channels_1112.m3u or the one provided by Hannes which includes HD channels as well http://www.h0552473.net/a1tv/a1tv-mythtv.m3u. If you have the .m3u file on your PC, point to it in the form of file://home/...
create a new Video Source, name the source “A1TV” (you can be creative here), but select no grabber for the moment.
The time has arrived to test your new Media Center. Start the frontend and hit Watch Livetv! The first channel should show up after little delay. Test as well the mythweb plugin by starting your browser and directing it to this link: http://localhost/mythweb (remote machines use the Backend's IP instead of localhost, e.g. http://10.0.0.2/mythweb). Why not start your first test recording? Go to mythweb and schedule a recording for a certain channel in the near future… leave your mythbox running… and then check if the recording worked. It did? Perfect!
If you cannot connect to a remote backend, then its MySQL installation is most likely not configured for remote connections. To change this:
sudo gedit /etc/mysql/my.cnf# sign at the beginning of this line) # bind address = 127.0.0.1
sudo /etc/init.d/mysql restartThe EPG used by the Aontv settop boxes is at the moment not to accessible by Mythtv - so we need to improvise. epgdata.com offers legal EPG data for an annual charge of 18 Euro. The service is quite comfortable and the configuration is easy with MythTV. However, note that not all TV channels of A1 TV are provided by both grabbers featured here (e.g. Puls 4).
sudo apt-get install xmltv build-essential checkinstall libxml2-utils unzip
Another (cheaper) workaround is the usage of a free xmltv grabber, I tried: the TV Movie grabber. First of all, install some packages needed for using xmltv and compiling the grabber:
sudo apt-get install xmltv build-essential checkinstall libxml2-utils unzip
tar xzf tvmovie-xmltv-1.2.tar.gz
In the tables.cpp, the channels for the grabber are defined. The easiest way is simply to replace the file with this one http://download.alitility.com/tables_aontv.cpp or the one provided by Hannes including Servus TV and Puls 4 http://www.h0552473.net/a1tv/a1tv-tables.cpp.
Alternatively, you can configure the grabber's channel list yourself. Each channel needs to be configured with an XMLTVID in the grabber and in the mythtv database. What we want to achieve is that the XMLTVIDs of the grabber match the XMLTVIDs of Mythtv, so the right program information can be linked to the right channel. In the file tables.cpp the XMLTVIDs of the grabber can be included. It is easy to edit the file with a standard text editor. Look at the already configured entries in the file and start to make your own; remove the entry NULL and insert your XMLTVID instead, e.g.
{ "Arte", NULL, "" , "010" }
{ "Arte", "arte-tv.com", "" , "010" }
Of course, only the channels provided by A1 TV should get an XMLTVID (so remove unnecessary entries).
On the Mythtv side, XMLTVIDs can be entered and changed in the Channel Editor of the Backend. Following the above example, the XMLTVID for the channel Arte becomes arte-tv.com. XMLTVIDs may already be set in the .m3u file for Mythtv. If you used my .m3u file you can also use my tables.cpp, as the entries are already made and match those of my m3u file.
Once you replaced the tables.cpp, open a terminal, move into the newly extracted directory and compile the grabber by running (English howto, German howto):
./configure
make
sudo checkinstall
yNow, the grabber is compiled and installed. Next, start the Mythtv Backend Setup and select Video Sources:
all and press Enter here, in order to include all configured channels at once.mythfilldatabase yourself in a terminal) - This command loads the program information to the Mythtv database.Open a browser and surf to your web frontend. Click on Listings. If you see the names of lots of TV shows for the different channels, you did it!
For downloading EPG data automatically, enable the Automatic run mythfilldatabase option in the frontend Utilities > Setup > General. I changed the mythfilldatabase Program command to mythfilldatabase from usr/bin/mythfilldatabase. You may also disable the Run mythfilldatabase at time suggested by the grabber and define the time and frequency the grabber should run.
If the times of the TV show listings are not displayed correctly: open the backend setup, select General and change your local time zone to auto (or configure the hours manually if that doesn't work).
(?? Samba+Mythbuntu /etc/samba/smb.conf - path videos in backend and frontend)
.avi from the default command to Internal (Utilities > Setup > Media Settings > Video Settings > File Types)You probably don't want to stand up from your convenient couch and start your mythbox by using your own hands - how oldschool! After a few modifications, you are able to start your PC via network (English howto, German howto).
* not needed anymore
sudo apt-get install ethtoolethtool -s eth0 wol g
in /etc/rc.local between # By default this script does nothing. and exit 0 - while eth0 being the card reachable in the LAN!
NETDOWN=yes to NETDOWN=no* not needed
ifconfig in a terminal and note the MAC address of the device you want to wake up#!/bin/bash wakeonlan 00:0c:6e:34:0f:08
One of the first things I deselect is to automatically launch the frontend after reboot - this is not nice if your system is supposed to shutdown automatically.
One of the disadvantages of the mythbox is that it must be running for recording. A 24/7 server is neither environmentally friendly nor economically friendly and it is not necessary. You can configure your mythbox to wake up just a few minutes before a recording is scheduled. Your motherboard has to support this feature, but hardly any modern motherboards is not capable of waking up by alarm. For boards manufactured after 2000 the wakeup at a specific time and date should work. Furthermore, the mythbox can be configured to automatically shutdown, if it has nothing to do - how nice!
See those links for further information on ACPI wakeup:
http://www.mythtv.org/wiki/ACPI_Wakeup
http://www.vdr-wiki.de/wiki/index.php/ACPI_Wakeup
https://help.ubuntu.com/community/MythTV/Install/WhatNext/ACPIWake - good article but outdated method: /proc/acpi/alarm
In my case only the old method of NVRAM is supported (I have an asus p4pe). I can therefore only report about this outdated method, which you can try if you are not successful with the approach presented above (more info here and here):
sudo nvram-wakeup -D and see if the motherboard is recognized - For the possible problem with /dev/nvram: nvram should be enlisted in the /etc/modules file followed by a restart.Check, if it works by setting the wakeup time to 10 minutes in the future :
/usr/sbin/nvram-wakeup -s $((`date +%s` + 10 * 60))
If you have troubles with permissions for /dev/mem then you probably need to use sudo.
So far so good. If the wakeup command requires administration rights, the mythtv user must be equipped with some special rights.
sudo visudo in a terminal %mythtv ALL = NOPASSWD: /sbin/halt, /usr/sbin/nvram-wakeup
to the very last line of the file. These are the commands for shutting down and for setting the wakeup alarm for the mythtv user. While editing the file make sure there is just one entry of mythtv (reference). Here is a sample:
# /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # Defaults env_reset # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL) ALL # Uncomment to allow members of group sudo to not need a password # (Note that later entries override this, so you might need to move # it further down) # %sudo ALL=NOPASSWD: ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL %mythtv ALL = NOPASSWD: /sbin/halt, /usr/sbin/nvram-wakeup
It's now time to configure Mythtv under Utilities > Setup > General.
time_t for the nvram method and the command to set wakeup time is sudo /usr/sbin/nvram-wakeup -s $(($time +300)). sudo shutdown -h now. In any case, take a look at the provided screenshot and read the explanations for the available options in Mythtv.
# # MythShutdownCheck # # checks to see if any other user is # logged in before idle shutdown # # returns "1" if yes, stopping shutdown # returns "0" if ok to shutdown # # to not shutdown during mythcommflag process, uncomment the following line # ps ax | grep -v grep | grep -q mythcommflag && exit 1 if last | head | grep -q "pts/.*still logged in" # check for active *remote* login? then exit 1 else exit 0 fi
this code originates from: https://help.ubuntu.com/community/MythTV/Install/WhatNext/ACPIWake
* save it to a new file called: 'checkmeifyoucan'
* make the script executable
chmod +x MythShutdownCheck
* copy it to /usr/sbin:
sudo cp MythShutdownCheck /usr/sbin
* adapt the permissions with
sudo visudo
and add the command /usr/sbin/checkmeifyoucan to the already added line.
What is missing for a true media center is a remote control. I recommend buying your own on the internet, but be sure to check for its compatibility with linux i.e lirc. I've bought a USB remote control for one of Microsoft's Media Center software, which I highly recommend (http://www.mythtv.org/wiki/MCE_Remote & http://www.oneweb.co.uk/mythtv/2009/02/configuring-your-mce-ir-remote/). English lirc howto German lirc howto.
In my case the configuration was easy using the Mythbuntu Control Centre. Under Infrared Devices select the configuration files for your remote; mine Windows Media Center remotes.
Customize the remote buttons to your hands. First, you must find out how the remote's buttons are recognized by your system. This information is found in the file /etc/lirc/lircd.conf. It is possible that this file only holds links to other configuration files of remotes, which you should read instead! In those .conf files a name is allocated to each button's infrared code, e.g.
begin codes
input 0xD02F
energy_saving 0xA956
power 0x10EF
tvradio 0x0FF0
av_mode 0x0CF3
one 0x8877
Similarly, in the ~/.lircrc file the buttons' names are allocated to actions or again links are provided to the actual files (e.g. the .lirc directory). In essence, the .lircrc defines what happens when a certain button is pressed. Each program may have its own file, per default mythtv's lirc commands are set in ~/.lirc/mythtv. Have a look at mine. As you can see, important variables are the name of the remote, the program the command is executed in, the button pressed and the action to execute. Just follow the example and use the keybindings of Mythtv for your own customized remote.
These keypresses are only active if mythfronted is running. If you want to start the program with the remote, you can use the irexec program, which simply executes commands on keypresses.
begin remote = mceusb prog = irexec button = Home config = mythfrontend & end
The & sign is necessary to make irexec available during Mythtv. Then start irexec as daemon process by running irexec -d and let the system launch irexec after startup (list it under System > Preferences > Startup Applications in Ubuntu and under System > Session and Startup with the command irexec -d).
You have external devices like your TV or an amplifier you want to control with your mythbox's remote? With the necessary hardware (IR eye, transmitter), you can pass on custom IR commands to these devices. Just plug in your IR eye and point it to the IR receiver of your device in short distance.
include "/usr/share/lirc/remotes/custom/custom.conf"
sudo /etc/init.d/lirc restart
and start irexec again by running
irexec -d
(if it isn't already running)
irsend SET_TRANSMITTERS 1 irsend SEND_ONCE RM-S325 vol+
adjust the number of the transmitter, the name of the remote (here: RM-S325) and the name of the button (here vol+). You should now see some reaction of the device.
#!/bin/bash irsend SET_TRANSMITTERS 1 irsend SEND_ONCE RM-S325 vol+
begin
remote = mceusb
prog = irexec
button = VolUp
config = /home/stefan/Desktop/louder.sh
repeat = 0
delay = 0
end
For setting up an Internet and an IPTV connection, I use 2 network cards. Other scenarios with different router firmwares are possible. Since only the firmware 8.6.9.0 for the Thomson Speedtouch 585v7 was running flawlessly for me, I chose to buy a network PCI card for less than 10€. If you have a newer firmware you do not need the second network interface! However, please note that Aontv currently only allows two IPTV streams, and only if you own two settop boxes. You can watch a show with one settop box and record another program with your mythbox.
You can find out if you are able to watch IPTV and Internet with the same connection by trying to open this .m3u playlist with VLC. It often takes some time until the picture comes up, so don't be too impatient. If you don't see anything you should proceed with the method outlined below or maybe update the router's firmware further reading.
The plan is to have one card accessing the Internet while the second card uses the IPTV stream. As a consequence, the different areas for each card need to be defined, i.e. by creating static routes. Additionally, the two cards need to get static IPs for being identifiable. So let's start:
ifconfig. Your output should be similar to this one:stefan@earl:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:24:01:31:71:8b
inet addr:10.0.0.38 Bcast:10.0.0.255 Mask:255.255.255.0
...
eth1 Link encap:Ethernet HWaddr 00:0c:6e:34:0f:08
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
...
sudo apt-get install vlc) and try the following .m3u playlist with it. The channels should show up after some time. Check also if the internet is working while watching TV. The final test is a restart… just to make sure! - Congratulations!
http://osalliance.com/netculture/project/multimediahome/summary - osalliance - where I learned about mythtv+aontv
http://lab.netculture.at/wiki/doku.php?id=utopia:mythtv#myth_server_lab_dornbirn - net culture lab wiki - valuable infos
http://www.dieschmids.at/ - fantastic site for aon and aontv related topics
http://xdsl.at/viewtopic.php?f=59&t=46556 - windows solution for static routes of aontv and internet
http://www.aontv.org/ - aontv wiki, check out the forum
Discussion
Hallo!
eine aktuelle A1TV HD Senderliste für Mythtv: www.h0552473.net/a1tv/a1tv-mythtv.m3u
eine aktuelle tables.cpp für den “tv_movie_grabber” inkl. (Puls4, Servus TV,…): www.h0552473.net/a1tv/a1tv-tables.cpp
lg, Hannes
sorry, anbei die korrekten Links:
aktuelle A1TV HD Senderliste für Mythtv: www.h0552473.net/a1tv/a1tv-mythtv.m3u
aktuelle tables.cpp für den “tv_movie_grabber” inkl. (Puls4, Servus TV,…): www.h0552473.net/a1tv/a1tv-tables.cpp
lg, Hannes
cool, danke. bau ich in den artikel ein.
lg, st
anbei noch eine Übersicht, für welche Sender der “tv_movie_xmltv_grabber” derzeit Informationen hätte: www.h0552473.net/a1tv/grab_tvmovie-clickfinder_senderliste.ods
lg, Hannes
PS: Für ORF III & ORF Sport Plus stehen derzeit leider keine Programmdaten zur Verfügung, vl. könnte man ja bei TV Movie etwas “Druck” ausüben! .g.
Bei mir funzt soweit alles, nur dass die Senderliste veraltet ist. Wenn ich sie downloade und auf meinen Webserver hochlade, geht komischerweise gar nix mehr. Auch wenn ich garnix verändere. Es geht also nur mit der URL hier in der Doku. Weiß jemand wieso? Bzw. wie ich die aktuelle Senderliste mit den neuen IPs importieren kann? Fernsehen am PC via VLC klappt soweit perfekt.
jaja muss erst mal wieder meine senderliste updaten… aber im prinzip sollte man die ips aktualisieren können und die datei auch lokal abgespeichert in mythtv importieren können.
Die Liste gibt es hier zum Download: http://www.aontv.org/wiki/AonTV_Informationen Jedoch kann man diese nicht verwenden. Ich habe sie mit deiner Liste zusammengeführt, aber es geht einfach nicht. Im Mythtv kommt kein einziger Sender in die Liste
Ic hhabe auch die @vor der IP entfernt usw…
Vielleicht kannst du mir einen Tipp geben. Gerne maile ich Dir die Liste wenn Du sie brauchen kannst. Schreib mir an gernott[at]gernott[dot]at
Also bei mir hat es folgendermaßen geklappt:
1. Mit einer lokal gespeichert *.m3u habe ich es nicht geschafft.
2. Ich habe die 'mythtv_aontv_channels_1002.m3u' heruntergeladen,
Jetzt werde ich mich meinen Baustellen Ton, Skalierung, Fernbedienung, TV-Programm widmen …
Leider funktioniert bei mir des scan der Sender bei Aon-Tv nicht keine ahnung warum
hat bei mir auch mal probleme gemacht… kommt eine fehlermeldung?
Nice post, thanks for writing!