ROKU HD Frontend

From MythTV Official Wiki
Jump to: navigation, search

I have figured out how to use the ROKU HD box as a Myth Frontend player.

The ROKU box supports a language called BrightScript. It allows you to write custom applications that can run on the ROKU box, just like Netflix, etc.

I wrote a BrightScript application that can get XML data from the MythTV database via a php script. The php script I wrote auto creates show and episode images along with the approriate meta-data to display in the UI.

What you need

1) A server running apache and php that has the ability to communicate with your mysql server used for the mythbackend.
2) My BrightScript package
3) My server side script
4) Enable development mode on your ROKU box
5) Transcode your recordings to H.264 format
6) ffmpeg to create show and episode images

Development Mode

With the ROKU remote enter Home 3 times, Up 2 times, Right, Left, Right, Left, Right to enable it on your ROKU box.

Server Side PHP Script

This script should be placed a public directory on your apache server. The script needs access to the location of your mythtv recordings. There are several variables at the beginning of the script that need to be edited for your setup.

In the roku.php script, the XML generated is hardcoded to say,'quality="HD"', on line 185. If you need SD output from the Roku, it must be changed to 'quality="SD"'.

The script uses ffmpeg to generate the appropriate file images for the ROKU box.

Transcode to H.264

I don't know why, but unfortunately, the ROKU Box only supports H.264 formatted videos. I found a script that does the conversion using mencoder

However, this script doesn't output the correct format for the Roku box and needs to be modified by changing the mencoder line to output in h264/ACC in an mp4 container. All of your transcoded files should have an mp4 extension.

Try one of the following:

ffmpeg -i "${inputfile}" -acodec libfaac -ab 128k -vcodec libx264 -vpre normal -crf 22 -threads 0 -title "${title}" -f mp4 "${outputfile}"

(Newer versions of ffmpeg have a difference in the 'title' option:) ffmpeg -i "${inputfile}" -acodec libfaac -ab 128k -vcodec libx264 -vpre normal -crf 22 -threads 0 -metadata title="${title}" -f mp4 "${outputfile}"

HandBrakeCLI -i infile -o outfile.mp4 -O -r 29.97

BrightScript Application

BrightScript applications are distributed as zip files. You will need to edit the config.brs file in the zip file and change the URL for the roku.php file that you installed on your server. Do not delete or add anything else to the zip file.

Next point your web browser at your ROKU box's IP address. You will get a screen that allows you to upload the zip file.

You can telnet to your ROKU box on port 8085 and watch the debug console if you want.

The main ROKU menu will now have a MythTV icon. Click on that. It will list your shows. It may take a few seconds to build the initial list, as the php server side script needs to generate the appropriate image files. If an image file already exists, then it is not recreated. Likewise, as you drill down into your episodes, image files are created on the fly. They only need to be created once. So future listings will be fast. Download Files - Link dead

Good Luck!

Roku Developer Channel

Roku has a very complete developer program with complete SDK. The forum is active and even has a MythTv plugin in development.