Amazon Fire TV, Kodi and TVHeadend

I realised recently that, like most people, I am watching more and more content on demand and that it’s actually a pain to do with Windows 10 and a HTPC.  There are apps for Netflix and various UK providers but there isn’t one for Amazon Video or Sky Go.  Controlling them typically requires a keyboard and mouse and use of various browsers too.  Also, for whatever reason the user experience just isn’t as good either.

I’ve been using Kodi on a Windows machine with Mediaportal’s TV server and it does work, Kodi also works in a lot of places though including the Amazon Fire TV…  I bought one last week and I’ve been damn impressed with it, I thought today I’d try setting up Kodi for live TV and it turned out to be a lot easier than last time.  Installing to the Fire was a breeze, I simply installed it to my phone and used Apps2Fire to install it to the Fire TV over the network after enabling remote debugging in the Fire’s Developer menu.  Amazon have got much kudos from me for making sideloading so easy!

A few years back I tried to use tvheadend on my Linux server, I’ve had a HDHomeRun for years too so connecting a tuner isn’t an issue as it’s network based, but either the software has got tighter or I’ve learned more as it was a breeze today.

I installed tvheadend to my server using this guide and the HomeRun tuners were automatically detected.  I had to change the tuner type to DVB-T as it defaults to cable, under Networks I added my local transmitter then under services clicked “map all” and that was that.  It started to scan for the EPG in the background and found it pretty quick too.

image

A few changes I’ve made are to point my recorded TV and timeshift folders to larger drives, and I enabled timeshifting as it isn’t by default.  This setting is under Configuration –> Recording.

After that I enabled the TV headend DVR plugin in Kodi and pointed it towards my server and job done!  I’ve a Blackmagic DVB-T2 card to install at some point which will give me a few extra tuners and access to HD channels.  It means running a coax cable though and I can’t be arsed with that at the minute.

One content provider I mentioned above was Sky Go, there is allegedly a way of getting it working on the Fire but I’ve not managed it yet.  For now I’ll just plug my laptop into my AV receiver and have done with it.  I don’t use it often anyhow.

I can now access TV from any device connected to the network so plenty of scope to expand in the future, my upload rate is shocking though so unfortunately I likely wont be able to watch TV remotely.  All in all a fun bit of learning and it frees up the motherboard from my HTPC too.  I’ve a few ideas for a winter project for that but for now it’s on the shelf waiting to be used again.

Kodi PVR, Initial Thoughts and Tweaks

I’ve been using Kodi as my PVR for a week now and I’ve discovered a few quirks, solutions and tweaks that have make a big difference to the whole user experience.  Overall I’m increasingly impressed with how Kodi has developed both at it’s core and the addons.  Since my last post Kodi 16 has also released so I’ve upgraded to the RTW version.

Kodi 16 running the Rapier skin.
Kodi 16 running the Rapier skin.

Skin

I spent a while trying out pretty much all the skins Kodi offered through the UI and ended up using Rapier.  It’s pretty minimal but very well laid out, customisable and easy to navigate.  Some of the others we’re nice but this one just felt right.  Hardly a scientific comment but look and feel are important and this one fits the bill.

Timeshift Issues

I kept hitting an issue where the PVR addon would disconnect when I tried to timeshift, I use this feature a lot so it was something I needed to fix.  I’ve only one hard drive in the machine and despite being an SSHD I thought it may be the disk causing the problem.  I’ve heard my colleagues at work talk about RAM disks and as I’m only ever using a couple of GB of the 8GB of RAM my HTPC has it seemed worth a try.  I did a quick search for software and found SoftPerfect’s RAM Disk, installed it, created a 3GB RAM disk and moved the timeshift folder in TV Server Configuration to it and the problems disappeared.  It’s made a massive difference!

Remote Control

I’ve a Media Center IR receiver hooked up to my PC which was great for Media Center but the Guide, Info and similar buttons were WMC specific.  Thankfully this was trivial to fix thanks to the MCRemote addon!  Installation was easy via the addon repository but configuration took me a while, mostly as I didn’t RTFM…

First off, as it edits the registry you’ll need to run Kodi as admin though you’ll only need to do this when updating the settings.  You’ll find it installed in Kodi under programs, open it then select “Apply current settings” and it’ll keymap the guide, DVR, info and other buttons to work in Kodi.  Reboot Windows and you’re good to go.

The only thing not mapped is starting Kodi using the green button, easily done though.  Find the shortcut to Kodi in the start menu, right click and bring up properties.  Under shortcut add a random combination you don’t use anywhere else then open Kodi as an admin.  Run the MCERemote addin, select “Configure MCERemote settings” then find the entry for the green button and voila!

 

That’s it for now, I’ll let my changes bed in and keep track of any other tweaks and will post anything cool as I find it.

Farewell Media Center, Hello Kodi

Farewell WMC, hello Kodi and Mediaportal TV Server.

Out With The Old…

I’ve been a long time supporter of Windows Media Center but it’s always had its quirks and Microsoft announced with Windows 8 that it wouldn’t be developing it further, this is old news.  A shame as I know how much effort went into its development and it was almost a brilliant product.  For live TV it was superb with full HD and MHEG (red button) support along with timeshifting and series link.  Series link is the killer feature for me which non of the open source equivalents have had until now.

WMC was never great at handling libraries of media content or Bluray playback, for that I’ve been running Kodi (formerly XBMC) in parallel for years and a standalone Bluray player.  Kodi has had the ability to act as a PVR for long time but I’d never had any luck getting everything working right.  Where WMC had tuner support built in Kodi relies on a TV backend to handle tuner control with client side plugins to show the EPG and switch video streams which added a complication I couldn’t quite get passed.  Probably a lack of patience on my part if I’m honest but fast forward to today and everything seems to be maturing together, specifically with Kodi 16 RC, Codename Jarvis.  If nothing else I approve of the Iron Man reference!

…In With The New

Jarvis is currently at RC3 and with this update they’ve introduced series link, as this was the only feature I was using WMC for it’s the final nail in the coffin.  I’ve been playing with Kodi as a PVR for a while with two different backends;  ServerWMC and Mediaportal’s TV Server with the TV Server Kodi plugin.  They both worked well but the former has a dependancy on WMC which would prevent updating to Windows 10.  Mediaportal is also still in active development and their TV Server software is very robust.  I’ve used it in the past and it was pretty rock solid, the bit that let it down for me was the Mediaportal interface itself was pretty clunky and even with a lot of tweaking I couldn’t get the experience as intuitive as Kodi’s.

The Solution

As it stands this is the setup I’ve ended up with:

  • Kodi 16 RC3
  • Mediaportal 1.12 TV Server
  • TV Server Kodi Plugin

To install Kodi is simple so I wont cover it here.  For TV Server download Mediaportal and when prompted during setup select the TV Server only option.  You can install the lot if you want to have a look at Mediaportal but it isn’t needed in my scenario.  Finally you’ll need a plugin for TV Server that allows Kodi to connect.  This is as simple as copying the DLL to the plugins folder and restarting the service.  Full instructions that covers all the above can be found here.

Conclusion

Early days yet but so far this combination of software seems to be working a treat.  The big benefit here is that Kodi is under constant development so things should only improve.  Time will tell and I’ll do a review in a month or so after living with it full time.

Lego PVR Case

The new PVR I built back in May didn’t have a case at the time and though I had lofty plans to make a beautiful wooden case with laser cut lid it turned out to be beyond my skills at the time.  Instead I did what any self respecting maker would do and bought a bag of Lego off eBay and built a case using whatever I ended up with.

It was a little tricky as there weren’t many large or even small base plates in the bag but I made do.

The case has a large hole under the motherboard and in the lid, this is to create a chimney effect to help the case keep cool.  To start with I forgot to add feet to allow air to actually get to the underside of the case, after I spotted a few high temperature alerts I realised my mistake.

New PVR

My Humax YouView box died recently and I’ve had a craving to build a new DVR, I’ve still the tuners left over from my previous HTPC the JukeboxHD.

For frequent readers you’ll know I’ve been trying Linux more and more so to start with I tried building a Kodibuntu based HTPC using an old laptop.  After a few days of playing I still couldn’t get my tuners to be picked up so decided to give Mediaportal a go.  I used this on my first HTPC way back when with some success but never for live TV, I have to say it’s come along a great deal as within 20 minutes I was watching live TV from my old HD HomeRun tuners.  I decided that before taking the plunge, and waiting for payday, I ran on the old laptop for a few weeks to make sure it was stable and it was.

It would also give me a few weeks to research the latest options in embedded motherboards as I’d like to build the whole thing, including the case, to replace my now deceased set top box.

Simple requirements; Small, low power (consumption), and fanless.  To use my existing HD tuner, a Blackgold BGT3620, it would also need a PCIe slot.  Functionally it would also need to be able to record a couple of TV channels at once while watching a movie.

After a bit of hunting I came across the ASRock Q1900TM-ITX, a fanless quadcore Baytrail-D motherboard in the Thin-ITX format.  This is the same 17cm x 17cm base as Mini-ITX however this board is only 20mm or so tall!  For a low profile HTPC build it’s difficult to beat.  I was concerned about performance but then came across this video of the Mini-ITX version of board running Windows 8.1 and Mediaportal, it booted to MP so fast I was convinced;

 

For software, Windows 8.1 and Mediaportal 1.11 and the final hardware specs are;

  • ASRock Q1900TM-ITX
  • Corsair Vengeance 8GB RAM (low voltage)
  • Seatgate 1TB SSHD
  • Blackgold BGT3620 tuner
  • Silicon Dust HDHomeRun (first gen)
  • Microsoft eHome IR transceiver

The case is going to be custom built, the design has already begun but more on that in a later post, but for now I can say that boot times are around ~25 seconds from cold to Mediaportal’s homescreen and I can record six shows while watching HD video (1080p) over the network.  Already exceeded expectations and I’ve not even started tinkering yet! For those curious; all six channels were SD, CPU was just over 50% and it was using ~21Watts according to my power measuring plug.  It also using ~21Watts when idle which I need to figure out too.

I have to say, after being initially worried about a Baytrail board I’m not worried any more!

As the case isn’t built yet the “Woody” is currently sitting naked on my coffee table.  The name comes from the design of the new case but I can’t resist double entendre!

The components currently lack a case, I tend not to let that stop me!
The components currently lack a case, I tend not to let that stop me!

For those curious as to how thin Woody’s board is, have a look at it compared to my workphone;

Samsung Galaxy S4 on the left, ASRock Q1900TM-ITX on the right.  Considering one is a full PC motherboard the difference in size is impressive.
Samsung Galaxy S4 on the left, ASRock Q1900TM-ITX on the right. Considering one is a full PC motherboard the difference in size is impressive.

All in all, happy so far and can’t wait to get the case built!  It will involve a laser cut transparent lid and 3d printed brackets for the tuner.  I figured it a good excuse to learn a few new tricks along the way.

Stay tuned for more!

Reverse Tunnels and RaspBMC

I’m once more dabbling in Linux at work so figured I’d give RaspBMC another go with my new knowledge of Linux troubleshooting workarounds…

First of all I thought I’d have a play with SSH so set up a reverse tunnel to access my Pi remotely.  I followed the same steps in this article to no avail;
http://www.tunnelsup.com/raspberry-pi-phoning-home-using-a-reverse-remote-ssh-tunnel/

If I ran the script manually I could create the tunnel no problem, it just wasn’t being created automatically which was a pain.  Turns out that RaspBMC disables cron out of the box so this needed to be re-enabled;
http://www.wexoo.net/20130406/running-cron-jobs-on-raspberry-pi-in-raspbmc

Last of all I found that, as before, my Pi keeps randomly hanging requiring a reboot.  A friend of mine introduced me to the hardware watchdog on the Pi that can be used to reboot if the device goes unresponsive and so far so good;
http://raspberrypi.stackexchange.com/questions/1401/how-do-i-hard-reset-a-raspberry-pi

 

That’s all for now, the new wiring loom is going in the Mini soon though so expect more automotive posts soon!

Jukebox, Illuminated

I’m not finished yet however the lights are in the Jukebox and I thought I’d post a pic of a test I performed by hardwiring the lights to be green;

Let there be light!

It’s the first time since I’ve owned the Jukebox that it has been lit up like this, not long after buying it I tried with EL wire but frankly it looked terrible.  The outer band used to be transparent, for those interested I used a glass etching spray to give it that frosted look and to diffuse the light.  It looks far better in person that this picture would suggest.

I’m currently working on finalising the circuitry to control them as well as the code to control the colour from the PC.  I’ve been mostly successful with my prototypes but there are a few bugs to iron out yet.

Still, the wiring for the lights was by far the biggest hurdle so should be quicker progress from now on.

Keegan

Media Center Video Stutter and Windows Home Server “DEMigrator.exe” Service

I’ve been having an issue for a long time now where video hosted on WHS is played back in Media Center and seemingly randomly the video stutters or stops completely and the UI becomes unresponsive for a while.  After a lot of digging and troubleshooting both in Media Center and Windows Home Server I discovered a simple trick which laid the issue bare.

When the issue occurs you can look at task manager on WHS then it may appear that there is little CPU utilisation, the trick here is to add the columns “IO Read”, “IO Write” and “IO Other”.  You will likely see that DEMigrator.exe has numbers increasing in “IO Other” when the stuttering is happening.  I implemented a fix from the We Got Served Forums and it seems to have worked a treat!  I followed the workaround on the page, repeated here for my records and as it will be easier for me to find and pass on. 🙂

The fix is very simple to implement, just create two text files with the contents below and rename them as indicated.  Create two scheduled tasks, one for on and one for off, and set them to run over night.  I have mine set so DEMigrator is running for three hours between 3am-6am.  You will get an error about the service not running but other than that all should be well.

DemigratorOff.bat

@echo off
sc stop "DriveExtenderMigrator"
sc config "DriveExtenderMigrator" start= disabled
exit

DemigratorOn.bat
@echo off
sc config "DriveExtenderMigrator" start= demand
sc start "DriveExtenderMigrator"
exit

Enjoy!

Keegan

Jukebox Lights: Serial Comms Prototype

I’ve just finished a working prototype for the Jukebox lighting control, doesn’t look like much at the minute but with the right RGB LED driver in place (I’m thinking three logic level MOSFETs may do the job) then this project is only a wiring job and a glue gun away from installation!  The C# code sends RGB as a percentage along with a value for brightness, also a percentage.  So, to get the brightest red colour send redByte and brightness as 100 and the rest as 0.  Mix, match and repeat.

I played with the colour picker control, some conversion is required though I gave up on the idea as PC RGB and LED RGB don’t match up quite the same.  My method works and is good enough for me.  The Arduino code uses a switch case for the incoming command, colour changing is “101” and I’m planning on adding others along the road.  Maybe a default dimmer for when video is playing and so on…  Time will tell.

image IMAG0155

This is a combo of two programs, the code on the Arduino and a C# program sending control signals from the PC via serial.  Code snippets for both are below;

Arduino

//      Pin Assignments
int rPin = 9;
int gPin = 10;
int bPin = 11;
int potPin = 0;

//      Global Variables
float red = 0;
float green = 0;
float blue = 0;
float brightness = 0;
int command;

void setup()
{
pinMode(rPin, OUTPUT);
pinMode(gPin, OUTPUT);
pinMode(bPin, OUTPUT);
Serial.begin(9600);
}

void loop()
{
while (Serial.available() > 0)
{
command = Serial.read();
switch (command)      //  Planning ahead for multiple commands to be sent, add another case for others
{
case 101:
red = Serial.read();
green = Serial.read();
blue = Serial.read();
brightness = Serial.read();
//  Code for debugging Serial
Serial.print(“Colour – “);
Serial.print(“Red: “); Serial.print(red); Serial.println();
Serial.print(“Green: “); Serial.print(green); Serial.println();
Serial.print(“Blue: “); Serial.print(blue); Serial.println();
Serial.print(“Brightness: “); Serial.print(brightness); Serial.println();
Serial.println(red / 100);
red = (255 * (red / 100)) * (brightness / 100);
Serial.println(brightness / 100);
green = (255 * (green / 100)) * (brightness / 100);
blue = (255 * (blue / 100)) * (brightness / 100);
break;
}
}
analogWrite(rPin, red);
analogWrite(gPin, green);
analogWrite(bPin, blue);
delay(75);
}

 

C# Code (SendData and Print only)

private void SendData()
{
byte cmdByte, redByte, blueByte, greenByte, brightByte = 0;
byte[] command = new byte[5];

cmdByte = Convert.ToByte(101);
redByte = Convert.ToByte(nudRed.Value);
greenByte = Convert.ToByte(nudGreen.Value);
blueByte = Convert.ToByte(nudBlue.Value);
brightByte = Convert.ToByte(nudBrightness.Value);

command[0] = cmdByte;
command[1] = redByte;
command[2] = greenByte;
command[3] = blueByte;
command[4] = brightByte;

try
{
prtSerial.Write(command, 0, 5);
}
catch
{
MessageBox.Show(“He no work!”);
}
}

private void btnPrint_Click(object sender, EventArgs e)
{
lbInc.Items.Clear();
try
{
if (prtSerial.BytesToRead == 0)
lbInc.Items.Add(“No Data”);

while (prtSerial.BytesToRead > 0)
{
lbInc.Items.Add(prtSerial.ReadLine());
}
}
catch
{
// do nothing
}
}

I’m hoping to have the driver built next week and hopefully the lights installed this coming weekend.  With the weather as it is it all depends on when I get get the parts delivered.  Next up is the Media Centre add-in to control the lights.  Should be a matter of UI code though as C# is a supported language for MC SDK.

Keegan

Windows Home Server and Windows 7 Network Throughput

I’ve a gigabit network at home and my transfer rates sucked, considering I frequently watch HD content from my Home Server this was less than ideal.  Having a chat with a few of my colleagues at work and after performing a simple tweak on my Home Server, throughput went from 30Mbps peak (that’s mega bits not mega bytes before anyone gets shirty) to a fairly stable 80~90Mbps.  A hefty improvement considering it involved the creation of a registry key and a restart!

Essential it involves enabling Compound TCP and I followed the steps to create the DWORD on this page.  If your Home Server is up to date then you don’t need to install the hotfix, only create the registry entry.

Mstsc to your Home Server and open regedit, don’t forget to backup your registry blah blah blah, and find the following key;

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersTCPCongestionControl

If it isn’t present, create a DWORD of the name TCPCongestionControl and set it the value of 1, reboot and you should be good to go.

UPDATE:  This hasn’t been a permanent fix for me, if anyone has any other tips feel free to add them as a comment.
UPDATE UPDATE:  Inbox Realtek drivers suck ass, www.realtek.com.tw is your friend…

Enjoy,
Keegan