adding BBC live streaming to MythTV
By hrabbach
What is BBC live streaming?
Internet users from the UK (and in other places if they route traffic through a VPN connection to the UK) can watch the various programmes the BBC broadcasts in real time on their computers. Normally, an Adobe Flash media player applet embedded in the BBC website is used for this purpose. BBC One to BBC Four and BBC News 24 are all available in this way, although certain shows and movies may not be viewable due to the BBC not having streaming rights for them. So it's not a complete replacement for watching the BBC over satellite, cable or Freeview, but if you want to watch the BBC on the MythTV box without having to add a TV card - or if you are abroad and can make a VPN connection that gives you an IP address in the UK - then it's relatively simple to add the streaming service to MythTV with the help of a few tools.
Prerequisites
This tutorial has been written based on the Mythbuntu 9.10 distribution, but it should also work with any other Linux system with MythTV installed. Mythbuntu 9.10 includes MythTV 0.22, which has a slightly different menu structure than 0.21, so you may need to adapt this if you still run the older version.
You should have your MythTV fully configured for this, as well as a working internet connection with a UK IP address. This works through a VPN, but that's really outside of the scope of this document.
Installation
We will use the wonderful get_iplayer tool to enable streaming straight to the Linux box, rather than having to use the flash player. get_iplayer also needs the flvstreamer tool to access the live streams and mplayer to play them. Download links for the latest versions can be found below.
After installing get_iplayer and flvstreamer, log into your MythTV box as the user that you run MythTV as. On my machine, that's a user called "mythtv", it may be different on yours. Change to that user's home directory and then to the .mythtv/ directory within it (note the dot at the beginning of the directory name, it's a "hidden" directory). Here we create the menu - let's call it "watch_bbc.xml" - and fill it with the following content:
<?xml version="1.0" encoding="UTF-8" ?>
<mythmenu name="WATCH_BBC">
<button>
<type>TV_WATCH_BBC_ONE</type>
<text>BBC One</text>
<description>watch live TV streamed from BBC One</description><action>EXEC get_iplayer --stream --modes=flashvhigh,flashhigh,flashstd --nopurge --type=livetv "BBC One" --player="mplayer -vo xv -cache 512 -fs -stop-xscreensaver -zoom -"</action>
</button>
<button>
<type>TV_WATCH_BBC_Two</type>
<text>BBC Two</text>
<description>watch live TV streamed from BBC Two</description> <action>EXEC get_iplayer --stream --modes=flashvhigh,flashhigh,flashstd --nopurge --type=livetv "BBC Two" --player="mplayer -vo xv -cache 512 -fs -stop-xscreensaver -zoom -"</action>
</button>
<button>
<type>TV_WATCH_BBC_Three</type>
<text>BBC Three</text>
<description>watch live TV streamed from BBC Three</description> <action>EXEC get_iplayer --stream --modes=flashvhigh,flashhigh,flashstd --nopurge --type=livetv "BBC Three" --player="mplayer -vo xv -cache 512 -fs -stop-xscreensaver -zoom -"</action>
</button>
<button>
<type>TV_WATCH_BBC_Four</type>
<text>BBC Four</text>
<description>watch live TV streamed from BBC Four</description> <action>EXEC get_iplayer --stream --modes=flashvhigh,flashhigh,flashstd --nopurge --type=livetv "BBC Four" --player="mplayer -vo xv -cache 512 -fs -stop-xscreensaver -zoom -"</action>
</button>
<button>
<type>TV_WATCH_BBC_News</type>
<text>BBC News 24</text>
<description>watch live TV streamed from BBC News 24</description> <action>EXEC get_iplayer --stream --modes=flashvhigh,flashhigh,flashstd --nopurge --type=livetv "BBC News 24" --player="mplayer -vo xv -cache 512 -fs -stop-xscreensaver -zoom -"</action>
</button>Once this menu has been created, we now need to add it to the main menu. Fortunately, menu files in the .mythtv/ directory override the default menu, so we just need to copy the default menu file there and change it as necessary. In Mythbuntu, there are four "mainmenu.xml" files for the different menu layouts Mythbuntu offers. They can all be found in /usr/share/mythtv/themes/ in the DVR, classic, defaultmenu and mediacentermenu directories. Copy the mainmenu.xml file from one of these directories (the one corresponding to the menu layout you are using) to /home/<username>/.mythtv and edit it. Add the following in the place you would like to see the BBC menu appear:
<button>
<type>MENU_WATCH_BBC</type>
<text>Watch BBC live</text>
<description>watch live TV streamed from BBC</description>
<action>MENU watch_bbc.xml</action>
</button>Save the file, restart MythFrontend and new menu item should appear in your main menu that takes you to the BBC streaming submenu, where you can select the channels you configured. There may be a short startup delay before the video is shown, this is due to the buffering. If you have set up lirc correctly, you can even use the play/pause button to pause the live video.
Where to find the downloads
- get_iplayer for Debian/Ubuntu/Mythbuntu
.deb package for installation on Debian/Ubuntu based systems. I use this one for Mythbuntu. Check back for updated versions regularly - flvstreamer for Ubuntu
The flvstreamer tool is now included in Ubuntu. You can download it here or use apt-get to install it. - get_iplayer and tools download for other platforms
here you can find the various downloads available to install get_iplayer on different platforms. If you don't run Mythbuntu or Ubuntu, this is where you can find RPMs or the source code
Comments
I'm not sure I'd do it this way, but I'm glad my howto helped you do it. I just let get_iplayer download to a directory in my video player path and the internal mythtv player is quite happy to play the downloaded files.
Just a note: Try replacing '--vmode flashhigh' with '--modes=flashvhigh,flashhigh,flashstd' because --vmode is deprecated and I'm not even sure it has any effect on livetv mode. BBC One also has 3 different bitrates. You might also want to add --nopurge otherwise you might geta lot of processes hanging around.
Thanks Phil, I'll do that and update this howto.
Note to readers: Phil knows what he's talking about, he's the author of get_iplayer :)
Great, Thanks a lot Phil. your hub helps me.
Is this still working? I have just tested successfully with BBC One and Two, but the rest don't seem to work.
Yes, it still works - but you may have to install the updated version from http://www.infradead.org/get_iplayer/html/get_ipla and the rtmpdump tool to be able to watch all channels. Hope this helps...
You are right; it does work with 2.79; I had 2.78. Thanks so much.
You just need to remember to add the to the end of the watch_bbc.xml file otherwise it complains that the file is incomplete when you try to select it from the main menu - all working fine for me with the latest MythBuntu, thank you very much for an excellent how to that solves my problem with viewing iPlayer through MythTV
Dan 2 years ago
Nice! Thanks for this. Based on your howto, I was able to create a similar tweak but for iPlayer downloads rather than iPlayer live streams: http://www.mcld.co.uk/blog/blog.php?286