Difference between revisions of "ROKU HD Frontend"

From MythTV Official Wiki
Jump to: navigation, search
(Transcode to H.264)
(9 intermediate revisions by 3 users not shown)
Line 10: Line 10:
  
 
1) A server running apache and php that has the ability to communicate with your mysql server used for the mythbackend.<br>
 
1) A server running apache and php that has the ability to communicate with your mysql server used for the mythbackend.<br>
2) My [http://my.pogoplug.com/share/9sR3JbCBahVp8tMekTY3Tg roku.zip] BrightScript package<br>
+
2) My BrightScript package<br>
3) My [http://my.pogoplug.com/share/n1d-VzisNjCiX9kP-b_Ceg roku.php] server side script<br>
+
3) My server side script<br>
 
4) Enable development mode on your ROKU box<br>
 
4) Enable development mode on your ROKU box<br>
 
5) Transcode your recordings to H.264 format<br>
 
5) Transcode your recordings to H.264 format<br>
Line 24: Line 24:
 
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.
 
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.
  
[http://my.pogoplug.com/share/n1d-VzisNjCiX9kP-b_Ceg roku.php]<br>
+
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"'.
<br>
+
 
 
The script uses ffmpeg to generate the appropriate file images for the ROKU box.
 
The script uses ffmpeg to generate the appropriate file images for the ROKU box.
  
 
== Transcode to H.264 ==
 
== 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<p>
+
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<br>
  
 
http://eternalvoid.net/tutorials/mythtv-autotranscode/mythtv-transcode-h264.sh<br>
 
http://eternalvoid.net/tutorials/mythtv-autotranscode/mythtv-transcode-h264.sh<br>
  
All of your transcoded files should have an mp4 extension.
+
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 Application ==
Line 44: Line 53:
 
You can telnet to your ROKU box on port 8085 and watch the debug console if you want.<br>
 
You can telnet to your ROKU box on port 8085 and watch the debug console if you want.<br>
  
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.<br>
+
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.<br>
 
+
<br>
[http://my.pogoplug.com/share/9sR3JbCBahVp8tMekTY3Tg roku.zip]
+
[http://my.pogoplug.com/share/CnmZV-E-bwY7HDJw0FXGYA Download Files]
 
+
<br>
 +
<br>
 
Good Luck!
 
Good Luck!
 +
 +
== Roku Developer Channel ==
 +
Roku has a very complete developer program with complete SDK.  The [http://forums.roku.com/viewforum.php?f=34 forum] is active and even has a MythTv plugin in [http://forums.roku.com/viewtopic.php?f=28&t=33704 development].

Revision as of 21:15, 16 October 2011


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

http://eternalvoid.net/tutorials/mythtv-autotranscode/mythtv-transcode-h264.sh

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

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.