Difference between revisions of "Stream mythtv recordings to mobile devices"

From MythTV Official Wiki
Jump to: navigation, search
(cleanup)
Line 5: Line 5:
 
==Prerequisites are:==
 
==Prerequisites are:==
  
1) Working MythTV - already making recordings
+
# Working MythTV - already making recordings
2) ffmpeg capable of creating 3GP recordings (see my guide to streaming via flash video)
+
# ffmpeg capable of creating 3GP recordings (see my guide to streaming via flash video)
  
 
==Concept==
 
==Concept==
Line 19: Line 19:
 
Video playback is of excellent quality with no pauses for buffering.
 
Video playback is of excellent quality with no pauses for buffering.
  
===Guide===
+
==Guide==
  
==Setup Darwin Streaming Server==
+
===Setup Darwin Streaming Server===
  
 
Darwin streaming server is an open source streaming media server made by the good guys at Apple. It can be a little difficult to setup, if I get time to write a full guide ill update this, if anyone else can please contribute. Darwin streaming server is available for Linux, Mac, Windows and Solaris.
 
Darwin streaming server is an open source streaming media server made by the good guys at Apple. It can be a little difficult to setup, if I get time to write a full guide ill update this, if anyone else can please contribute. Darwin streaming server is available for Linux, Mac, Windows and Solaris.
  
Briefly, download the sourcecode tarball from: http://developer.apple.com/opensource/server/streaming/index.html
+
Briefly, download the source code tarball from: http://developer.apple.com/opensource/server/streaming/index.html
  
 
Unpack and run the Buildit script followed by the Install script. This should set everything up simply enough. Check the installation by opening http://localhost:1220 in a web browser to confirm that the server is up and running.
 
Unpack and run the Buildit script followed by the Install script. This should set everything up simply enough. Check the installation by opening http://localhost:1220 in a web browser to confirm that the server is up and running.
  
When configuring the server make sure you add a shared directory and note this down, this is where your 3GP files for streaming will be stored. I use /video, the same dir as my main mythtv recordings.
+
When configuring the server make sure you add a shared directory and note this down, this is where your 3GP files for streaming will be stored. I use /video, the same directory as my main mythtv recordings.
  
==Setup MP4Box==
+
===Setup MP4Box===
  
To ensure that media is streamed correctly "hints" have to be added to help with timing and sync. To make your 3GP files MPEG4 compliant and to add RTSP hints you need to use a program caled MP4Box, available for download as part of the GPAC framework here: http://sourceforge.net/project/showfiles.php?group_id=84101
+
To ensure that media is streamed correctly "hints" have to be added to help with timing and sync. To make your 3GP files MPEG4 compliant and to add RTSP hints you need to use a program called MP4Box, available for download as part of the GPAC framework here: http://sourceforge.net/project/showfiles.php?group_id=84101
  
 
Install this somewhere in your path as per the readme included with the file.
 
Install this somewhere in your path as per the readme included with the file.
  
==Add user job in mythtv==
+
===Add user job in mythtv===
  
 
Next you need to create the script which will be ran as a user job in mythtv. The following is an example:
 
Next you need to create the script which will be ran as a user job in mythtv. The following is an example:
 +
{{Box File|/usr/local/bin/myth3gp.sh|
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash
Line 49: Line 50:
 
MP4Box -3gp -mtu 1450 -hint "$outfile.3gp"
 
MP4Box -3gp -mtu 1450 -hint "$outfile.3gp"
 
</pre>
 
</pre>
 +
}}
 
Save this to /usr/local/bin/myth3gp.sh
 
Save this to /usr/local/bin/myth3gp.sh
  
 
Set the out variable to wherever your Darwin Streaming Server is configured to share. This encodes video at a resolution of 352x288, bitrate 400, 20 frames per second.
 
Set the out variable to wherever your Darwin Streaming Server is configured to share. This encodes video at a resolution of 352x288, bitrate 400, 20 frames per second.
  
Next you need to setup the userjob in mythtv. Run mythtv-setup and go to the General Settings section. Under user jobs find a spare job and give it a name of something apropriate (eg. Myth3GP) and the following command:
+
Next you need to setup the user job in mythtv. Run mythtv-setup and go to the General Settings section. Under user jobs find a spare job and give it a name of something appropriate (eg. Myth3GP) and the following command:
 
<pre>
 
<pre>
 
/usr/local/bin/myth3gp.sh "%DIR%" "%FILE%"
 
/usr/local/bin/myth3gp.sh "%DIR%" "%FILE%"
Line 59: Line 61:
 
Set this job to run for all recordings you want to convert and share. On my Athlon 2800 box it takes 11 mins to convert and share a 30min recording.
 
Set this job to run for all recordings you want to convert and share. On my Athlon 2800 box it takes 11 mins to convert and share a 30min recording.
  
[Create web page linking to shows]
+
=== Create web page linking to shows ===
  
Finally you need a web page to link to your recordings. The following PHP script will work nicely, set the directory and hostname parameters as apropriate.
+
Finally you need a web page to link to your recordings. The following PHP script will work nicely, set the directory and hostname parameters as appropriate.
 +
{{Box File|mobile.php|
 
<pre>
 
<pre>
 
<?php
 
<?php
Line 105: Line 108:
 
?>
 
?>
 
</pre>
 
</pre>
 
+
}}
 
==To Do==
 
==To Do==
 
Write full Darwin Streaming Server install/setup guide
 
Write full Darwin Streaming Server install/setup guide

Revision as of 00:14, 23 March 2007

Streaming MythTV Recordings to mobile devices

This is a quick guide describing how to stream your recordings to mobile devices using 3G technology. It is written for users who have mobile phones or other devices capable of playing video streams of this type as most modern devices can. The phone must be capable of playing a 3GP stream over RTSP, this is pretty standard and can be done on all new Nokia handsets from the last year and prob most other makes.

Prerequisites are:

  1. Working MythTV - already making recordings
  2. ffmpeg capable of creating 3GP recordings (see my guide to streaming via flash video)

Concept

MythTV makes recordings as usual, a user job is ran against the recording to convert it to 3GP and add extra data required for streaming, 3GP files are streamed using Darwin Streaming Server

Tested on

Server: Gentoo box running kernel 2.6.12 with MythTV 0.20 and Darwin Streaming Server 5.5.3. Nokia N80 streaming videos over Wifi and viewing on RealPlayer (comes with phone)

Video playback is of excellent quality with no pauses for buffering.

Guide

Setup Darwin Streaming Server

Darwin streaming server is an open source streaming media server made by the good guys at Apple. It can be a little difficult to setup, if I get time to write a full guide ill update this, if anyone else can please contribute. Darwin streaming server is available for Linux, Mac, Windows and Solaris.

Briefly, download the source code tarball from: http://developer.apple.com/opensource/server/streaming/index.html

Unpack and run the Buildit script followed by the Install script. This should set everything up simply enough. Check the installation by opening http://localhost:1220 in a web browser to confirm that the server is up and running.

When configuring the server make sure you add a shared directory and note this down, this is where your 3GP files for streaming will be stored. I use /video, the same directory as my main mythtv recordings.

Setup MP4Box

To ensure that media is streamed correctly "hints" have to be added to help with timing and sync. To make your 3GP files MPEG4 compliant and to add RTSP hints you need to use a program called MP4Box, available for download as part of the GPAC framework here: http://sourceforge.net/project/showfiles.php?group_id=84101

Install this somewhere in your path as per the readme included with the file.

Add user job in mythtv

Next you need to create the script which will be ran as a user job in mythtv. The following is an example: Template:Box File Save this to /usr/local/bin/myth3gp.sh

Set the out variable to wherever your Darwin Streaming Server is configured to share. This encodes video at a resolution of 352x288, bitrate 400, 20 frames per second.

Next you need to setup the user job in mythtv. Run mythtv-setup and go to the General Settings section. Under user jobs find a spare job and give it a name of something appropriate (eg. Myth3GP) and the following command:

/usr/local/bin/myth3gp.sh "%DIR%" "%FILE%"

Set this job to run for all recordings you want to convert and share. On my Athlon 2800 box it takes 11 mins to convert and share a 30min recording.

Create web page linking to shows

Finally you need a web page to link to your recordings. The following PHP script will work nicely, set the directory and hostname parameters as appropriate. Template:Box File

To Do

Write full Darwin Streaming Server install/setup guide Expire 3GP files with normal recordings.