Saturday, June 21, 2014

Converting videos for Roku with Linux

I bought a Roku 3 and I wanted to watch some video files on it. Unfortunately it only supports a few video formats. Maybe this is a good thing as long as it does them well. Conversions are pretty easy using ffmpeg or avconv. An Internet search didn't turn up many results on how to do this, so here's a script I made to make my life easier after I figured out which codec works best.

#!/bin/bash
avconv -i "$1" -strict experimental -c:v libx264 "`echo $1 | sed s/\.[^\.]*$//`.mp4"

To use it, put this in a file called roku-convert.sh and chmod +x
Then use it like this:
./roku-convert.sh video_to_convert.avi

It will create an .mp4 from any formats that your avconv install supports. The .mp4 can be placed on a usb thumb drive and plugged into the side of your Roku 3. Find and play it using the Roku Media Player (download for free from the Roku channel store). Here's what it looks like: