Joschka Tillmanns

Using Kodi with Chromecast

I am a big fan of the free (free as in open source) media player Kodi. Kodi has a ton of features, is highly extensible and is supported by a big community. I would also guess that it is the most popular application for the Raspberry Pi, which is pretty awesome by itself as people are using this thing to build full featured media stations on a very low budget.

I however would like to use Kodi from my desktop as I am also watching TV shows on my desk. Unfortunately I now have to lay an HDMI cable from my desktop to my TV to be able to use Kodi on that device. But let's be real here, we are living in the 21. century and cables don't belong in this day and age. i could go with a dual setup, using a Raspberry Pi or some other media station. Though I now don't have my 'watched' status synced up and need to go through the hassle of configure and update two setups.

Fortunately Google has brought us this nifty device called Google Chromecast which allows us to stream video over WiFi. To play local video there are some browser extensions like Videostream for Google Chromecast. As one can imagine those extensions don't play along at all with Kodi which is the ultimate goal here rendering this solution unusable. There are a couple of instructions online which help you use Kodi with Chromecast from an Android device. As I am not running Android as my desktop OS this isn't very helpful either. Luckily this brilliant guy called xat brought us Castnow which basically lets you stream local media to your Chromecast from the command line! Now, in order to use Castnow with Kodi all we have to do is configure Castnow as an external player, which is of course super easy with Kodi.

The magic file you have to create is called playercorefactory.xml and needs to be placed in your userdata directory. You may find the location of this directory here. This is the configuration I am using:

   <player name="Castnow" type="ExternalPlayer" audio="false" video="true">
     <args>-e castnow "{1}"</args>
 <rules action="prepend">

Of course in order to use this specific configuration you have to also install urxvt (which is my favorite terminal emulator). I am however sure that this would also work with any other terminal software out there.

Now to stream any video from Kodi to your TV you have to open the context menu on the desired video file and hit Play using…. Select Castnow and you are good to go, enjoy!