Chromecast Game Streaming

Over on /r/chromecast people ask from time to time whether it is possible to stream games to Chromecast. I’ve seen a couple of solutions offered, besides “get a SHIELD”. I’ve already got a Chromecast. I don’t need another dongle.

The first solution is to use the Chrome Google Cast extension to capture the screen and send it to Chromecast. This solution doesn’t work too well. A lot of games use DirectX and, for reasons I won’t go into, you end up transmitting a blank screen to Chromecast. You might be able to work around that by putting the game in Windowed mode, but then, after a brief celebration, you find out it stutters like crazy. Sadly, Google Cast wasn’t designed with game streaming in mind. Lastly, if you have two monitors they are combined and sent so your viewers can watch you surf reddit while you play a very narrow game of Team Fortress 2.

Another solution I saw was to Open Broadcaster to stream to Twitch.TV and then suck it back down to Chromecast. I didn’t try this, but I suspect it would work with a good Internet connection. The solution I offer next is basically this idea, but is removed from the picture.

The general idea

Here’s the plan. We know Open Broadcaster is good at capturing video and sending it to Thousands of people do this everyday. The problem is that it uses a protocol called RTMP, and Chromecast doesn’t understand RTMP. Chromecast understands something called HLS. So we can use a program called nginx to accept RTMP and convert it to HLS. Then we use a web video player to push the HLS stream to Chromecast.

Open Broadcaster

I’m not going to go into great detail on this, because there are all kinds of guides for this. If you’ve never done this, open a account and get streaming working. Once it works modify these settings under Broadcast Settings:

Mode Live Stream
Streaming Service Custom
FMS URL rtmp://
Play Path/Stream Key test


If you’re not a tech professional you’ve probably never heard of nginx. It’s a web server. And it happens to have an RTMP module. What is RTMP you ask? I have no idea, but Open Broadcaster will happily send video to it.

We need nginx with the RTMP module (nginx-rtmp-module) compiled in. If you are using Windows you can download nginx for Windows, which has it.

rtmp {
	server {
		listen 1935;
		chunk_size 4096;
		buflen 10s;

		application live {
			live on;
			record off;
			drop_idle_publisher 5s;

			hls on;
			hls_sync 100ms;
			hls_path "c:/Windows/Temp/hls";
			hls_fragment 10s;
			hls_playlist_length 1m;

application live {
live on;
record off;
drop_idle_publisher 5s;

The section configures the server to process RTMP requests at rtmp://localhost:1935/live. Live streaming is enabled, and recording is disabled.

			hls on;
			hls_sync 100ms;
			hls_path "c:/Windows/Temp/hls";
			hls_fragment 10s;
			hls_playlist_length 1m;

In this section we enable HLS and save the video segments into C:\Windows\Temp\hls. HLS breaks the stream into 10 second chunks. Chromecast retrieves the video segments in order and produces seamless playback.

Next we configure the HTTP server to process HLS requests at http://localhost/hls. It will also serve the video viewer at http://localhost. There is a stats screen at http://localhost/stat.

	server {
		listen       80;
		server_name  localhost;

		root ../www;
		error_page   500 502 503 504  /50x.html;

		location / {
			index index.html;

		location /stat {
			rtmp_stat all;
			rtmp_stat_stylesheet stat.xsl;

		location /stat.xsl {

		location /hls {
			types {
				application/ m3u8;
				video/mp2t ts;
			root "c:/Windows/Temp";
			add_header Cache-Control no-cache;
			add_header Access-Control-Allow-Origin *;

Putting it all Together

Configure Open Broadcaster to stream to rtmp://localhost:1935/live with path “test” and start streaming. Open the browser to http://localhost. You should see a video viewer with a preview of the video. Press play and it should stream.

To get the video to Chromecast open the browser to your internal IP address, in my case Click the Chromecast icon and it should start streaming.


If this was too much for you to handle you can download everything from github. start-server.bat runs nginx so you can configure Open Broadcaster and start streaming right away.

Further Reading

Gradle error on Jenkins

Gradle wanted to create in /usr/share/tomcat7/.gradle/native/jna/linux-amd64/, which is the home directory of Tomcat. Choosing “Force GRADLE_USER_HOME to use workspace” resolved this issue.

[workspace] $ /srv/jenkins/tools/hudson.plugins.gradle.GradleInstallation/Gradle_2.1/bin/gradle --debug build
04:05:25.131 [DEBUG] [] Unable to initialize native-platform. Failure: net.rubygrapefruit.platform.NativeException: Failed to load native library '' for Linux amd64.
caused by: No such file or directory
04:05:29.541 [ERROR] [org.gradle.BuildExceptionReporter] 
04:05:29.544 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
04:05:29.545 [ERROR] [org.gradle.BuildExceptionReporter] 
04:05:29.546 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
04:05:29.546 [ERROR] [org.gradle.BuildExceptionReporter] Could not create an instance of type org.gradle.invocation.DefaultGradle_Decorated.
04:05:29.571 [ERROR] [org.gradle.BuildExceptionReporter] 
04:05:29.573 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
04:05:29.574 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 
Build step 'Invoke Gradle script' changed build result to FAILURE

WinMerge Filter for Eclipse

This filter tells WinMerge to ignore Eclipse files such as .classpath, .project, and the .metadata folder.

## This is a directory/file filter template for WinMerge
name: Eclipse
desc: Eclipse Filter

## Select if filter is inclusive or exclusive
## Inclusive (loose) filter lets through all items not matching rules
## Exclusive filter lets through only items that match to rule
## include or exclude
def: include

## Filters for filenames begin with f:
## Filters for directories begin with d:
## (Inline comments begin with " ##" and extend to the end of the line)

f: \.classpath ## Filter for filename
f: \.project ## Filter for filename
f: rebel.xml ## Filter for filename

d: \\.metadata ## Filter for directory
d: \\.settings ## Filter for directory
d: \\target ## Filter for directory
d: \\.svn ## Filter for directory

Hamcrest Matchers

public class GameChecker extends TypeSafeMatcher<MyGame>
	public void describeTo(final Description description)
		description.appendText("The map was not empty");

	protected boolean matchesSafely(final MyGame game)
		return game.getMap().isEmpty();

	public static Matcher<? super MyGame> isMapEmpty()
		return new GameChecker();

Cajun Curry

After going to Oktoberfest I wondered if there was such as thing as cajun curry. The idea was to make a sausage curry.

I asked for recipe on Reddit and this is what I got. It is more of a honey mustard curry. My guests enjoyed it.

6 chicken breast (cut into bite size pieces)
2 T. curry powder
1/2 c honey
2 tsp cajun spice
3 T. real butter
3 T. water
3 T. yellow mustard
1 T. apple cider vinegar (to mellow out the sweetness)
3 t. lemon juice
3 cloves of garlic crushed

Source: Bella Cosina’s Food Blog

T-Mobile Pre-paid: Pain in the ass (but worth it)

Sprint’s 3G network in San Diego is awful. The network can’t even handle Pandora without buffering. YouTube? Forget it. Now that my Sprint contract is complete I’m finally free to change providers.

After reading Why I’m ditching the Verizon Galaxy Nexus I decided to go with a Galaxy Nexus. The Galaxy Nexus isn’t as fast as the new Samsung Galaxy S3, however it will be the first to get new Android updates, because it’s Google’s baby. It also uses the stock Android user interface and doesn’t come with a lot of bloatware (Sprint: I’m looking at you… NASCAR? Seriously?).

I purchased the phone directly from the Google Play Store. The up-front cost was $350 and the monthly fee from T-Mobile is $30/month. This pre-paid plan gives 100 minutes, unlimited text, and 4G of un-throttled data. Perfect for a light talker such as myself. Since I’m paying $79/month with Sprint it costs $50 less per month, so I’ll re-coup the cost of the phone in 7 months.

It proved difficult to activate the phone on T-Mobile’s “secret” pre-paid plan. T-Mobile wouldn’t activate it, because the pre-paid plan is only available from Wal-Mart. Wal-Mart wouldn’t activate it because I didn’t buy it from Wal-Mart.

The solution was to purchase a 99 cent SIM Card Activation Kit from T-Mobile’s website. Unfortunately I had to wait several days for it to arrive, so make sure to order the phone and the SIM card at the same time. Now that the SIM card has arrived, I was able to activate the Galaxy Nexus on T-Mobile without issue. My Sprint number should transfer by tomorrow. Bye Sprint.

Defragmenting a hard drive with UltraDefrag

For years I’ve been using MyDefrag to defragment (defrag) my hard drive. Unfortunately the software hasn’t been updated for quite a while and appears to be a bit dead at the moment, so I started looking for alternatives. The best free, open source alternative I found was UltraDefrag. It actually may be a bit better than MyDefrag.

I’m one of those crazy people who likes to defrag everyday. My reasoning is that, like a desk, if you keep things tidy there is less to clean up. Here is how to do it:

  1. Download UltraDefrag from the website.
  2. Open a DOS prompt. To do this open the Start menu, type “cmd”, right click it and “Run as Administrator”.
  3. At the prompt type “at 15:00 /EVERY:M,T,W,Th,F,S,Su udefrag c:” and press Enter
  4. Now Windows will defrag your hard drive every day at 3pm (15:00). You can choose a different time. Pick a time when your computer will probably be on.
  5. To run a full defrag on Mondays type “at 15:00 /EVERY:M udefrag -o c:” (remember to remove “M” from the first command or you will defrag twice!)
  6. To stop running UltraDefrag delete the scheduled task. Open Control Panel and type “schedule” into the search box. Then click “Schedule tasks” under Administrative Tools.
  7. Search for the scheduled task you just created and delete it. It is probably called “At1″.

NOTE: By default Windows Vista and Windows 7 automatically defragment the hard drive weekly. Disable this in Control Panel on the “Defragment your hard drive” screen.


I was looking for a good IRC client and I ran across IceChat. It is free and open source. The user interface isn’t as nice as mIRC or XChat2, but the functionality is there. It was very easy to enable post connection commands to authenticate myself and auto-join channels.