Convert avi to mp4 to stream via the Chromecast [Ubuntu]

I just bought a Chromecast in the name of laziness. Being able to cast youtube, netflix, twitch, my laptop web browser and moreĀ on an ordinary TV via HDMI is pretty cool, but there’s one big missing feature: streaming local media. As other blogs and reddit threads have mentioned, you can often hit Ctrl + O in Chrome and load a video into your browser, but not all media types are supported. Namely the avi format.

I tried converting the avi to mp4 via VLC media player, but the video was jumpy and pretty poor, so I took a deeper look and found a simple one line command to convert .avi to an h264 .mp4 file, which Chrome supports.

First you’ll want to install libav-tools:

sudo apt-get install libav-tools

Then you’ll want to convert the video file with the following command:

avconv -i input.avi -c:v libx264 -c:a copy output.mp4

Voila! After a few minutes, you have your converted mp4 file which runs perfectly in Chrome and is ready to be cast to the big screen.