[mythtv-users] Mythtube: Internet Video on Demand

Stuart Larson halcyon at obfus.com
Wed Nov 8 03:34:34 UTC 2006


Instructions are also on the wiki :)

http://www.mythtv.org/wiki/index.php/Stream_mythtv_recordings_from_mythweb_using_flash_video

> say, could you email me these files as attachments, gmail and my other
> email
> clients both wrapped the lines and I can't seem to get them to work.
> at least the flashtranscode file.
>
>
>
>
> On 11/4/06, Jeff volckaert <jvolckaert at gmail.com> wrote:
>>
>> Hello Everybody,
>>
>> I have created a userjob and webpage to play Myth videos in a browser
>> over the internet.  I call it MythTube.  It's very simple to setup and
>> plays video great.  Each flash video is about 80M for an hour long
>> show (minus commercials).  It consists of a php page, a transcode
>> script, and a flash player.  I run the transcode job after the remove
>> commercials script from the Wiki.  The remove commercials may be
>> important as I saw comments about B-Frames being a problem with
>> mencoder.  I believe lossless transcoding removes any B-Frames.
>>
>> To setup Mythtube, first create a directory under your webserver
>> called mythtube.  Mine was "/data/www/html/mythtube".  You will need
>> to change any references below to whatever your directory is.
>>
>> Next, get flvplayer.swf.  Download
>> http://www.jeroenwijering.com/upload/flash_flv_player.zip and move
>> flash_flv_player/extras/flvplayer.swf into your mythtube directory
>> under your webserver.
>>
>> Then create "play.php" and put it in the mythtube directory as well.
>> Here's play.php:
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
>> <html>
>> <head>
>>     <title>Welcome to MythTube!</title>
>> </head>
>>         <body bgcolor="#002650">
>> <h3>Now playing: <?php echo $_GET["movie"]; ?></h3>
>> <br>
>> <div style="text-align: center;">
>> <object type="application/x-shockwave-flash" width="<?php echo
>> $_GET["h"]; ?>" height="<?php echo $_GET["w"]; ?>"
>> wmode="transparent" data="flvplayer.swf?file=<?php echo $_GET["movie"];
>> ?>">
>> <param name="movie" value="flvplayer.swf?file=<?php echo $_GET["movie"];
>> ?>" />
>> <param name="wmode" value="transparent" />
>> </object>
>> </div>
>> <br>
>> <h3>Videos:</h3>
>> <table border="1">
>> <?php
>> $files = scandir("/data/www/html/mythtube");
>> // filter for only .flv files
>> $movies = array();
>> foreach($files as $file) {
>>    if(substr($file,-4) == ".flv") {
>>         echo "<tr><td>".$file."</td>";
>>         echo "<td><a
>> href=\"".$PHP_SELF."?movie=".$file."&h=640&w=480\">Large</a></td>";
>>         echo "<td><a
>> href=\"".$PHP_SELF."?movie=".$file."&h=360&w=240\">Small</a></td></tr>";
>>        $movies[] = $file;
>>    }
>> }
>> ?>
>> </table>
>> </body>
>> </html>
>>
>>
>> Next you need to create the userjob which generates the flv files.
>>
>> Here's the MYSQL commands I used in creating userjob 3:
>> use mythconverg;
>>
>> UPDATE settings SET data='/usr/local/bin/flashtranscode %DIR% %FILE%
>> "%TITLE%" %STARTTIME%' WHERE value='UserJob3';
>>
>> UPDATE settings SET data='Flash Transcode' WHERE value='UserJobDesc3';
>>
>> UPDATE settings SET data='1' WHERE value='JobAllowUserJob3';
>>
>>
>>
>> Here's the /usr/local/bin/flashtranscode script:
>> #!/bin/sh
>> # flashtranscode
>> #
>> # created by Jeff Volckaert (inspired by Zach White)
>> # modified 11/03/06 to use Flash
>> VIDEODIR=$1
>> FILENAME=$2
>> TITLE=$3
>> # Remove non-alpha characters from TITLE
>> TITLE=${TITLE//[^a-zA-Z0-9]/}
>> STARTTIME=$4
>>
>> # Sanity checking, to make sure everything is in order.
>> if [ -z "$VIDEODIR" -o -z "$FILENAME" ]; then
>>         echo "Usage: $0 <VideoDirectory> <FileName> "<Title>"
>> <Starttime>"
>>         exit 5
>> fi
>> if [ ! -f $VIDEODIR/$FILENAME ]; then
>>         echo "File does not exist: $VIDEODIR/$FILENAME"
>>         exit 6
>> fi
>>
>> # Transcode the file
>>
>> mencoder -ofps 12 -of lavf -lavfopts
>> i_certify_that_my_video_stream_does_not_use_b_frames -oac lavc
>> -lavcopts acodec=mp3:abitrate=32 -channels 1 -srate 22050  -ovc lavc
>> -lavcopts
>> vcodec=flv:vbitrate=200:cbp:mv0:mbd=2:trell:v4mv:predia=2:dia=2:last_pred=3
>> -vop spp,scale=360:240,harddup -o
>> /data/www/html/mythtube/$TITLE-$STARTTIME.flv $VIDEODIR/$FILENAME
>>
>> # For a smaller file use this instead.
>> # (It take three times longer to encode though)
>> # mencoder -ofps 12 -of lavf -lavfopts
>> i_certify_that_my_video_stream_does_not_use_b_frames -oac lavc
>> -lavcopts acodec=mp3:abitrate=32 -channels 1 -srate 22050  -ovc lavc
>> -lavcopts
>> vcodec=flv:vbitrate=100:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:predia=2:dia=2:vmax_b_frames=0:vb_strategy=1:precmp=2:cmp=2:subcmp=2:preme=2:qns=2
>> -vop spp,scale=320:240 -o
>> /data/www/html/mythtube/$TITLE-$STARTTIME-2.flv $VIDEODIR/$FILENAME
>>
>> # Uncomment this if you want to insert MetaData tags into the file
>> # /usr/bin/flvtool2/flvtool2 -U
>> /data/www/html/mythtube/$TITLE-$STARTTIME.flv
>>
>> ERROR=$?
>> if [ $ERROR -ne 0 ]; then
>>         echo "Transcoding failed for ${FILENAME} with error $ERROR"
>>         exit 3
>> fi
>>
>>
>> After at least one file has been transcoded you can pull up the
>> play.php page and start watching video.
>>
>> Enjoy,
>> Jeff
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>




More information about the mythtv-users mailing list