![]() |
downloads | documentation | HowTo | reporting bugs | links | Recent Changes |
What is a Wiki?See WikiWikiWeb If you don't know how to use a wiki see the WikiHowto ErfurtWiki is maintained by a loosely knit group of developers. Quick LinksRelated sitesContactPlease submit website bugs in the BugReports Contribute!Please file any wishes on UserSuggestions. Hosted By |
Hi All, UPDATE: This HOW-TO has been updated. Most files need changes. Main updated are; This HOWTO will show you how to get on-the-fly flash streaming within mythweb working. Knoppmyth R5E50 has an older version installed but there were some typo's.
#!/bin/bash Knoppmyth R5F1 has a working older version installed. To use updated version of MythwebFlash follow as below. To use MythWebFlash, simply click on the bitmap for the TV recording you wish to view, and Prerequisitesffmpeg with SWF support. I have upgraded the version that came with Knoppmyth R5D1 but To access this externally you will need to forward ports 80, and 8090 to your knoppmyth box. /var/www/mythweb/data/serverecording Code:
#!/bin/bash
#
# * Bash script to start and monitor server for Mythwebflash
# * Date: 2007-09-03 21:00:00 +1000
# * Version: 1.05
# * Auther: BigB
# *
#
export TERM=dumb
file=$1
bitrate=$2
function create_ffserver.conf(){
rm -f /var/www/mythweb/data/ffserver.conf
echo "Port 8090
BindAddress 0.0.0.0
MaxClients 1000
MaxBandwidth 1500
CustomLog -
<Feed feed1.ffm>
#File /var/www/mythweb/data/feed1.ffm
#FileMaxSize 128K
</Feed>
" >> /var/www/mythweb/data/ffserver.conf
if [ "$bitrate" -eq "128" ]; then
echo "
<Stream flash.swf>
Feed feed1.ffm
Format swf
AudioBitRate 8
AudioChannels 1
AudioSampleRate 11025
AudioCodec mp3
VideoBitRate 96
VideoFrameRate 4
VideoSize 144x80
VideoGopSize 40
VideoCodec flv
</Stream>
" >> /var/www/mythweb/data/ffserver.conf
else
if [ "$bitrate" -eq "256" ]; then
echo "
<Stream flash.swf>
Feed feed1.ffm
Format swf
AudioBitRate 16
AudioChannels 1
AudioSampleRate 11025
AudioCodec mp3
VideoBitRate 196
VideoFrameRate 6
VideoSize 288x160
VideoGopSize 20
VideoCodec flv
</Stream>
" >> /var/www/mythweb/data/ffserver.conf
else
if [ "$bitrate" -eq "384" ]; then
echo "
<Stream flash.swf>
Feed feed1.ffm
Format swf
AudioBitRate 16
AudioChannels 1
AudioSampleRate 11025
AudioCodec mp3
VideoBitRate 300
VideoFrameRate 10
VideoSize 288x160
VideoGopSize 20
VideoCodec flv
</Stream>
" >> /var/www/mythweb/data/ffserver.conf
fi
fi
fi
echo "
<Stream stat.html>
Format status
#ACL allow localhost
#ACL allow 192.168.0.0 192.168.255.255
</Stream>
<Redirect index.html>
URL http://www.ffmpeg.org/
</Redirect>
" >> /var/www/mythweb/data/ffserver.conf
}
DIRECTORY=/myth/tv
kill -9 `cat /var/www/mythweb/data/ffmpeg.pid`
kill -9 `cat /var/www/mythweb/data/transcode.pid`
killall -s 9 ffserver
rm -f /var/www/mythweb/data/feed1.ffm
rm -f /var/www/mythweb/data/audout
rm -f /var/www/mythweb/data/vidout
create_ffserver.conf
framewidth=`/usr/bin/mplayer -vo dummy -identify $DIRECTORY/$file 2>&1 |grep -E "ID_VIDEO_WIDTH" | cut -d= -f2`
frameheight=`/usr/bin/mplayer -vo dummy -identify $DIRECTORY/$file 2>&1 |grep -E "ID_VIDEO_HEIGHT" | cut -d= -f2`
framerate=`/usr/bin/mplayer -vo dummy -identify $DIRECTORY/$file 2>&1 |grep -E "ID_VIDEO_FPS" | cut -d= -f2`
/usr/bin/ffserver -f /var/www/mythweb/data/ffserver.conf 1> /dev/null 2> /dev/null &
PID_FFSERVER=$!
echo $PID_FFSERVER > /var/www/mythweb/data/ffserver.pid
nice -n 19 /usr/bin/mythtranscode -p autodetect -i $DIRECTORY/$file -f /var/www/mythweb/data/ 2> /dev/null 1> /dev/null &
PID_TRANSCODE=$!
echo $PID_TRANSCODE > /var/www/mythweb/data/transcode.pid
#wait for fifos
WAIT_COUNT=30
while [ "$WAIT_COUNT" -gt "0" ]; do
sleep 1
if [ -e /var/www/mythweb/data/audout ] && [ -e /var/www/mythweb/data/vidout ]; then
break
else
let WAIT_COUNT=WAIT_COUNT-1
fi
done
if [ "$WAIT_COUNT" -eq "0" ]; then
kill -9 `cat /var/www/mythweb/data/transcode.pid`
killall -s 9 ffserver
rm -f /var/www/mythweb/data/audout
rm -f /var/www/mythweb/data/vidout
exit 1
fi
sleep 1
nice -n 19 /usr/bin/ffmpeg -y -f s16le -ar 48000 -ac 2 -i /var/www/mythweb/data/audout -f rawvideo -r "$framerate" -aspect 16:9 -s "$framewidth"x"$frameheight" -i /var/www/mythweb/data/vidout http://localhost:8090/feed1.ffm 2> /dev/null 1> /dev/null &
PID_FFMPEG=$!
echo $PID_FFMPEG > /var/www/mythweb/data/ffmpeg.pid
IDLE_COUNT=20
while [ "$IDLE_COUNT" -gt "0" ]; do
sleep 1
if [ "`lynx -dump http://localhost:8090/stat.html | grep -c "flash.swf"`" -lt "3" ]; then
let "IDLE_COUNT = IDLE_COUNT - 1"
else
IDLE_COUNT=2
fi
done
kill -9 `cat /var/www/mythweb/data/ffmpeg.pid`
kill -9 `cat /var/www/mythweb/data/transcode.pid`
rm -f /var/www/mythweb/data/audout
rm -f /var/www/mythweb/data/vidout
rm -f /var/www/mythweb/data/ffserver.conf
killall -s 9 ffserver
/var/www/mythweb/data/waitflash Code:
#!/bin/bash
#
# * Bash script to wait for valid flash stream Mythwebflash
# * Date: 2007-09-03 21:00:00 +1000
# * Version: 1.01
# * Auther: BigB
# *
#
IDLE_COUNT=30
while [ "$IDLE_COUNT" -gt "0" ]; do
sleep 1
if [ "`lynx -dump http://localhost:8090/stat.html | grep -c "feed1.ffm(input)"`" -gt "0" ]; then
IDLE_COUNT=0
else
let "IDLE_COUNT = IDLE_COUNT - 1"
fi
done
sleep 2
/var/www/mythweb/modules/tv/streamrecording.php Code:
<?php
/**
* Init Mythwebflash
* Date: 2006-12-06 23:50:00 +1000
* Version: 1.01
* Auther: BigB
*
/**/
// Load the class for this page
require_once tmpl_dir.'streamrecording.php';
// Exit
exit;
?>
/var/www/mythweb/modules/tv/tmpl/default/streamrecording.php Code:
<?php
/**
* Themed page for Mythwebflash
* Date: 2007-09-03 12:00:00 +1000
* Version: 1.04
* Auther: BigB
*
/**/
echo '<html>';
echo '<head>';
if(!isset($_GET['play'])){
echo '<meta http-equiv="refresh" content="1;url=';
echo $_SERVER['PHP_SELF']."?file=".$_GET['file']."&title=".$_GET['title']."&subtitle=".$_GET['subtitle']."&description=".$_GET['description']."&play=true";
echo '">';
}
echo '<title>Stream recording</title>';
echo '</head>';
echo '<body>';
// Set the desired page title
$page_title = 'MythWeb - Stream recording';
// Print the page header
require 'modules/_shared/tmpl/default/header.php';
if(!isset($_GET['file'])){
print"<br /><br /><center><strong>You can not access this page directly!</strong></center>";
die;
}
if(!isset($_GET['width'])){
$width = '300';
}
else {
$width = $_GET['width'];
}
if(!isset($_GET['title'])){
$title = 'Unknown Title';
}
else {
$title = $_GET['title'];
}
if(!isset($_GET['subtitle'])){
$subtitle = '';
}
else {
$subtitle = $_GET['subtitle'];
}
if(!isset($_GET['description'])){
$description = '';
}
else {
$description = $_GET['description'];
}
if(!isset($_GET['height'])){
$height = '220'; //accounts for toolbar at bottom
} else {
$height = $_GET['height'];
}
if(!isset($_GET['bitrate'])){
$bitrate = '128';
} else {
$bitrate = $_GET['bitrate'];
}
$toplay = $_GET['file'];
if(!isset($_GET['play'])){
system ("bash -c \"exec nohup setsid /var/www/mythweb/data/serverecording $toplay $bitrate 1> /dev/null 2> /dev/null &\"");
} else {
system ("bash -c \"exec nohup setsid /var/www/mythweb/data/waitflash 1> /dev/null 2> /dev/null \"");
}
?>
<table width="100%" border="0" cellpadding="4" cellspacing="2" class="list small">
<tr class="recorded" height="15%">
<td rowspan="3" align="center" valign="middle" height="305" width="535">
<?php
if(isset($_GET['play'])){
echo '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="530" height="300" id="flvplayer" align="middle">';
echo '<param name="movie" value="http://';
echo getenv('SERVER_NAME');
echo ':8090/flash.swf" />';
echo '<param name="quality" value="high" />';
echo '<param name="bgcolor" value="#ffffff" />';
echo '<embed src="http://';
echo getenv('SERVER_NAME');
echo ':8090/flash.swf" width="530" height="300" quality="high" bgcolor="#fffff5" name="flvplayer" align="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
echo '</object>';
}
else{
echo 'Loading, Please wait...
You need to modify /var/www/mythweb/modules/tv/tmpl/default/recorded.php Code:
if (file_exists(cache_dir.'/'.basename($show->filename).'.png')) {
list($width,$height,$type,$attr)=getimagesize(cache_dir.'/'.basename($show->filename).'.png');
$clean_desc=str_replace("\"","",$show->description);
echo '<a href="streamrecording?file='.basename($show->filename).'&title='.$show->title.'&subtitle='.$show->subtitle.'&description='.$clean_desc.'"name=\"$row\"target=\"_new\">'
.'<img id="'.$show->filename.'"src="'.root.cache_dir.'/'.str_replace('%2F','/',rawurlencode(basename($show->filename))).'.png"'.$attr.'border="0">'
.'</a>';
}
Another change around line 316, it's a php block that provides several bit rates to stream at; Code:
</tr><tr id="statusrow_<?php echo $row ?>" class="recorded">
<td nowrap colspan="<?php echo 6 + ($_SESSION['recorded_descunder']? 0 : 1) + $recgroup_cols?>"align="center">
<?php
$clean_desc=str_replace("\"","",$show->description);
echo '<p align="left">Stream: ';
echo '<a href="streamrecording?file='.basename($show->filename).'&title='.$show->title.'&subtitle='.$show->subtitle.'&description='.$clean_desc.'&bitrate=128"name=\"$row\"target=\"_new\">128kbps</a>';
echo '<a href="streamrecording?file='.basename($show->filename).'&title='.$show->title.'&subtitle='.$show->subtitle.'&description='.$clean_desc.'&bitrate=256"name=\"$row\"target=\"_new\">256kbps</a>';
echo '<a href="streamrecording?file='.basename($show->filename).'&title='.$show->title.'&subtitle='.$show->subtitle.'&description='.$clean_desc.'&bitrate=384"name=\"$row\"target=\"_new\">384kbps</a>';
?>
<span style="padding-left: 25px">
<span style="padding-right: 25px">
<?php echo t('has commflag')
?>
You also need to modify /var/www/mythweb/modules/tv/handler.php to allow the new file. Code:
// Unknown section? Use the default
if (!in_array($Path[1], array('detail', 'channel', 'search', 'movies', 'streamrecording'))
&& empty($Modules['tv']['links'][$Path[1]]))
$Path[1] = 'list';
The config file (/etc/ffserve.conf) is no longer required as it is dynamically created is /var/www/mythweb/data For interest you can connect to http://localhost:8090/stat.html for a status of the stream server. BigB. EditThisPage BackLinks PageInfo Pages like this Attachments RSS/Atom last changed on Thu Nov 1 06:58:48 2007 |
UpdatedPages· WhatRemoteYouUse last changed on Sat Jul 31 10:46:47 2010· WhatCardYouUse last changed on Sat Jul 31 10:45:00 2010 · TinnyAudioPVR150 last changed on Fri Jul 30 03:20:30 2010 · KnoppMythWiki last changed on Thu Jul 29 04:35:17 2010 · HowTo last changed on Wed Jul 28 09:27:02 2010 · HardwareAcceleratedVideo last changed on Tue Jul 27 09:15:10 2010 · MythVodkaHowTo last changed on Tue Jul 27 09:14:04 2010 · DisklessFrontend last changed on Tue Jul 27 09:13:29 2010 · CompileMythTVFromSVN last changed on Tue Jul 27 07:39:28 2010 · MythMusic last changed on Tue Jul 27 07:38:00 2010 · RRD Disk Partition Usage last changed on Sun Jul 25 21:34:12 2010 · UserSuggestions last changed on Sun Jul 25 16:25:51 2010 · Links last changed on Sun Jul 25 16:21:33 2010 · KnoppmythDownloads last changed on Sun Jul 25 14:02:11 2010 · KnoppMythInstall last changed on Sun Jul 25 14:00:46 2010 · TroubleShooting last changed on Wed Jul 21 07:03:13 2010 · webminhowto last changed on Mon Jul 19 07:34:28 2010 · PickingComponents last changed on Wed Jul 14 17:27:40 2010 · mplayerResume last changed on Mon Jul 12 22:54:24 2010 · R5A12DvdRipping last changed on Mon Jul 12 14:44:04 2010 · Additional Software last changed on Mon Jul 12 14:42:31 2010 · HowToUseMyth last changed on Mon Jul 12 14:41:09 2010 · x11vncHowTo last changed on Sun Jul 11 00:06:20 2010 · CountrySpecific last changed on Thu Jul 1 14:48:40 2010 · RepairingMythConvergDB last changed on Thu Jul 1 14:42:58 2010 · tv_grab_au last changed on Tue Jun 29 15:44:05 2010 |
| sitemap | | |